Skip to main content

google_cloud_recommender_v1/
model.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_type;
25extern crate serde;
26extern crate serde_json;
27extern crate serde_with;
28extern crate std;
29extern crate tracing;
30extern crate wkt;
31
32mod debug;
33mod deserialize;
34mod serialize;
35
36/// An insight along with the information used to derive the insight. The insight
37/// may have associated recommendations as well.
38#[derive(Clone, Default, PartialEq)]
39#[non_exhaustive]
40pub struct Insight {
41    /// Name of the insight.
42    pub name: std::string::String,
43
44    /// Free-form human readable summary in English. The maximum length is 500
45    /// characters.
46    pub description: std::string::String,
47
48    /// Fully qualified resource names that this insight is targeting.
49    pub target_resources: std::vec::Vec<std::string::String>,
50
51    /// Insight subtype. Insight content schema will be stable for a given subtype.
52    pub insight_subtype: std::string::String,
53
54    /// A struct of custom fields to explain the insight.
55    /// Example: "grantedPermissionsCount": "1000"
56    pub content: std::option::Option<wkt::Struct>,
57
58    /// Timestamp of the latest data used to generate the insight.
59    pub last_refresh_time: std::option::Option<wkt::Timestamp>,
60
61    /// Observation period that led to the insight. The source data used to
62    /// generate the insight ends at last_refresh_time and begins at
63    /// (last_refresh_time - observation_period).
64    pub observation_period: std::option::Option<wkt::Duration>,
65
66    /// Information state and metadata.
67    pub state_info: std::option::Option<crate::model::InsightStateInfo>,
68
69    /// Category being targeted by the insight.
70    pub category: crate::model::insight::Category,
71
72    /// Insight's severity.
73    pub severity: crate::model::insight::Severity,
74
75    /// Fingerprint of the Insight. Provides optimistic locking when updating
76    /// states.
77    pub etag: std::string::String,
78
79    /// Recommendations derived from this insight.
80    pub associated_recommendations: std::vec::Vec<crate::model::insight::RecommendationReference>,
81
82    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
83}
84
85impl Insight {
86    /// Creates a new default instance.
87    pub fn new() -> Self {
88        std::default::Default::default()
89    }
90
91    /// Sets the value of [name][crate::model::Insight::name].
92    ///
93    /// # Example
94    /// ```ignore,no_run
95    /// # use google_cloud_recommender_v1::model::Insight;
96    /// let x = Insight::new().set_name("example");
97    /// ```
98    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
99        self.name = v.into();
100        self
101    }
102
103    /// Sets the value of [description][crate::model::Insight::description].
104    ///
105    /// # Example
106    /// ```ignore,no_run
107    /// # use google_cloud_recommender_v1::model::Insight;
108    /// let x = Insight::new().set_description("example");
109    /// ```
110    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
111        self.description = v.into();
112        self
113    }
114
115    /// Sets the value of [target_resources][crate::model::Insight::target_resources].
116    ///
117    /// # Example
118    /// ```ignore,no_run
119    /// # use google_cloud_recommender_v1::model::Insight;
120    /// let x = Insight::new().set_target_resources(["a", "b", "c"]);
121    /// ```
122    pub fn set_target_resources<T, V>(mut self, v: T) -> Self
123    where
124        T: std::iter::IntoIterator<Item = V>,
125        V: std::convert::Into<std::string::String>,
126    {
127        use std::iter::Iterator;
128        self.target_resources = v.into_iter().map(|i| i.into()).collect();
129        self
130    }
131
132    /// Sets the value of [insight_subtype][crate::model::Insight::insight_subtype].
133    ///
134    /// # Example
135    /// ```ignore,no_run
136    /// # use google_cloud_recommender_v1::model::Insight;
137    /// let x = Insight::new().set_insight_subtype("example");
138    /// ```
139    pub fn set_insight_subtype<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
140        self.insight_subtype = v.into();
141        self
142    }
143
144    /// Sets the value of [content][crate::model::Insight::content].
145    ///
146    /// # Example
147    /// ```ignore,no_run
148    /// # use google_cloud_recommender_v1::model::Insight;
149    /// use wkt::Struct;
150    /// let x = Insight::new().set_content(Struct::default()/* use setters */);
151    /// ```
152    pub fn set_content<T>(mut self, v: T) -> Self
153    where
154        T: std::convert::Into<wkt::Struct>,
155    {
156        self.content = std::option::Option::Some(v.into());
157        self
158    }
159
160    /// Sets or clears the value of [content][crate::model::Insight::content].
161    ///
162    /// # Example
163    /// ```ignore,no_run
164    /// # use google_cloud_recommender_v1::model::Insight;
165    /// use wkt::Struct;
166    /// let x = Insight::new().set_or_clear_content(Some(Struct::default()/* use setters */));
167    /// let x = Insight::new().set_or_clear_content(None::<Struct>);
168    /// ```
169    pub fn set_or_clear_content<T>(mut self, v: std::option::Option<T>) -> Self
170    where
171        T: std::convert::Into<wkt::Struct>,
172    {
173        self.content = v.map(|x| x.into());
174        self
175    }
176
177    /// Sets the value of [last_refresh_time][crate::model::Insight::last_refresh_time].
178    ///
179    /// # Example
180    /// ```ignore,no_run
181    /// # use google_cloud_recommender_v1::model::Insight;
182    /// use wkt::Timestamp;
183    /// let x = Insight::new().set_last_refresh_time(Timestamp::default()/* use setters */);
184    /// ```
185    pub fn set_last_refresh_time<T>(mut self, v: T) -> Self
186    where
187        T: std::convert::Into<wkt::Timestamp>,
188    {
189        self.last_refresh_time = std::option::Option::Some(v.into());
190        self
191    }
192
193    /// Sets or clears the value of [last_refresh_time][crate::model::Insight::last_refresh_time].
194    ///
195    /// # Example
196    /// ```ignore,no_run
197    /// # use google_cloud_recommender_v1::model::Insight;
198    /// use wkt::Timestamp;
199    /// let x = Insight::new().set_or_clear_last_refresh_time(Some(Timestamp::default()/* use setters */));
200    /// let x = Insight::new().set_or_clear_last_refresh_time(None::<Timestamp>);
201    /// ```
202    pub fn set_or_clear_last_refresh_time<T>(mut self, v: std::option::Option<T>) -> Self
203    where
204        T: std::convert::Into<wkt::Timestamp>,
205    {
206        self.last_refresh_time = v.map(|x| x.into());
207        self
208    }
209
210    /// Sets the value of [observation_period][crate::model::Insight::observation_period].
211    ///
212    /// # Example
213    /// ```ignore,no_run
214    /// # use google_cloud_recommender_v1::model::Insight;
215    /// use wkt::Duration;
216    /// let x = Insight::new().set_observation_period(Duration::default()/* use setters */);
217    /// ```
218    pub fn set_observation_period<T>(mut self, v: T) -> Self
219    where
220        T: std::convert::Into<wkt::Duration>,
221    {
222        self.observation_period = std::option::Option::Some(v.into());
223        self
224    }
225
226    /// Sets or clears the value of [observation_period][crate::model::Insight::observation_period].
227    ///
228    /// # Example
229    /// ```ignore,no_run
230    /// # use google_cloud_recommender_v1::model::Insight;
231    /// use wkt::Duration;
232    /// let x = Insight::new().set_or_clear_observation_period(Some(Duration::default()/* use setters */));
233    /// let x = Insight::new().set_or_clear_observation_period(None::<Duration>);
234    /// ```
235    pub fn set_or_clear_observation_period<T>(mut self, v: std::option::Option<T>) -> Self
236    where
237        T: std::convert::Into<wkt::Duration>,
238    {
239        self.observation_period = v.map(|x| x.into());
240        self
241    }
242
243    /// Sets the value of [state_info][crate::model::Insight::state_info].
244    ///
245    /// # Example
246    /// ```ignore,no_run
247    /// # use google_cloud_recommender_v1::model::Insight;
248    /// use google_cloud_recommender_v1::model::InsightStateInfo;
249    /// let x = Insight::new().set_state_info(InsightStateInfo::default()/* use setters */);
250    /// ```
251    pub fn set_state_info<T>(mut self, v: T) -> Self
252    where
253        T: std::convert::Into<crate::model::InsightStateInfo>,
254    {
255        self.state_info = std::option::Option::Some(v.into());
256        self
257    }
258
259    /// Sets or clears the value of [state_info][crate::model::Insight::state_info].
260    ///
261    /// # Example
262    /// ```ignore,no_run
263    /// # use google_cloud_recommender_v1::model::Insight;
264    /// use google_cloud_recommender_v1::model::InsightStateInfo;
265    /// let x = Insight::new().set_or_clear_state_info(Some(InsightStateInfo::default()/* use setters */));
266    /// let x = Insight::new().set_or_clear_state_info(None::<InsightStateInfo>);
267    /// ```
268    pub fn set_or_clear_state_info<T>(mut self, v: std::option::Option<T>) -> Self
269    where
270        T: std::convert::Into<crate::model::InsightStateInfo>,
271    {
272        self.state_info = v.map(|x| x.into());
273        self
274    }
275
276    /// Sets the value of [category][crate::model::Insight::category].
277    ///
278    /// # Example
279    /// ```ignore,no_run
280    /// # use google_cloud_recommender_v1::model::Insight;
281    /// use google_cloud_recommender_v1::model::insight::Category;
282    /// let x0 = Insight::new().set_category(Category::Cost);
283    /// let x1 = Insight::new().set_category(Category::Security);
284    /// let x2 = Insight::new().set_category(Category::Performance);
285    /// ```
286    pub fn set_category<T: std::convert::Into<crate::model::insight::Category>>(
287        mut self,
288        v: T,
289    ) -> Self {
290        self.category = v.into();
291        self
292    }
293
294    /// Sets the value of [severity][crate::model::Insight::severity].
295    ///
296    /// # Example
297    /// ```ignore,no_run
298    /// # use google_cloud_recommender_v1::model::Insight;
299    /// use google_cloud_recommender_v1::model::insight::Severity;
300    /// let x0 = Insight::new().set_severity(Severity::Low);
301    /// let x1 = Insight::new().set_severity(Severity::Medium);
302    /// let x2 = Insight::new().set_severity(Severity::High);
303    /// ```
304    pub fn set_severity<T: std::convert::Into<crate::model::insight::Severity>>(
305        mut self,
306        v: T,
307    ) -> Self {
308        self.severity = v.into();
309        self
310    }
311
312    /// Sets the value of [etag][crate::model::Insight::etag].
313    ///
314    /// # Example
315    /// ```ignore,no_run
316    /// # use google_cloud_recommender_v1::model::Insight;
317    /// let x = Insight::new().set_etag("example");
318    /// ```
319    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
320        self.etag = v.into();
321        self
322    }
323
324    /// Sets the value of [associated_recommendations][crate::model::Insight::associated_recommendations].
325    ///
326    /// # Example
327    /// ```ignore,no_run
328    /// # use google_cloud_recommender_v1::model::Insight;
329    /// use google_cloud_recommender_v1::model::insight::RecommendationReference;
330    /// let x = Insight::new()
331    ///     .set_associated_recommendations([
332    ///         RecommendationReference::default()/* use setters */,
333    ///         RecommendationReference::default()/* use (different) setters */,
334    ///     ]);
335    /// ```
336    pub fn set_associated_recommendations<T, V>(mut self, v: T) -> Self
337    where
338        T: std::iter::IntoIterator<Item = V>,
339        V: std::convert::Into<crate::model::insight::RecommendationReference>,
340    {
341        use std::iter::Iterator;
342        self.associated_recommendations = v.into_iter().map(|i| i.into()).collect();
343        self
344    }
345}
346
347impl wkt::message::Message for Insight {
348    fn typename() -> &'static str {
349        "type.googleapis.com/google.cloud.recommender.v1.Insight"
350    }
351}
352
353/// Defines additional types related to [Insight].
354pub mod insight {
355    #[allow(unused_imports)]
356    use super::*;
357
358    /// Reference to an associated recommendation.
359    #[derive(Clone, Default, PartialEq)]
360    #[non_exhaustive]
361    pub struct RecommendationReference {
362        /// Recommendation resource name, e.g.
363        /// projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_ID]
364        pub recommendation: std::string::String,
365
366        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
367    }
368
369    impl RecommendationReference {
370        /// Creates a new default instance.
371        pub fn new() -> Self {
372            std::default::Default::default()
373        }
374
375        /// Sets the value of [recommendation][crate::model::insight::RecommendationReference::recommendation].
376        ///
377        /// # Example
378        /// ```ignore,no_run
379        /// # use google_cloud_recommender_v1::model::insight::RecommendationReference;
380        /// let x = RecommendationReference::new().set_recommendation("example");
381        /// ```
382        pub fn set_recommendation<T: std::convert::Into<std::string::String>>(
383            mut self,
384            v: T,
385        ) -> Self {
386            self.recommendation = v.into();
387            self
388        }
389    }
390
391    impl wkt::message::Message for RecommendationReference {
392        fn typename() -> &'static str {
393            "type.googleapis.com/google.cloud.recommender.v1.Insight.RecommendationReference"
394        }
395    }
396
397    /// Insight category.
398    ///
399    /// # Working with unknown values
400    ///
401    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
402    /// additional enum variants at any time. Adding new variants is not considered
403    /// a breaking change. Applications should write their code in anticipation of:
404    ///
405    /// - New values appearing in future releases of the client library, **and**
406    /// - New values received dynamically, without application changes.
407    ///
408    /// Please consult the [Working with enums] section in the user guide for some
409    /// guidelines.
410    ///
411    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
412    #[derive(Clone, Debug, PartialEq)]
413    #[non_exhaustive]
414    pub enum Category {
415        /// Unspecified category.
416        Unspecified,
417        /// The insight is related to cost.
418        Cost,
419        /// The insight is related to security.
420        Security,
421        /// The insight is related to performance.
422        Performance,
423        /// This insight is related to manageability.
424        Manageability,
425        /// The insight is related to sustainability.
426        Sustainability,
427        /// This insight is related to reliability.
428        Reliability,
429        /// If set, the enum was initialized with an unknown value.
430        ///
431        /// Applications can examine the value using [Category::value] or
432        /// [Category::name].
433        UnknownValue(category::UnknownValue),
434    }
435
436    #[doc(hidden)]
437    pub mod category {
438        #[allow(unused_imports)]
439        use super::*;
440        #[derive(Clone, Debug, PartialEq)]
441        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
442    }
443
444    impl Category {
445        /// Gets the enum value.
446        ///
447        /// Returns `None` if the enum contains an unknown value deserialized from
448        /// the string representation of enums.
449        pub fn value(&self) -> std::option::Option<i32> {
450            match self {
451                Self::Unspecified => std::option::Option::Some(0),
452                Self::Cost => std::option::Option::Some(1),
453                Self::Security => std::option::Option::Some(2),
454                Self::Performance => std::option::Option::Some(3),
455                Self::Manageability => std::option::Option::Some(4),
456                Self::Sustainability => std::option::Option::Some(5),
457                Self::Reliability => std::option::Option::Some(6),
458                Self::UnknownValue(u) => u.0.value(),
459            }
460        }
461
462        /// Gets the enum value as a string.
463        ///
464        /// Returns `None` if the enum contains an unknown value deserialized from
465        /// the integer representation of enums.
466        pub fn name(&self) -> std::option::Option<&str> {
467            match self {
468                Self::Unspecified => std::option::Option::Some("CATEGORY_UNSPECIFIED"),
469                Self::Cost => std::option::Option::Some("COST"),
470                Self::Security => std::option::Option::Some("SECURITY"),
471                Self::Performance => std::option::Option::Some("PERFORMANCE"),
472                Self::Manageability => std::option::Option::Some("MANAGEABILITY"),
473                Self::Sustainability => std::option::Option::Some("SUSTAINABILITY"),
474                Self::Reliability => std::option::Option::Some("RELIABILITY"),
475                Self::UnknownValue(u) => u.0.name(),
476            }
477        }
478    }
479
480    impl std::default::Default for Category {
481        fn default() -> Self {
482            use std::convert::From;
483            Self::from(0)
484        }
485    }
486
487    impl std::fmt::Display for Category {
488        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
489            wkt::internal::display_enum(f, self.name(), self.value())
490        }
491    }
492
493    impl std::convert::From<i32> for Category {
494        fn from(value: i32) -> Self {
495            match value {
496                0 => Self::Unspecified,
497                1 => Self::Cost,
498                2 => Self::Security,
499                3 => Self::Performance,
500                4 => Self::Manageability,
501                5 => Self::Sustainability,
502                6 => Self::Reliability,
503                _ => Self::UnknownValue(category::UnknownValue(
504                    wkt::internal::UnknownEnumValue::Integer(value),
505                )),
506            }
507        }
508    }
509
510    impl std::convert::From<&str> for Category {
511        fn from(value: &str) -> Self {
512            use std::string::ToString;
513            match value {
514                "CATEGORY_UNSPECIFIED" => Self::Unspecified,
515                "COST" => Self::Cost,
516                "SECURITY" => Self::Security,
517                "PERFORMANCE" => Self::Performance,
518                "MANAGEABILITY" => Self::Manageability,
519                "SUSTAINABILITY" => Self::Sustainability,
520                "RELIABILITY" => Self::Reliability,
521                _ => Self::UnknownValue(category::UnknownValue(
522                    wkt::internal::UnknownEnumValue::String(value.to_string()),
523                )),
524            }
525        }
526    }
527
528    impl serde::ser::Serialize for Category {
529        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
530        where
531            S: serde::Serializer,
532        {
533            match self {
534                Self::Unspecified => serializer.serialize_i32(0),
535                Self::Cost => serializer.serialize_i32(1),
536                Self::Security => serializer.serialize_i32(2),
537                Self::Performance => serializer.serialize_i32(3),
538                Self::Manageability => serializer.serialize_i32(4),
539                Self::Sustainability => serializer.serialize_i32(5),
540                Self::Reliability => serializer.serialize_i32(6),
541                Self::UnknownValue(u) => u.0.serialize(serializer),
542            }
543        }
544    }
545
546    impl<'de> serde::de::Deserialize<'de> for Category {
547        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
548        where
549            D: serde::Deserializer<'de>,
550        {
551            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Category>::new(
552                ".google.cloud.recommender.v1.Insight.Category",
553            ))
554        }
555    }
556
557    /// Insight severity levels.
558    ///
559    /// # Working with unknown values
560    ///
561    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
562    /// additional enum variants at any time. Adding new variants is not considered
563    /// a breaking change. Applications should write their code in anticipation of:
564    ///
565    /// - New values appearing in future releases of the client library, **and**
566    /// - New values received dynamically, without application changes.
567    ///
568    /// Please consult the [Working with enums] section in the user guide for some
569    /// guidelines.
570    ///
571    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
572    #[derive(Clone, Debug, PartialEq)]
573    #[non_exhaustive]
574    pub enum Severity {
575        /// Insight has unspecified severity.
576        Unspecified,
577        /// Insight has low severity.
578        Low,
579        /// Insight has medium severity.
580        Medium,
581        /// Insight has high severity.
582        High,
583        /// Insight has critical severity.
584        Critical,
585        /// If set, the enum was initialized with an unknown value.
586        ///
587        /// Applications can examine the value using [Severity::value] or
588        /// [Severity::name].
589        UnknownValue(severity::UnknownValue),
590    }
591
592    #[doc(hidden)]
593    pub mod severity {
594        #[allow(unused_imports)]
595        use super::*;
596        #[derive(Clone, Debug, PartialEq)]
597        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
598    }
599
600    impl Severity {
601        /// Gets the enum value.
602        ///
603        /// Returns `None` if the enum contains an unknown value deserialized from
604        /// the string representation of enums.
605        pub fn value(&self) -> std::option::Option<i32> {
606            match self {
607                Self::Unspecified => std::option::Option::Some(0),
608                Self::Low => std::option::Option::Some(1),
609                Self::Medium => std::option::Option::Some(2),
610                Self::High => std::option::Option::Some(3),
611                Self::Critical => std::option::Option::Some(4),
612                Self::UnknownValue(u) => u.0.value(),
613            }
614        }
615
616        /// Gets the enum value as a string.
617        ///
618        /// Returns `None` if the enum contains an unknown value deserialized from
619        /// the integer representation of enums.
620        pub fn name(&self) -> std::option::Option<&str> {
621            match self {
622                Self::Unspecified => std::option::Option::Some("SEVERITY_UNSPECIFIED"),
623                Self::Low => std::option::Option::Some("LOW"),
624                Self::Medium => std::option::Option::Some("MEDIUM"),
625                Self::High => std::option::Option::Some("HIGH"),
626                Self::Critical => std::option::Option::Some("CRITICAL"),
627                Self::UnknownValue(u) => u.0.name(),
628            }
629        }
630    }
631
632    impl std::default::Default for Severity {
633        fn default() -> Self {
634            use std::convert::From;
635            Self::from(0)
636        }
637    }
638
639    impl std::fmt::Display for Severity {
640        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
641            wkt::internal::display_enum(f, self.name(), self.value())
642        }
643    }
644
645    impl std::convert::From<i32> for Severity {
646        fn from(value: i32) -> Self {
647            match value {
648                0 => Self::Unspecified,
649                1 => Self::Low,
650                2 => Self::Medium,
651                3 => Self::High,
652                4 => Self::Critical,
653                _ => Self::UnknownValue(severity::UnknownValue(
654                    wkt::internal::UnknownEnumValue::Integer(value),
655                )),
656            }
657        }
658    }
659
660    impl std::convert::From<&str> for Severity {
661        fn from(value: &str) -> Self {
662            use std::string::ToString;
663            match value {
664                "SEVERITY_UNSPECIFIED" => Self::Unspecified,
665                "LOW" => Self::Low,
666                "MEDIUM" => Self::Medium,
667                "HIGH" => Self::High,
668                "CRITICAL" => Self::Critical,
669                _ => Self::UnknownValue(severity::UnknownValue(
670                    wkt::internal::UnknownEnumValue::String(value.to_string()),
671                )),
672            }
673        }
674    }
675
676    impl serde::ser::Serialize for Severity {
677        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
678        where
679            S: serde::Serializer,
680        {
681            match self {
682                Self::Unspecified => serializer.serialize_i32(0),
683                Self::Low => serializer.serialize_i32(1),
684                Self::Medium => serializer.serialize_i32(2),
685                Self::High => serializer.serialize_i32(3),
686                Self::Critical => serializer.serialize_i32(4),
687                Self::UnknownValue(u) => u.0.serialize(serializer),
688            }
689        }
690    }
691
692    impl<'de> serde::de::Deserialize<'de> for Severity {
693        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
694        where
695            D: serde::Deserializer<'de>,
696        {
697            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Severity>::new(
698                ".google.cloud.recommender.v1.Insight.Severity",
699            ))
700        }
701    }
702}
703
704/// Information related to insight state.
705#[derive(Clone, Default, PartialEq)]
706#[non_exhaustive]
707pub struct InsightStateInfo {
708    /// Insight state.
709    pub state: crate::model::insight_state_info::State,
710
711    /// A map of metadata for the state, provided by user or automations systems.
712    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,
713
714    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
715}
716
717impl InsightStateInfo {
718    /// Creates a new default instance.
719    pub fn new() -> Self {
720        std::default::Default::default()
721    }
722
723    /// Sets the value of [state][crate::model::InsightStateInfo::state].
724    ///
725    /// # Example
726    /// ```ignore,no_run
727    /// # use google_cloud_recommender_v1::model::InsightStateInfo;
728    /// use google_cloud_recommender_v1::model::insight_state_info::State;
729    /// let x0 = InsightStateInfo::new().set_state(State::Active);
730    /// let x1 = InsightStateInfo::new().set_state(State::Accepted);
731    /// let x2 = InsightStateInfo::new().set_state(State::Dismissed);
732    /// ```
733    pub fn set_state<T: std::convert::Into<crate::model::insight_state_info::State>>(
734        mut self,
735        v: T,
736    ) -> Self {
737        self.state = v.into();
738        self
739    }
740
741    /// Sets the value of [state_metadata][crate::model::InsightStateInfo::state_metadata].
742    ///
743    /// # Example
744    /// ```ignore,no_run
745    /// # use google_cloud_recommender_v1::model::InsightStateInfo;
746    /// let x = InsightStateInfo::new().set_state_metadata([
747    ///     ("key0", "abc"),
748    ///     ("key1", "xyz"),
749    /// ]);
750    /// ```
751    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
752    where
753        T: std::iter::IntoIterator<Item = (K, V)>,
754        K: std::convert::Into<std::string::String>,
755        V: std::convert::Into<std::string::String>,
756    {
757        use std::iter::Iterator;
758        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
759        self
760    }
761}
762
763impl wkt::message::Message for InsightStateInfo {
764    fn typename() -> &'static str {
765        "type.googleapis.com/google.cloud.recommender.v1.InsightStateInfo"
766    }
767}
768
769/// Defines additional types related to [InsightStateInfo].
770pub mod insight_state_info {
771    #[allow(unused_imports)]
772    use super::*;
773
774    /// Represents insight state.
775    ///
776    /// # Working with unknown values
777    ///
778    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
779    /// additional enum variants at any time. Adding new variants is not considered
780    /// a breaking change. Applications should write their code in anticipation of:
781    ///
782    /// - New values appearing in future releases of the client library, **and**
783    /// - New values received dynamically, without application changes.
784    ///
785    /// Please consult the [Working with enums] section in the user guide for some
786    /// guidelines.
787    ///
788    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
789    #[derive(Clone, Debug, PartialEq)]
790    #[non_exhaustive]
791    pub enum State {
792        /// Unspecified state.
793        Unspecified,
794        /// Insight is active. Content for ACTIVE insights can be updated by Google.
795        /// ACTIVE insights can be marked DISMISSED OR ACCEPTED.
796        Active,
797        /// Some action has been taken based on this insight. Insights become
798        /// accepted when a recommendation derived from the insight has been marked
799        /// CLAIMED, SUCCEEDED, or FAILED. ACTIVE insights can also be marked
800        /// ACCEPTED explicitly. Content for ACCEPTED insights is immutable. ACCEPTED
801        /// insights can only be marked ACCEPTED (which may update state metadata).
802        Accepted,
803        /// Insight is dismissed. Content for DISMISSED insights can be updated by
804        /// Google. DISMISSED insights can be marked as ACTIVE.
805        Dismissed,
806        /// If set, the enum was initialized with an unknown value.
807        ///
808        /// Applications can examine the value using [State::value] or
809        /// [State::name].
810        UnknownValue(state::UnknownValue),
811    }
812
813    #[doc(hidden)]
814    pub mod state {
815        #[allow(unused_imports)]
816        use super::*;
817        #[derive(Clone, Debug, PartialEq)]
818        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
819    }
820
821    impl State {
822        /// Gets the enum value.
823        ///
824        /// Returns `None` if the enum contains an unknown value deserialized from
825        /// the string representation of enums.
826        pub fn value(&self) -> std::option::Option<i32> {
827            match self {
828                Self::Unspecified => std::option::Option::Some(0),
829                Self::Active => std::option::Option::Some(1),
830                Self::Accepted => std::option::Option::Some(2),
831                Self::Dismissed => std::option::Option::Some(3),
832                Self::UnknownValue(u) => u.0.value(),
833            }
834        }
835
836        /// Gets the enum value as a string.
837        ///
838        /// Returns `None` if the enum contains an unknown value deserialized from
839        /// the integer representation of enums.
840        pub fn name(&self) -> std::option::Option<&str> {
841            match self {
842                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
843                Self::Active => std::option::Option::Some("ACTIVE"),
844                Self::Accepted => std::option::Option::Some("ACCEPTED"),
845                Self::Dismissed => std::option::Option::Some("DISMISSED"),
846                Self::UnknownValue(u) => u.0.name(),
847            }
848        }
849    }
850
851    impl std::default::Default for State {
852        fn default() -> Self {
853            use std::convert::From;
854            Self::from(0)
855        }
856    }
857
858    impl std::fmt::Display for State {
859        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
860            wkt::internal::display_enum(f, self.name(), self.value())
861        }
862    }
863
864    impl std::convert::From<i32> for State {
865        fn from(value: i32) -> Self {
866            match value {
867                0 => Self::Unspecified,
868                1 => Self::Active,
869                2 => Self::Accepted,
870                3 => Self::Dismissed,
871                _ => Self::UnknownValue(state::UnknownValue(
872                    wkt::internal::UnknownEnumValue::Integer(value),
873                )),
874            }
875        }
876    }
877
878    impl std::convert::From<&str> for State {
879        fn from(value: &str) -> Self {
880            use std::string::ToString;
881            match value {
882                "STATE_UNSPECIFIED" => Self::Unspecified,
883                "ACTIVE" => Self::Active,
884                "ACCEPTED" => Self::Accepted,
885                "DISMISSED" => Self::Dismissed,
886                _ => Self::UnknownValue(state::UnknownValue(
887                    wkt::internal::UnknownEnumValue::String(value.to_string()),
888                )),
889            }
890        }
891    }
892
893    impl serde::ser::Serialize for State {
894        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
895        where
896            S: serde::Serializer,
897        {
898            match self {
899                Self::Unspecified => serializer.serialize_i32(0),
900                Self::Active => serializer.serialize_i32(1),
901                Self::Accepted => serializer.serialize_i32(2),
902                Self::Dismissed => serializer.serialize_i32(3),
903                Self::UnknownValue(u) => u.0.serialize(serializer),
904            }
905        }
906    }
907
908    impl<'de> serde::de::Deserialize<'de> for State {
909        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
910        where
911            D: serde::Deserializer<'de>,
912        {
913            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
914                ".google.cloud.recommender.v1.InsightStateInfo.State",
915            ))
916        }
917    }
918}
919
920/// Configuration for an InsightType.
921#[derive(Clone, Default, PartialEq)]
922#[non_exhaustive]
923pub struct InsightTypeConfig {
924    /// Name of insight type config.
925    /// Eg,
926    /// projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config
927    pub name: std::string::String,
928
929    /// InsightTypeGenerationConfig which configures the generation of
930    /// insights for this insight type.
931    pub insight_type_generation_config:
932        std::option::Option<crate::model::InsightTypeGenerationConfig>,
933
934    /// Fingerprint of the InsightTypeConfig. Provides optimistic locking when
935    /// updating.
936    pub etag: std::string::String,
937
938    /// Last time when the config was updated.
939    pub update_time: std::option::Option<wkt::Timestamp>,
940
941    /// Output only. Immutable. The revision ID of the config.
942    /// A new revision is committed whenever the config is changed in any way.
943    /// The format is an 8-character hexadecimal string.
944    pub revision_id: std::string::String,
945
946    /// Allows clients to store small amounts of arbitrary data. Annotations must
947    /// follow the Kubernetes syntax.
948    /// The total size of all keys and values combined is limited to 256k.
949    /// Key can have 2 segments: prefix (optional) and name (required),
950    /// separated by a slash (/).
951    /// Prefix must be a DNS subdomain.
952    /// Name must be 63 characters or less, begin and end with alphanumerics,
953    /// with dashes (-), underscores (_), dots (.), and alphanumerics between.
954    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
955
956    /// A user-settable field to provide a human-readable name to be used in user
957    /// interfaces.
958    pub display_name: std::string::String,
959
960    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
961}
962
963impl InsightTypeConfig {
964    /// Creates a new default instance.
965    pub fn new() -> Self {
966        std::default::Default::default()
967    }
968
969    /// Sets the value of [name][crate::model::InsightTypeConfig::name].
970    ///
971    /// # Example
972    /// ```ignore,no_run
973    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
974    /// let x = InsightTypeConfig::new().set_name("example");
975    /// ```
976    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
977        self.name = v.into();
978        self
979    }
980
981    /// Sets the value of [insight_type_generation_config][crate::model::InsightTypeConfig::insight_type_generation_config].
982    ///
983    /// # Example
984    /// ```ignore,no_run
985    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
986    /// use google_cloud_recommender_v1::model::InsightTypeGenerationConfig;
987    /// let x = InsightTypeConfig::new().set_insight_type_generation_config(InsightTypeGenerationConfig::default()/* use setters */);
988    /// ```
989    pub fn set_insight_type_generation_config<T>(mut self, v: T) -> Self
990    where
991        T: std::convert::Into<crate::model::InsightTypeGenerationConfig>,
992    {
993        self.insight_type_generation_config = std::option::Option::Some(v.into());
994        self
995    }
996
997    /// Sets or clears the value of [insight_type_generation_config][crate::model::InsightTypeConfig::insight_type_generation_config].
998    ///
999    /// # Example
1000    /// ```ignore,no_run
1001    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
1002    /// use google_cloud_recommender_v1::model::InsightTypeGenerationConfig;
1003    /// let x = InsightTypeConfig::new().set_or_clear_insight_type_generation_config(Some(InsightTypeGenerationConfig::default()/* use setters */));
1004    /// let x = InsightTypeConfig::new().set_or_clear_insight_type_generation_config(None::<InsightTypeGenerationConfig>);
1005    /// ```
1006    pub fn set_or_clear_insight_type_generation_config<T>(
1007        mut self,
1008        v: std::option::Option<T>,
1009    ) -> Self
1010    where
1011        T: std::convert::Into<crate::model::InsightTypeGenerationConfig>,
1012    {
1013        self.insight_type_generation_config = v.map(|x| x.into());
1014        self
1015    }
1016
1017    /// Sets the value of [etag][crate::model::InsightTypeConfig::etag].
1018    ///
1019    /// # Example
1020    /// ```ignore,no_run
1021    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
1022    /// let x = InsightTypeConfig::new().set_etag("example");
1023    /// ```
1024    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1025        self.etag = v.into();
1026        self
1027    }
1028
1029    /// Sets the value of [update_time][crate::model::InsightTypeConfig::update_time].
1030    ///
1031    /// # Example
1032    /// ```ignore,no_run
1033    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
1034    /// use wkt::Timestamp;
1035    /// let x = InsightTypeConfig::new().set_update_time(Timestamp::default()/* use setters */);
1036    /// ```
1037    pub fn set_update_time<T>(mut self, v: T) -> Self
1038    where
1039        T: std::convert::Into<wkt::Timestamp>,
1040    {
1041        self.update_time = std::option::Option::Some(v.into());
1042        self
1043    }
1044
1045    /// Sets or clears the value of [update_time][crate::model::InsightTypeConfig::update_time].
1046    ///
1047    /// # Example
1048    /// ```ignore,no_run
1049    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
1050    /// use wkt::Timestamp;
1051    /// let x = InsightTypeConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
1052    /// let x = InsightTypeConfig::new().set_or_clear_update_time(None::<Timestamp>);
1053    /// ```
1054    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
1055    where
1056        T: std::convert::Into<wkt::Timestamp>,
1057    {
1058        self.update_time = v.map(|x| x.into());
1059        self
1060    }
1061
1062    /// Sets the value of [revision_id][crate::model::InsightTypeConfig::revision_id].
1063    ///
1064    /// # Example
1065    /// ```ignore,no_run
1066    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
1067    /// let x = InsightTypeConfig::new().set_revision_id("example");
1068    /// ```
1069    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1070        self.revision_id = v.into();
1071        self
1072    }
1073
1074    /// Sets the value of [annotations][crate::model::InsightTypeConfig::annotations].
1075    ///
1076    /// # Example
1077    /// ```ignore,no_run
1078    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
1079    /// let x = InsightTypeConfig::new().set_annotations([
1080    ///     ("key0", "abc"),
1081    ///     ("key1", "xyz"),
1082    /// ]);
1083    /// ```
1084    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
1085    where
1086        T: std::iter::IntoIterator<Item = (K, V)>,
1087        K: std::convert::Into<std::string::String>,
1088        V: std::convert::Into<std::string::String>,
1089    {
1090        use std::iter::Iterator;
1091        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
1092        self
1093    }
1094
1095    /// Sets the value of [display_name][crate::model::InsightTypeConfig::display_name].
1096    ///
1097    /// # Example
1098    /// ```ignore,no_run
1099    /// # use google_cloud_recommender_v1::model::InsightTypeConfig;
1100    /// let x = InsightTypeConfig::new().set_display_name("example");
1101    /// ```
1102    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1103        self.display_name = v.into();
1104        self
1105    }
1106}
1107
1108impl wkt::message::Message for InsightTypeConfig {
1109    fn typename() -> &'static str {
1110        "type.googleapis.com/google.cloud.recommender.v1.InsightTypeConfig"
1111    }
1112}
1113
1114/// A configuration to customize the generation of insights.
1115/// Eg, customizing the lookback period considered when generating a
1116/// insight.
1117#[derive(Clone, Default, PartialEq)]
1118#[non_exhaustive]
1119pub struct InsightTypeGenerationConfig {
1120    /// Parameters for this InsightTypeGenerationConfig. These configs can be used
1121    /// by or are applied to all subtypes.
1122    pub params: std::option::Option<wkt::Struct>,
1123
1124    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1125}
1126
1127impl InsightTypeGenerationConfig {
1128    /// Creates a new default instance.
1129    pub fn new() -> Self {
1130        std::default::Default::default()
1131    }
1132
1133    /// Sets the value of [params][crate::model::InsightTypeGenerationConfig::params].
1134    ///
1135    /// # Example
1136    /// ```ignore,no_run
1137    /// # use google_cloud_recommender_v1::model::InsightTypeGenerationConfig;
1138    /// use wkt::Struct;
1139    /// let x = InsightTypeGenerationConfig::new().set_params(Struct::default()/* use setters */);
1140    /// ```
1141    pub fn set_params<T>(mut self, v: T) -> Self
1142    where
1143        T: std::convert::Into<wkt::Struct>,
1144    {
1145        self.params = std::option::Option::Some(v.into());
1146        self
1147    }
1148
1149    /// Sets or clears the value of [params][crate::model::InsightTypeGenerationConfig::params].
1150    ///
1151    /// # Example
1152    /// ```ignore,no_run
1153    /// # use google_cloud_recommender_v1::model::InsightTypeGenerationConfig;
1154    /// use wkt::Struct;
1155    /// let x = InsightTypeGenerationConfig::new().set_or_clear_params(Some(Struct::default()/* use setters */));
1156    /// let x = InsightTypeGenerationConfig::new().set_or_clear_params(None::<Struct>);
1157    /// ```
1158    pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
1159    where
1160        T: std::convert::Into<wkt::Struct>,
1161    {
1162        self.params = v.map(|x| x.into());
1163        self
1164    }
1165}
1166
1167impl wkt::message::Message for InsightTypeGenerationConfig {
1168    fn typename() -> &'static str {
1169        "type.googleapis.com/google.cloud.recommender.v1.InsightTypeGenerationConfig"
1170    }
1171}
1172
1173/// A recommendation along with a suggested action. E.g., a rightsizing
1174/// recommendation for an underutilized VM, IAM role recommendations, etc
1175#[derive(Clone, Default, PartialEq)]
1176#[non_exhaustive]
1177pub struct Recommendation {
1178    /// Name of recommendation.
1179    pub name: std::string::String,
1180
1181    /// Free-form human readable summary in English. The maximum length is 500
1182    /// characters.
1183    pub description: std::string::String,
1184
1185    /// Contains an identifier for a subtype of recommendations produced for the
1186    /// same recommender. Subtype is a function of content and impact, meaning a
1187    /// new subtype might be added when significant changes to `content` or
1188    /// `primary_impact.category` are introduced. See the Recommenders section
1189    /// to see a list of subtypes for a given Recommender.
1190    ///
1191    /// Examples:
1192    /// For recommender = "google.iam.policy.Recommender",
1193    /// recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE"
1194    pub recommender_subtype: std::string::String,
1195
1196    /// Last time this recommendation was refreshed by the system that created it
1197    /// in the first place.
1198    pub last_refresh_time: std::option::Option<wkt::Timestamp>,
1199
1200    /// The primary impact that this recommendation can have while trying to
1201    /// optimize for one category.
1202    pub primary_impact: std::option::Option<crate::model::Impact>,
1203
1204    /// Optional set of additional impact that this recommendation may have when
1205    /// trying to optimize for the primary category. These may be positive
1206    /// or negative.
1207    pub additional_impact: std::vec::Vec<crate::model::Impact>,
1208
1209    /// Recommendation's priority.
1210    pub priority: crate::model::recommendation::Priority,
1211
1212    /// Content of the recommendation describing recommended changes to resources.
1213    pub content: std::option::Option<crate::model::RecommendationContent>,
1214
1215    /// Information for state. Contains state and metadata.
1216    pub state_info: std::option::Option<crate::model::RecommendationStateInfo>,
1217
1218    /// Fingerprint of the Recommendation. Provides optimistic locking when
1219    /// updating states.
1220    pub etag: std::string::String,
1221
1222    /// Insights that led to this recommendation.
1223    pub associated_insights: std::vec::Vec<crate::model::recommendation::InsightReference>,
1224
1225    /// Corresponds to a mutually exclusive group ID within a recommender.
1226    /// A non-empty ID indicates that the recommendation belongs to a mutually
1227    /// exclusive group. This means that only one recommendation within the group
1228    /// is suggested to be applied.
1229    pub xor_group_id: std::string::String,
1230
1231    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1232}
1233
1234impl Recommendation {
1235    /// Creates a new default instance.
1236    pub fn new() -> Self {
1237        std::default::Default::default()
1238    }
1239
1240    /// Sets the value of [name][crate::model::Recommendation::name].
1241    ///
1242    /// # Example
1243    /// ```ignore,no_run
1244    /// # use google_cloud_recommender_v1::model::Recommendation;
1245    /// let x = Recommendation::new().set_name("example");
1246    /// ```
1247    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1248        self.name = v.into();
1249        self
1250    }
1251
1252    /// Sets the value of [description][crate::model::Recommendation::description].
1253    ///
1254    /// # Example
1255    /// ```ignore,no_run
1256    /// # use google_cloud_recommender_v1::model::Recommendation;
1257    /// let x = Recommendation::new().set_description("example");
1258    /// ```
1259    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1260        self.description = v.into();
1261        self
1262    }
1263
1264    /// Sets the value of [recommender_subtype][crate::model::Recommendation::recommender_subtype].
1265    ///
1266    /// # Example
1267    /// ```ignore,no_run
1268    /// # use google_cloud_recommender_v1::model::Recommendation;
1269    /// let x = Recommendation::new().set_recommender_subtype("example");
1270    /// ```
1271    pub fn set_recommender_subtype<T: std::convert::Into<std::string::String>>(
1272        mut self,
1273        v: T,
1274    ) -> Self {
1275        self.recommender_subtype = v.into();
1276        self
1277    }
1278
1279    /// Sets the value of [last_refresh_time][crate::model::Recommendation::last_refresh_time].
1280    ///
1281    /// # Example
1282    /// ```ignore,no_run
1283    /// # use google_cloud_recommender_v1::model::Recommendation;
1284    /// use wkt::Timestamp;
1285    /// let x = Recommendation::new().set_last_refresh_time(Timestamp::default()/* use setters */);
1286    /// ```
1287    pub fn set_last_refresh_time<T>(mut self, v: T) -> Self
1288    where
1289        T: std::convert::Into<wkt::Timestamp>,
1290    {
1291        self.last_refresh_time = std::option::Option::Some(v.into());
1292        self
1293    }
1294
1295    /// Sets or clears the value of [last_refresh_time][crate::model::Recommendation::last_refresh_time].
1296    ///
1297    /// # Example
1298    /// ```ignore,no_run
1299    /// # use google_cloud_recommender_v1::model::Recommendation;
1300    /// use wkt::Timestamp;
1301    /// let x = Recommendation::new().set_or_clear_last_refresh_time(Some(Timestamp::default()/* use setters */));
1302    /// let x = Recommendation::new().set_or_clear_last_refresh_time(None::<Timestamp>);
1303    /// ```
1304    pub fn set_or_clear_last_refresh_time<T>(mut self, v: std::option::Option<T>) -> Self
1305    where
1306        T: std::convert::Into<wkt::Timestamp>,
1307    {
1308        self.last_refresh_time = v.map(|x| x.into());
1309        self
1310    }
1311
1312    /// Sets the value of [primary_impact][crate::model::Recommendation::primary_impact].
1313    ///
1314    /// # Example
1315    /// ```ignore,no_run
1316    /// # use google_cloud_recommender_v1::model::Recommendation;
1317    /// use google_cloud_recommender_v1::model::Impact;
1318    /// let x = Recommendation::new().set_primary_impact(Impact::default()/* use setters */);
1319    /// ```
1320    pub fn set_primary_impact<T>(mut self, v: T) -> Self
1321    where
1322        T: std::convert::Into<crate::model::Impact>,
1323    {
1324        self.primary_impact = std::option::Option::Some(v.into());
1325        self
1326    }
1327
1328    /// Sets or clears the value of [primary_impact][crate::model::Recommendation::primary_impact].
1329    ///
1330    /// # Example
1331    /// ```ignore,no_run
1332    /// # use google_cloud_recommender_v1::model::Recommendation;
1333    /// use google_cloud_recommender_v1::model::Impact;
1334    /// let x = Recommendation::new().set_or_clear_primary_impact(Some(Impact::default()/* use setters */));
1335    /// let x = Recommendation::new().set_or_clear_primary_impact(None::<Impact>);
1336    /// ```
1337    pub fn set_or_clear_primary_impact<T>(mut self, v: std::option::Option<T>) -> Self
1338    where
1339        T: std::convert::Into<crate::model::Impact>,
1340    {
1341        self.primary_impact = v.map(|x| x.into());
1342        self
1343    }
1344
1345    /// Sets the value of [additional_impact][crate::model::Recommendation::additional_impact].
1346    ///
1347    /// # Example
1348    /// ```ignore,no_run
1349    /// # use google_cloud_recommender_v1::model::Recommendation;
1350    /// use google_cloud_recommender_v1::model::Impact;
1351    /// let x = Recommendation::new()
1352    ///     .set_additional_impact([
1353    ///         Impact::default()/* use setters */,
1354    ///         Impact::default()/* use (different) setters */,
1355    ///     ]);
1356    /// ```
1357    pub fn set_additional_impact<T, V>(mut self, v: T) -> Self
1358    where
1359        T: std::iter::IntoIterator<Item = V>,
1360        V: std::convert::Into<crate::model::Impact>,
1361    {
1362        use std::iter::Iterator;
1363        self.additional_impact = v.into_iter().map(|i| i.into()).collect();
1364        self
1365    }
1366
1367    /// Sets the value of [priority][crate::model::Recommendation::priority].
1368    ///
1369    /// # Example
1370    /// ```ignore,no_run
1371    /// # use google_cloud_recommender_v1::model::Recommendation;
1372    /// use google_cloud_recommender_v1::model::recommendation::Priority;
1373    /// let x0 = Recommendation::new().set_priority(Priority::P4);
1374    /// let x1 = Recommendation::new().set_priority(Priority::P3);
1375    /// let x2 = Recommendation::new().set_priority(Priority::P2);
1376    /// ```
1377    pub fn set_priority<T: std::convert::Into<crate::model::recommendation::Priority>>(
1378        mut self,
1379        v: T,
1380    ) -> Self {
1381        self.priority = v.into();
1382        self
1383    }
1384
1385    /// Sets the value of [content][crate::model::Recommendation::content].
1386    ///
1387    /// # Example
1388    /// ```ignore,no_run
1389    /// # use google_cloud_recommender_v1::model::Recommendation;
1390    /// use google_cloud_recommender_v1::model::RecommendationContent;
1391    /// let x = Recommendation::new().set_content(RecommendationContent::default()/* use setters */);
1392    /// ```
1393    pub fn set_content<T>(mut self, v: T) -> Self
1394    where
1395        T: std::convert::Into<crate::model::RecommendationContent>,
1396    {
1397        self.content = std::option::Option::Some(v.into());
1398        self
1399    }
1400
1401    /// Sets or clears the value of [content][crate::model::Recommendation::content].
1402    ///
1403    /// # Example
1404    /// ```ignore,no_run
1405    /// # use google_cloud_recommender_v1::model::Recommendation;
1406    /// use google_cloud_recommender_v1::model::RecommendationContent;
1407    /// let x = Recommendation::new().set_or_clear_content(Some(RecommendationContent::default()/* use setters */));
1408    /// let x = Recommendation::new().set_or_clear_content(None::<RecommendationContent>);
1409    /// ```
1410    pub fn set_or_clear_content<T>(mut self, v: std::option::Option<T>) -> Self
1411    where
1412        T: std::convert::Into<crate::model::RecommendationContent>,
1413    {
1414        self.content = v.map(|x| x.into());
1415        self
1416    }
1417
1418    /// Sets the value of [state_info][crate::model::Recommendation::state_info].
1419    ///
1420    /// # Example
1421    /// ```ignore,no_run
1422    /// # use google_cloud_recommender_v1::model::Recommendation;
1423    /// use google_cloud_recommender_v1::model::RecommendationStateInfo;
1424    /// let x = Recommendation::new().set_state_info(RecommendationStateInfo::default()/* use setters */);
1425    /// ```
1426    pub fn set_state_info<T>(mut self, v: T) -> Self
1427    where
1428        T: std::convert::Into<crate::model::RecommendationStateInfo>,
1429    {
1430        self.state_info = std::option::Option::Some(v.into());
1431        self
1432    }
1433
1434    /// Sets or clears the value of [state_info][crate::model::Recommendation::state_info].
1435    ///
1436    /// # Example
1437    /// ```ignore,no_run
1438    /// # use google_cloud_recommender_v1::model::Recommendation;
1439    /// use google_cloud_recommender_v1::model::RecommendationStateInfo;
1440    /// let x = Recommendation::new().set_or_clear_state_info(Some(RecommendationStateInfo::default()/* use setters */));
1441    /// let x = Recommendation::new().set_or_clear_state_info(None::<RecommendationStateInfo>);
1442    /// ```
1443    pub fn set_or_clear_state_info<T>(mut self, v: std::option::Option<T>) -> Self
1444    where
1445        T: std::convert::Into<crate::model::RecommendationStateInfo>,
1446    {
1447        self.state_info = v.map(|x| x.into());
1448        self
1449    }
1450
1451    /// Sets the value of [etag][crate::model::Recommendation::etag].
1452    ///
1453    /// # Example
1454    /// ```ignore,no_run
1455    /// # use google_cloud_recommender_v1::model::Recommendation;
1456    /// let x = Recommendation::new().set_etag("example");
1457    /// ```
1458    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1459        self.etag = v.into();
1460        self
1461    }
1462
1463    /// Sets the value of [associated_insights][crate::model::Recommendation::associated_insights].
1464    ///
1465    /// # Example
1466    /// ```ignore,no_run
1467    /// # use google_cloud_recommender_v1::model::Recommendation;
1468    /// use google_cloud_recommender_v1::model::recommendation::InsightReference;
1469    /// let x = Recommendation::new()
1470    ///     .set_associated_insights([
1471    ///         InsightReference::default()/* use setters */,
1472    ///         InsightReference::default()/* use (different) setters */,
1473    ///     ]);
1474    /// ```
1475    pub fn set_associated_insights<T, V>(mut self, v: T) -> Self
1476    where
1477        T: std::iter::IntoIterator<Item = V>,
1478        V: std::convert::Into<crate::model::recommendation::InsightReference>,
1479    {
1480        use std::iter::Iterator;
1481        self.associated_insights = v.into_iter().map(|i| i.into()).collect();
1482        self
1483    }
1484
1485    /// Sets the value of [xor_group_id][crate::model::Recommendation::xor_group_id].
1486    ///
1487    /// # Example
1488    /// ```ignore,no_run
1489    /// # use google_cloud_recommender_v1::model::Recommendation;
1490    /// let x = Recommendation::new().set_xor_group_id("example");
1491    /// ```
1492    pub fn set_xor_group_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1493        self.xor_group_id = v.into();
1494        self
1495    }
1496}
1497
1498impl wkt::message::Message for Recommendation {
1499    fn typename() -> &'static str {
1500        "type.googleapis.com/google.cloud.recommender.v1.Recommendation"
1501    }
1502}
1503
1504/// Defines additional types related to [Recommendation].
1505pub mod recommendation {
1506    #[allow(unused_imports)]
1507    use super::*;
1508
1509    /// Reference to an associated insight.
1510    #[derive(Clone, Default, PartialEq)]
1511    #[non_exhaustive]
1512    pub struct InsightReference {
1513        /// Insight resource name, e.g.
1514        /// projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID]
1515        pub insight: std::string::String,
1516
1517        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1518    }
1519
1520    impl InsightReference {
1521        /// Creates a new default instance.
1522        pub fn new() -> Self {
1523            std::default::Default::default()
1524        }
1525
1526        /// Sets the value of [insight][crate::model::recommendation::InsightReference::insight].
1527        ///
1528        /// # Example
1529        /// ```ignore,no_run
1530        /// # use google_cloud_recommender_v1::model::recommendation::InsightReference;
1531        /// let x = InsightReference::new().set_insight("example");
1532        /// ```
1533        pub fn set_insight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1534            self.insight = v.into();
1535            self
1536        }
1537    }
1538
1539    impl wkt::message::Message for InsightReference {
1540        fn typename() -> &'static str {
1541            "type.googleapis.com/google.cloud.recommender.v1.Recommendation.InsightReference"
1542        }
1543    }
1544
1545    /// Recommendation priority levels.
1546    ///
1547    /// # Working with unknown values
1548    ///
1549    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1550    /// additional enum variants at any time. Adding new variants is not considered
1551    /// a breaking change. Applications should write their code in anticipation of:
1552    ///
1553    /// - New values appearing in future releases of the client library, **and**
1554    /// - New values received dynamically, without application changes.
1555    ///
1556    /// Please consult the [Working with enums] section in the user guide for some
1557    /// guidelines.
1558    ///
1559    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1560    #[derive(Clone, Debug, PartialEq)]
1561    #[non_exhaustive]
1562    pub enum Priority {
1563        /// Recommendation has unspecified priority.
1564        Unspecified,
1565        /// Recommendation has P4 priority (lowest priority).
1566        P4,
1567        /// Recommendation has P3 priority (second lowest priority).
1568        P3,
1569        /// Recommendation has P2 priority (second highest priority).
1570        P2,
1571        /// Recommendation has P1 priority (highest priority).
1572        P1,
1573        /// If set, the enum was initialized with an unknown value.
1574        ///
1575        /// Applications can examine the value using [Priority::value] or
1576        /// [Priority::name].
1577        UnknownValue(priority::UnknownValue),
1578    }
1579
1580    #[doc(hidden)]
1581    pub mod priority {
1582        #[allow(unused_imports)]
1583        use super::*;
1584        #[derive(Clone, Debug, PartialEq)]
1585        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1586    }
1587
1588    impl Priority {
1589        /// Gets the enum value.
1590        ///
1591        /// Returns `None` if the enum contains an unknown value deserialized from
1592        /// the string representation of enums.
1593        pub fn value(&self) -> std::option::Option<i32> {
1594            match self {
1595                Self::Unspecified => std::option::Option::Some(0),
1596                Self::P4 => std::option::Option::Some(1),
1597                Self::P3 => std::option::Option::Some(2),
1598                Self::P2 => std::option::Option::Some(3),
1599                Self::P1 => std::option::Option::Some(4),
1600                Self::UnknownValue(u) => u.0.value(),
1601            }
1602        }
1603
1604        /// Gets the enum value as a string.
1605        ///
1606        /// Returns `None` if the enum contains an unknown value deserialized from
1607        /// the integer representation of enums.
1608        pub fn name(&self) -> std::option::Option<&str> {
1609            match self {
1610                Self::Unspecified => std::option::Option::Some("PRIORITY_UNSPECIFIED"),
1611                Self::P4 => std::option::Option::Some("P4"),
1612                Self::P3 => std::option::Option::Some("P3"),
1613                Self::P2 => std::option::Option::Some("P2"),
1614                Self::P1 => std::option::Option::Some("P1"),
1615                Self::UnknownValue(u) => u.0.name(),
1616            }
1617        }
1618    }
1619
1620    impl std::default::Default for Priority {
1621        fn default() -> Self {
1622            use std::convert::From;
1623            Self::from(0)
1624        }
1625    }
1626
1627    impl std::fmt::Display for Priority {
1628        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
1629            wkt::internal::display_enum(f, self.name(), self.value())
1630        }
1631    }
1632
1633    impl std::convert::From<i32> for Priority {
1634        fn from(value: i32) -> Self {
1635            match value {
1636                0 => Self::Unspecified,
1637                1 => Self::P4,
1638                2 => Self::P3,
1639                3 => Self::P2,
1640                4 => Self::P1,
1641                _ => Self::UnknownValue(priority::UnknownValue(
1642                    wkt::internal::UnknownEnumValue::Integer(value),
1643                )),
1644            }
1645        }
1646    }
1647
1648    impl std::convert::From<&str> for Priority {
1649        fn from(value: &str) -> Self {
1650            use std::string::ToString;
1651            match value {
1652                "PRIORITY_UNSPECIFIED" => Self::Unspecified,
1653                "P4" => Self::P4,
1654                "P3" => Self::P3,
1655                "P2" => Self::P2,
1656                "P1" => Self::P1,
1657                _ => Self::UnknownValue(priority::UnknownValue(
1658                    wkt::internal::UnknownEnumValue::String(value.to_string()),
1659                )),
1660            }
1661        }
1662    }
1663
1664    impl serde::ser::Serialize for Priority {
1665        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1666        where
1667            S: serde::Serializer,
1668        {
1669            match self {
1670                Self::Unspecified => serializer.serialize_i32(0),
1671                Self::P4 => serializer.serialize_i32(1),
1672                Self::P3 => serializer.serialize_i32(2),
1673                Self::P2 => serializer.serialize_i32(3),
1674                Self::P1 => serializer.serialize_i32(4),
1675                Self::UnknownValue(u) => u.0.serialize(serializer),
1676            }
1677        }
1678    }
1679
1680    impl<'de> serde::de::Deserialize<'de> for Priority {
1681        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1682        where
1683            D: serde::Deserializer<'de>,
1684        {
1685            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
1686                ".google.cloud.recommender.v1.Recommendation.Priority",
1687            ))
1688        }
1689    }
1690}
1691
1692/// Contains what resources are changing and how they are changing.
1693#[derive(Clone, Default, PartialEq)]
1694#[non_exhaustive]
1695pub struct RecommendationContent {
1696    /// Operations to one or more Google Cloud resources grouped in such a way
1697    /// that, all operations within one group are expected to be performed
1698    /// atomically and in an order.
1699    pub operation_groups: std::vec::Vec<crate::model::OperationGroup>,
1700
1701    /// Condensed overview information about the recommendation.
1702    pub overview: std::option::Option<wkt::Struct>,
1703
1704    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1705}
1706
1707impl RecommendationContent {
1708    /// Creates a new default instance.
1709    pub fn new() -> Self {
1710        std::default::Default::default()
1711    }
1712
1713    /// Sets the value of [operation_groups][crate::model::RecommendationContent::operation_groups].
1714    ///
1715    /// # Example
1716    /// ```ignore,no_run
1717    /// # use google_cloud_recommender_v1::model::RecommendationContent;
1718    /// use google_cloud_recommender_v1::model::OperationGroup;
1719    /// let x = RecommendationContent::new()
1720    ///     .set_operation_groups([
1721    ///         OperationGroup::default()/* use setters */,
1722    ///         OperationGroup::default()/* use (different) setters */,
1723    ///     ]);
1724    /// ```
1725    pub fn set_operation_groups<T, V>(mut self, v: T) -> Self
1726    where
1727        T: std::iter::IntoIterator<Item = V>,
1728        V: std::convert::Into<crate::model::OperationGroup>,
1729    {
1730        use std::iter::Iterator;
1731        self.operation_groups = v.into_iter().map(|i| i.into()).collect();
1732        self
1733    }
1734
1735    /// Sets the value of [overview][crate::model::RecommendationContent::overview].
1736    ///
1737    /// # Example
1738    /// ```ignore,no_run
1739    /// # use google_cloud_recommender_v1::model::RecommendationContent;
1740    /// use wkt::Struct;
1741    /// let x = RecommendationContent::new().set_overview(Struct::default()/* use setters */);
1742    /// ```
1743    pub fn set_overview<T>(mut self, v: T) -> Self
1744    where
1745        T: std::convert::Into<wkt::Struct>,
1746    {
1747        self.overview = std::option::Option::Some(v.into());
1748        self
1749    }
1750
1751    /// Sets or clears the value of [overview][crate::model::RecommendationContent::overview].
1752    ///
1753    /// # Example
1754    /// ```ignore,no_run
1755    /// # use google_cloud_recommender_v1::model::RecommendationContent;
1756    /// use wkt::Struct;
1757    /// let x = RecommendationContent::new().set_or_clear_overview(Some(Struct::default()/* use setters */));
1758    /// let x = RecommendationContent::new().set_or_clear_overview(None::<Struct>);
1759    /// ```
1760    pub fn set_or_clear_overview<T>(mut self, v: std::option::Option<T>) -> Self
1761    where
1762        T: std::convert::Into<wkt::Struct>,
1763    {
1764        self.overview = v.map(|x| x.into());
1765        self
1766    }
1767}
1768
1769impl wkt::message::Message for RecommendationContent {
1770    fn typename() -> &'static str {
1771        "type.googleapis.com/google.cloud.recommender.v1.RecommendationContent"
1772    }
1773}
1774
1775/// Group of operations that need to be performed atomically.
1776#[derive(Clone, Default, PartialEq)]
1777#[non_exhaustive]
1778pub struct OperationGroup {
1779    /// List of operations across one or more resources that belong to this group.
1780    /// Loosely based on RFC6902 and should be performed in the order they appear.
1781    pub operations: std::vec::Vec<crate::model::Operation>,
1782
1783    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1784}
1785
1786impl OperationGroup {
1787    /// Creates a new default instance.
1788    pub fn new() -> Self {
1789        std::default::Default::default()
1790    }
1791
1792    /// Sets the value of [operations][crate::model::OperationGroup::operations].
1793    ///
1794    /// # Example
1795    /// ```ignore,no_run
1796    /// # use google_cloud_recommender_v1::model::OperationGroup;
1797    /// use google_cloud_recommender_v1::model::Operation;
1798    /// let x = OperationGroup::new()
1799    ///     .set_operations([
1800    ///         Operation::default()/* use setters */,
1801    ///         Operation::default()/* use (different) setters */,
1802    ///     ]);
1803    /// ```
1804    pub fn set_operations<T, V>(mut self, v: T) -> Self
1805    where
1806        T: std::iter::IntoIterator<Item = V>,
1807        V: std::convert::Into<crate::model::Operation>,
1808    {
1809        use std::iter::Iterator;
1810        self.operations = v.into_iter().map(|i| i.into()).collect();
1811        self
1812    }
1813}
1814
1815impl wkt::message::Message for OperationGroup {
1816    fn typename() -> &'static str {
1817        "type.googleapis.com/google.cloud.recommender.v1.OperationGroup"
1818    }
1819}
1820
1821/// Contains an operation for a resource loosely based on the JSON-PATCH format
1822/// with support for:
1823///
1824/// * Custom filters for describing partial array patch.
1825/// * Extended path values for describing nested arrays.
1826/// * Custom fields for describing the resource for which the operation is being
1827///   described.
1828/// * Allows extension to custom operations not natively supported by RFC6902.
1829///   See <https://tools.ietf.org/html/rfc6902> for details on the original RFC.
1830#[derive(Clone, Default, PartialEq)]
1831#[non_exhaustive]
1832pub struct Operation {
1833    /// Type of this operation. Contains one of 'add', 'remove', 'replace', 'move',
1834    /// 'copy', 'test' and custom operations. This field is case-insensitive and
1835    /// always populated.
1836    pub action: std::string::String,
1837
1838    /// Type of GCP resource being modified/tested. This field is always populated.
1839    /// Example: cloudresourcemanager.googleapis.com/Project,
1840    /// compute.googleapis.com/Instance
1841    pub resource_type: std::string::String,
1842
1843    /// Contains the fully qualified resource name. This field is always populated.
1844    /// ex: //cloudresourcemanager.googleapis.com/projects/foo.
1845    pub resource: std::string::String,
1846
1847    /// Path to the target field being operated on. If the operation is at the
1848    /// resource level, then path should be "/". This field is always populated.
1849    pub path: std::string::String,
1850
1851    /// Can be set with action 'copy' to copy resource configuration across
1852    /// different resources of the same type. Example: A resource clone can be
1853    /// done via action = 'copy', path = "/", from = "/",
1854    /// source_resource = \<source\> and resource_name = \<target\>.
1855    /// This field is empty for all other values of `action`.
1856    pub source_resource: std::string::String,
1857
1858    /// Can be set with action 'copy' or 'move' to indicate the source field within
1859    /// resource or source_resource, ignored if provided for other operation types.
1860    pub source_path: std::string::String,
1861
1862    /// Set of filters to apply if `path` refers to array elements or nested array
1863    /// elements in order to narrow down to a single unique element that is being
1864    /// tested/modified.
1865    /// This is intended to be an exact match per filter. To perform advanced
1866    /// matching, use path_value_matchers.
1867    ///
1868    /// * Example:
1869    ///
1870    /// ```norust
1871    /// {
1872    ///   "/versions/*/name" : "it-123"
1873    ///   "/versions/*/targetSize/percent": 20
1874    /// }
1875    /// ```
1876    ///
1877    /// * Example:
1878    ///
1879    /// ```norust
1880    /// {
1881    ///   "/bindings/*/role": "roles/owner"
1882    ///   "/bindings/*/condition" : null
1883    /// }
1884    /// ```
1885    ///
1886    /// * Example:
1887    ///
1888    /// ```norust
1889    /// {
1890    ///   "/bindings/*/role": "roles/owner"
1891    ///   "/bindings/*/members/*" : ["x@example.com", "y@example.com"]
1892    /// }
1893    /// ```
1894    ///
1895    /// When both path_filters and path_value_matchers are set, an implicit AND
1896    /// must be performed.
1897    pub path_filters: std::collections::HashMap<std::string::String, wkt::Value>,
1898
1899    /// Similar to path_filters, this contains set of filters to apply if `path`
1900    /// field refers to array elements. This is meant to support value matching
1901    /// beyond exact match. To perform exact match, use path_filters.
1902    /// When both path_filters and path_value_matchers are set, an implicit AND
1903    /// must be performed.
1904    pub path_value_matchers:
1905        std::collections::HashMap<std::string::String, crate::model::ValueMatcher>,
1906
1907    /// One of the fields in the following block will be set and intend to
1908    /// describe a value for 'path' field.
1909    pub path_value: std::option::Option<crate::model::operation::PathValue>,
1910
1911    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1912}
1913
1914impl Operation {
1915    /// Creates a new default instance.
1916    pub fn new() -> Self {
1917        std::default::Default::default()
1918    }
1919
1920    /// Sets the value of [action][crate::model::Operation::action].
1921    ///
1922    /// # Example
1923    /// ```ignore,no_run
1924    /// # use google_cloud_recommender_v1::model::Operation;
1925    /// let x = Operation::new().set_action("example");
1926    /// ```
1927    pub fn set_action<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1928        self.action = v.into();
1929        self
1930    }
1931
1932    /// Sets the value of [resource_type][crate::model::Operation::resource_type].
1933    ///
1934    /// # Example
1935    /// ```ignore,no_run
1936    /// # use google_cloud_recommender_v1::model::Operation;
1937    /// let x = Operation::new().set_resource_type("example");
1938    /// ```
1939    pub fn set_resource_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1940        self.resource_type = v.into();
1941        self
1942    }
1943
1944    /// Sets the value of [resource][crate::model::Operation::resource].
1945    ///
1946    /// # Example
1947    /// ```ignore,no_run
1948    /// # use google_cloud_recommender_v1::model::Operation;
1949    /// let x = Operation::new().set_resource("example");
1950    /// ```
1951    pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1952        self.resource = v.into();
1953        self
1954    }
1955
1956    /// Sets the value of [path][crate::model::Operation::path].
1957    ///
1958    /// # Example
1959    /// ```ignore,no_run
1960    /// # use google_cloud_recommender_v1::model::Operation;
1961    /// let x = Operation::new().set_path("example");
1962    /// ```
1963    pub fn set_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1964        self.path = v.into();
1965        self
1966    }
1967
1968    /// Sets the value of [source_resource][crate::model::Operation::source_resource].
1969    ///
1970    /// # Example
1971    /// ```ignore,no_run
1972    /// # use google_cloud_recommender_v1::model::Operation;
1973    /// let x = Operation::new().set_source_resource("example");
1974    /// ```
1975    pub fn set_source_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1976        self.source_resource = v.into();
1977        self
1978    }
1979
1980    /// Sets the value of [source_path][crate::model::Operation::source_path].
1981    ///
1982    /// # Example
1983    /// ```ignore,no_run
1984    /// # use google_cloud_recommender_v1::model::Operation;
1985    /// let x = Operation::new().set_source_path("example");
1986    /// ```
1987    pub fn set_source_path<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1988        self.source_path = v.into();
1989        self
1990    }
1991
1992    /// Sets the value of [path_filters][crate::model::Operation::path_filters].
1993    ///
1994    /// # Example
1995    /// ```ignore,no_run
1996    /// # use google_cloud_recommender_v1::model::Operation;
1997    /// use wkt::Value;
1998    /// let x = Operation::new().set_path_filters([
1999    ///     ("key0", Value::default()/* use setters */),
2000    ///     ("key1", Value::default()/* use (different) setters */),
2001    /// ]);
2002    /// ```
2003    pub fn set_path_filters<T, K, V>(mut self, v: T) -> Self
2004    where
2005        T: std::iter::IntoIterator<Item = (K, V)>,
2006        K: std::convert::Into<std::string::String>,
2007        V: std::convert::Into<wkt::Value>,
2008    {
2009        use std::iter::Iterator;
2010        self.path_filters = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2011        self
2012    }
2013
2014    /// Sets the value of [path_value_matchers][crate::model::Operation::path_value_matchers].
2015    ///
2016    /// # Example
2017    /// ```ignore,no_run
2018    /// # use google_cloud_recommender_v1::model::Operation;
2019    /// use google_cloud_recommender_v1::model::ValueMatcher;
2020    /// let x = Operation::new().set_path_value_matchers([
2021    ///     ("key0", ValueMatcher::default()/* use setters */),
2022    ///     ("key1", ValueMatcher::default()/* use (different) setters */),
2023    /// ]);
2024    /// ```
2025    pub fn set_path_value_matchers<T, K, V>(mut self, v: T) -> Self
2026    where
2027        T: std::iter::IntoIterator<Item = (K, V)>,
2028        K: std::convert::Into<std::string::String>,
2029        V: std::convert::Into<crate::model::ValueMatcher>,
2030    {
2031        use std::iter::Iterator;
2032        self.path_value_matchers = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2033        self
2034    }
2035
2036    /// Sets the value of [path_value][crate::model::Operation::path_value].
2037    ///
2038    /// Note that all the setters affecting `path_value` are mutually
2039    /// exclusive.
2040    ///
2041    /// # Example
2042    /// ```ignore,no_run
2043    /// # use google_cloud_recommender_v1::model::Operation;
2044    /// use wkt::Value;
2045    /// let x = Operation::new().set_path_value(Some(
2046    ///     google_cloud_recommender_v1::model::operation::PathValue::Value(Value::default().into())));
2047    /// ```
2048    pub fn set_path_value<
2049        T: std::convert::Into<std::option::Option<crate::model::operation::PathValue>>,
2050    >(
2051        mut self,
2052        v: T,
2053    ) -> Self {
2054        self.path_value = v.into();
2055        self
2056    }
2057
2058    /// The value of [path_value][crate::model::Operation::path_value]
2059    /// if it holds a `Value`, `None` if the field is not set or
2060    /// holds a different branch.
2061    pub fn value(&self) -> std::option::Option<&std::boxed::Box<wkt::Value>> {
2062        #[allow(unreachable_patterns)]
2063        self.path_value.as_ref().and_then(|v| match v {
2064            crate::model::operation::PathValue::Value(v) => std::option::Option::Some(v),
2065            _ => std::option::Option::None,
2066        })
2067    }
2068
2069    /// Sets the value of [path_value][crate::model::Operation::path_value]
2070    /// to hold a `Value`.
2071    ///
2072    /// Note that all the setters affecting `path_value` are
2073    /// mutually exclusive.
2074    ///
2075    /// # Example
2076    /// ```ignore,no_run
2077    /// # use google_cloud_recommender_v1::model::Operation;
2078    /// use wkt::Value;
2079    /// let x = Operation::new().set_value(Value::default()/* use setters */);
2080    /// assert!(x.value().is_some());
2081    /// assert!(x.value_matcher().is_none());
2082    /// ```
2083    pub fn set_value<T: std::convert::Into<std::boxed::Box<wkt::Value>>>(mut self, v: T) -> Self {
2084        self.path_value =
2085            std::option::Option::Some(crate::model::operation::PathValue::Value(v.into()));
2086        self
2087    }
2088
2089    /// The value of [path_value][crate::model::Operation::path_value]
2090    /// if it holds a `ValueMatcher`, `None` if the field is not set or
2091    /// holds a different branch.
2092    pub fn value_matcher(
2093        &self,
2094    ) -> std::option::Option<&std::boxed::Box<crate::model::ValueMatcher>> {
2095        #[allow(unreachable_patterns)]
2096        self.path_value.as_ref().and_then(|v| match v {
2097            crate::model::operation::PathValue::ValueMatcher(v) => std::option::Option::Some(v),
2098            _ => std::option::Option::None,
2099        })
2100    }
2101
2102    /// Sets the value of [path_value][crate::model::Operation::path_value]
2103    /// to hold a `ValueMatcher`.
2104    ///
2105    /// Note that all the setters affecting `path_value` are
2106    /// mutually exclusive.
2107    ///
2108    /// # Example
2109    /// ```ignore,no_run
2110    /// # use google_cloud_recommender_v1::model::Operation;
2111    /// use google_cloud_recommender_v1::model::ValueMatcher;
2112    /// let x = Operation::new().set_value_matcher(ValueMatcher::default()/* use setters */);
2113    /// assert!(x.value_matcher().is_some());
2114    /// assert!(x.value().is_none());
2115    /// ```
2116    pub fn set_value_matcher<T: std::convert::Into<std::boxed::Box<crate::model::ValueMatcher>>>(
2117        mut self,
2118        v: T,
2119    ) -> Self {
2120        self.path_value =
2121            std::option::Option::Some(crate::model::operation::PathValue::ValueMatcher(v.into()));
2122        self
2123    }
2124}
2125
2126impl wkt::message::Message for Operation {
2127    fn typename() -> &'static str {
2128        "type.googleapis.com/google.cloud.recommender.v1.Operation"
2129    }
2130}
2131
2132/// Defines additional types related to [Operation].
2133pub mod operation {
2134    #[allow(unused_imports)]
2135    use super::*;
2136
2137    /// One of the fields in the following block will be set and intend to
2138    /// describe a value for 'path' field.
2139    #[derive(Clone, Debug, PartialEq)]
2140    #[non_exhaustive]
2141    pub enum PathValue {
2142        /// Value for the `path` field. Will be set for actions:'add'/'replace'.
2143        /// Maybe set for action: 'test'. Either this or `value_matcher` will be set
2144        /// for 'test' operation. An exact match must be performed.
2145        Value(std::boxed::Box<wkt::Value>),
2146        /// Can be set for action 'test' for advanced matching for the value of
2147        /// 'path' field. Either this or `value` will be set for 'test' operation.
2148        ValueMatcher(std::boxed::Box<crate::model::ValueMatcher>),
2149    }
2150}
2151
2152/// Contains various matching options for values for a GCP resource field.
2153#[derive(Clone, Default, PartialEq)]
2154#[non_exhaustive]
2155pub struct ValueMatcher {
2156    #[allow(missing_docs)]
2157    pub match_variant: std::option::Option<crate::model::value_matcher::MatchVariant>,
2158
2159    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2160}
2161
2162impl ValueMatcher {
2163    /// Creates a new default instance.
2164    pub fn new() -> Self {
2165        std::default::Default::default()
2166    }
2167
2168    /// Sets the value of [match_variant][crate::model::ValueMatcher::match_variant].
2169    ///
2170    /// Note that all the setters affecting `match_variant` are mutually
2171    /// exclusive.
2172    ///
2173    /// # Example
2174    /// ```ignore,no_run
2175    /// # use google_cloud_recommender_v1::model::ValueMatcher;
2176    /// use google_cloud_recommender_v1::model::value_matcher::MatchVariant;
2177    /// let x = ValueMatcher::new().set_match_variant(Some(MatchVariant::MatchesPattern("example".to_string())));
2178    /// ```
2179    pub fn set_match_variant<
2180        T: std::convert::Into<std::option::Option<crate::model::value_matcher::MatchVariant>>,
2181    >(
2182        mut self,
2183        v: T,
2184    ) -> Self {
2185        self.match_variant = v.into();
2186        self
2187    }
2188
2189    /// The value of [match_variant][crate::model::ValueMatcher::match_variant]
2190    /// if it holds a `MatchesPattern`, `None` if the field is not set or
2191    /// holds a different branch.
2192    pub fn matches_pattern(&self) -> std::option::Option<&std::string::String> {
2193        #[allow(unreachable_patterns)]
2194        self.match_variant.as_ref().and_then(|v| match v {
2195            crate::model::value_matcher::MatchVariant::MatchesPattern(v) => {
2196                std::option::Option::Some(v)
2197            }
2198            _ => std::option::Option::None,
2199        })
2200    }
2201
2202    /// Sets the value of [match_variant][crate::model::ValueMatcher::match_variant]
2203    /// to hold a `MatchesPattern`.
2204    ///
2205    /// Note that all the setters affecting `match_variant` are
2206    /// mutually exclusive.
2207    ///
2208    /// # Example
2209    /// ```ignore,no_run
2210    /// # use google_cloud_recommender_v1::model::ValueMatcher;
2211    /// let x = ValueMatcher::new().set_matches_pattern("example");
2212    /// assert!(x.matches_pattern().is_some());
2213    /// ```
2214    pub fn set_matches_pattern<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2215        self.match_variant = std::option::Option::Some(
2216            crate::model::value_matcher::MatchVariant::MatchesPattern(v.into()),
2217        );
2218        self
2219    }
2220}
2221
2222impl wkt::message::Message for ValueMatcher {
2223    fn typename() -> &'static str {
2224        "type.googleapis.com/google.cloud.recommender.v1.ValueMatcher"
2225    }
2226}
2227
2228/// Defines additional types related to [ValueMatcher].
2229pub mod value_matcher {
2230    #[allow(unused_imports)]
2231    use super::*;
2232
2233    #[allow(missing_docs)]
2234    #[derive(Clone, Debug, PartialEq)]
2235    #[non_exhaustive]
2236    pub enum MatchVariant {
2237        /// To be used for full regex matching. The regular expression is using the
2238        /// Google RE2 syntax (<https://github.com/google/re2/wiki/Syntax>), so to be
2239        /// used with RE2::FullMatch
2240        MatchesPattern(std::string::String),
2241    }
2242}
2243
2244/// Contains metadata about how much money a recommendation can save or incur.
2245#[derive(Clone, Default, PartialEq)]
2246#[non_exhaustive]
2247pub struct CostProjection {
2248    /// An approximate projection on amount saved or amount incurred. Negative cost
2249    /// units indicate cost savings and positive cost units indicate increase.
2250    /// See google.type.Money documentation for positive/negative units.
2251    ///
2252    /// A user's permissions may affect whether the cost is computed using list
2253    /// prices or custom contract prices.
2254    pub cost: std::option::Option<google_cloud_type::model::Money>,
2255
2256    /// Duration for which this cost applies.
2257    pub duration: std::option::Option<wkt::Duration>,
2258
2259    /// The approximate cost savings in the billing account's local currency.
2260    pub cost_in_local_currency: std::option::Option<google_cloud_type::model::Money>,
2261
2262    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2263}
2264
2265impl CostProjection {
2266    /// Creates a new default instance.
2267    pub fn new() -> Self {
2268        std::default::Default::default()
2269    }
2270
2271    /// Sets the value of [cost][crate::model::CostProjection::cost].
2272    ///
2273    /// # Example
2274    /// ```ignore,no_run
2275    /// # use google_cloud_recommender_v1::model::CostProjection;
2276    /// use google_cloud_type::model::Money;
2277    /// let x = CostProjection::new().set_cost(Money::default()/* use setters */);
2278    /// ```
2279    pub fn set_cost<T>(mut self, v: T) -> Self
2280    where
2281        T: std::convert::Into<google_cloud_type::model::Money>,
2282    {
2283        self.cost = std::option::Option::Some(v.into());
2284        self
2285    }
2286
2287    /// Sets or clears the value of [cost][crate::model::CostProjection::cost].
2288    ///
2289    /// # Example
2290    /// ```ignore,no_run
2291    /// # use google_cloud_recommender_v1::model::CostProjection;
2292    /// use google_cloud_type::model::Money;
2293    /// let x = CostProjection::new().set_or_clear_cost(Some(Money::default()/* use setters */));
2294    /// let x = CostProjection::new().set_or_clear_cost(None::<Money>);
2295    /// ```
2296    pub fn set_or_clear_cost<T>(mut self, v: std::option::Option<T>) -> Self
2297    where
2298        T: std::convert::Into<google_cloud_type::model::Money>,
2299    {
2300        self.cost = v.map(|x| x.into());
2301        self
2302    }
2303
2304    /// Sets the value of [duration][crate::model::CostProjection::duration].
2305    ///
2306    /// # Example
2307    /// ```ignore,no_run
2308    /// # use google_cloud_recommender_v1::model::CostProjection;
2309    /// use wkt::Duration;
2310    /// let x = CostProjection::new().set_duration(Duration::default()/* use setters */);
2311    /// ```
2312    pub fn set_duration<T>(mut self, v: T) -> Self
2313    where
2314        T: std::convert::Into<wkt::Duration>,
2315    {
2316        self.duration = std::option::Option::Some(v.into());
2317        self
2318    }
2319
2320    /// Sets or clears the value of [duration][crate::model::CostProjection::duration].
2321    ///
2322    /// # Example
2323    /// ```ignore,no_run
2324    /// # use google_cloud_recommender_v1::model::CostProjection;
2325    /// use wkt::Duration;
2326    /// let x = CostProjection::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
2327    /// let x = CostProjection::new().set_or_clear_duration(None::<Duration>);
2328    /// ```
2329    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
2330    where
2331        T: std::convert::Into<wkt::Duration>,
2332    {
2333        self.duration = v.map(|x| x.into());
2334        self
2335    }
2336
2337    /// Sets the value of [cost_in_local_currency][crate::model::CostProjection::cost_in_local_currency].
2338    ///
2339    /// # Example
2340    /// ```ignore,no_run
2341    /// # use google_cloud_recommender_v1::model::CostProjection;
2342    /// use google_cloud_type::model::Money;
2343    /// let x = CostProjection::new().set_cost_in_local_currency(Money::default()/* use setters */);
2344    /// ```
2345    pub fn set_cost_in_local_currency<T>(mut self, v: T) -> Self
2346    where
2347        T: std::convert::Into<google_cloud_type::model::Money>,
2348    {
2349        self.cost_in_local_currency = std::option::Option::Some(v.into());
2350        self
2351    }
2352
2353    /// Sets or clears the value of [cost_in_local_currency][crate::model::CostProjection::cost_in_local_currency].
2354    ///
2355    /// # Example
2356    /// ```ignore,no_run
2357    /// # use google_cloud_recommender_v1::model::CostProjection;
2358    /// use google_cloud_type::model::Money;
2359    /// let x = CostProjection::new().set_or_clear_cost_in_local_currency(Some(Money::default()/* use setters */));
2360    /// let x = CostProjection::new().set_or_clear_cost_in_local_currency(None::<Money>);
2361    /// ```
2362    pub fn set_or_clear_cost_in_local_currency<T>(mut self, v: std::option::Option<T>) -> Self
2363    where
2364        T: std::convert::Into<google_cloud_type::model::Money>,
2365    {
2366        self.cost_in_local_currency = v.map(|x| x.into());
2367        self
2368    }
2369}
2370
2371impl wkt::message::Message for CostProjection {
2372    fn typename() -> &'static str {
2373        "type.googleapis.com/google.cloud.recommender.v1.CostProjection"
2374    }
2375}
2376
2377/// Contains various ways of describing the impact on Security.
2378#[derive(Clone, Default, PartialEq)]
2379#[non_exhaustive]
2380pub struct SecurityProjection {
2381    /// Additional security impact details that is provided by the recommender.
2382    pub details: std::option::Option<wkt::Struct>,
2383
2384    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2385}
2386
2387impl SecurityProjection {
2388    /// Creates a new default instance.
2389    pub fn new() -> Self {
2390        std::default::Default::default()
2391    }
2392
2393    /// Sets the value of [details][crate::model::SecurityProjection::details].
2394    ///
2395    /// # Example
2396    /// ```ignore,no_run
2397    /// # use google_cloud_recommender_v1::model::SecurityProjection;
2398    /// use wkt::Struct;
2399    /// let x = SecurityProjection::new().set_details(Struct::default()/* use setters */);
2400    /// ```
2401    pub fn set_details<T>(mut self, v: T) -> Self
2402    where
2403        T: std::convert::Into<wkt::Struct>,
2404    {
2405        self.details = std::option::Option::Some(v.into());
2406        self
2407    }
2408
2409    /// Sets or clears the value of [details][crate::model::SecurityProjection::details].
2410    ///
2411    /// # Example
2412    /// ```ignore,no_run
2413    /// # use google_cloud_recommender_v1::model::SecurityProjection;
2414    /// use wkt::Struct;
2415    /// let x = SecurityProjection::new().set_or_clear_details(Some(Struct::default()/* use setters */));
2416    /// let x = SecurityProjection::new().set_or_clear_details(None::<Struct>);
2417    /// ```
2418    pub fn set_or_clear_details<T>(mut self, v: std::option::Option<T>) -> Self
2419    where
2420        T: std::convert::Into<wkt::Struct>,
2421    {
2422        self.details = v.map(|x| x.into());
2423        self
2424    }
2425}
2426
2427impl wkt::message::Message for SecurityProjection {
2428    fn typename() -> &'static str {
2429        "type.googleapis.com/google.cloud.recommender.v1.SecurityProjection"
2430    }
2431}
2432
2433/// Contains metadata about how much sustainability a recommendation can save or
2434/// incur.
2435#[derive(Clone, Default, PartialEq)]
2436#[non_exhaustive]
2437pub struct SustainabilityProjection {
2438    /// Carbon Footprint generated in kg of CO2 equivalent.
2439    /// Chose kg_c_o2e so that the name renders correctly in camelCase (kgCO2e).
2440    pub kg_c_o2e: f64,
2441
2442    /// Duration for which this sustainability applies.
2443    pub duration: std::option::Option<wkt::Duration>,
2444
2445    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2446}
2447
2448impl SustainabilityProjection {
2449    /// Creates a new default instance.
2450    pub fn new() -> Self {
2451        std::default::Default::default()
2452    }
2453
2454    /// Sets the value of [kg_c_o2e][crate::model::SustainabilityProjection::kg_c_o2e].
2455    ///
2456    /// # Example
2457    /// ```ignore,no_run
2458    /// # use google_cloud_recommender_v1::model::SustainabilityProjection;
2459    /// let x = SustainabilityProjection::new().set_kg_c_o2e(42.0);
2460    /// ```
2461    pub fn set_kg_c_o2e<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2462        self.kg_c_o2e = v.into();
2463        self
2464    }
2465
2466    /// Sets the value of [duration][crate::model::SustainabilityProjection::duration].
2467    ///
2468    /// # Example
2469    /// ```ignore,no_run
2470    /// # use google_cloud_recommender_v1::model::SustainabilityProjection;
2471    /// use wkt::Duration;
2472    /// let x = SustainabilityProjection::new().set_duration(Duration::default()/* use setters */);
2473    /// ```
2474    pub fn set_duration<T>(mut self, v: T) -> Self
2475    where
2476        T: std::convert::Into<wkt::Duration>,
2477    {
2478        self.duration = std::option::Option::Some(v.into());
2479        self
2480    }
2481
2482    /// Sets or clears the value of [duration][crate::model::SustainabilityProjection::duration].
2483    ///
2484    /// # Example
2485    /// ```ignore,no_run
2486    /// # use google_cloud_recommender_v1::model::SustainabilityProjection;
2487    /// use wkt::Duration;
2488    /// let x = SustainabilityProjection::new().set_or_clear_duration(Some(Duration::default()/* use setters */));
2489    /// let x = SustainabilityProjection::new().set_or_clear_duration(None::<Duration>);
2490    /// ```
2491    pub fn set_or_clear_duration<T>(mut self, v: std::option::Option<T>) -> Self
2492    where
2493        T: std::convert::Into<wkt::Duration>,
2494    {
2495        self.duration = v.map(|x| x.into());
2496        self
2497    }
2498}
2499
2500impl wkt::message::Message for SustainabilityProjection {
2501    fn typename() -> &'static str {
2502        "type.googleapis.com/google.cloud.recommender.v1.SustainabilityProjection"
2503    }
2504}
2505
2506/// Contains information on the impact of a reliability recommendation.
2507#[derive(Clone, Default, PartialEq)]
2508#[non_exhaustive]
2509pub struct ReliabilityProjection {
2510    /// Reliability risks mitigated by this recommendation.
2511    pub risks: std::vec::Vec<crate::model::reliability_projection::RiskType>,
2512
2513    /// Per-recommender projection.
2514    pub details: std::option::Option<wkt::Struct>,
2515
2516    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2517}
2518
2519impl ReliabilityProjection {
2520    /// Creates a new default instance.
2521    pub fn new() -> Self {
2522        std::default::Default::default()
2523    }
2524
2525    /// Sets the value of [risks][crate::model::ReliabilityProjection::risks].
2526    ///
2527    /// # Example
2528    /// ```ignore,no_run
2529    /// # use google_cloud_recommender_v1::model::ReliabilityProjection;
2530    /// use google_cloud_recommender_v1::model::reliability_projection::RiskType;
2531    /// let x = ReliabilityProjection::new().set_risks([
2532    ///     RiskType::ServiceDisruption,
2533    ///     RiskType::DataLoss,
2534    ///     RiskType::AccessDeny,
2535    /// ]);
2536    /// ```
2537    pub fn set_risks<T, V>(mut self, v: T) -> Self
2538    where
2539        T: std::iter::IntoIterator<Item = V>,
2540        V: std::convert::Into<crate::model::reliability_projection::RiskType>,
2541    {
2542        use std::iter::Iterator;
2543        self.risks = v.into_iter().map(|i| i.into()).collect();
2544        self
2545    }
2546
2547    /// Sets the value of [details][crate::model::ReliabilityProjection::details].
2548    ///
2549    /// # Example
2550    /// ```ignore,no_run
2551    /// # use google_cloud_recommender_v1::model::ReliabilityProjection;
2552    /// use wkt::Struct;
2553    /// let x = ReliabilityProjection::new().set_details(Struct::default()/* use setters */);
2554    /// ```
2555    pub fn set_details<T>(mut self, v: T) -> Self
2556    where
2557        T: std::convert::Into<wkt::Struct>,
2558    {
2559        self.details = std::option::Option::Some(v.into());
2560        self
2561    }
2562
2563    /// Sets or clears the value of [details][crate::model::ReliabilityProjection::details].
2564    ///
2565    /// # Example
2566    /// ```ignore,no_run
2567    /// # use google_cloud_recommender_v1::model::ReliabilityProjection;
2568    /// use wkt::Struct;
2569    /// let x = ReliabilityProjection::new().set_or_clear_details(Some(Struct::default()/* use setters */));
2570    /// let x = ReliabilityProjection::new().set_or_clear_details(None::<Struct>);
2571    /// ```
2572    pub fn set_or_clear_details<T>(mut self, v: std::option::Option<T>) -> Self
2573    where
2574        T: std::convert::Into<wkt::Struct>,
2575    {
2576        self.details = v.map(|x| x.into());
2577        self
2578    }
2579}
2580
2581impl wkt::message::Message for ReliabilityProjection {
2582    fn typename() -> &'static str {
2583        "type.googleapis.com/google.cloud.recommender.v1.ReliabilityProjection"
2584    }
2585}
2586
2587/// Defines additional types related to [ReliabilityProjection].
2588pub mod reliability_projection {
2589    #[allow(unused_imports)]
2590    use super::*;
2591
2592    /// The risk associated with the reliability issue.
2593    ///
2594    /// # Working with unknown values
2595    ///
2596    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2597    /// additional enum variants at any time. Adding new variants is not considered
2598    /// a breaking change. Applications should write their code in anticipation of:
2599    ///
2600    /// - New values appearing in future releases of the client library, **and**
2601    /// - New values received dynamically, without application changes.
2602    ///
2603    /// Please consult the [Working with enums] section in the user guide for some
2604    /// guidelines.
2605    ///
2606    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2607    #[derive(Clone, Debug, PartialEq)]
2608    #[non_exhaustive]
2609    pub enum RiskType {
2610        /// Default unspecified risk. Don't use directly.
2611        Unspecified,
2612        /// Potential service downtime.
2613        ServiceDisruption,
2614        /// Potential data loss.
2615        DataLoss,
2616        /// Potential access denial. The service is still up but some or all clients
2617        /// can't access it.
2618        AccessDeny,
2619        /// If set, the enum was initialized with an unknown value.
2620        ///
2621        /// Applications can examine the value using [RiskType::value] or
2622        /// [RiskType::name].
2623        UnknownValue(risk_type::UnknownValue),
2624    }
2625
2626    #[doc(hidden)]
2627    pub mod risk_type {
2628        #[allow(unused_imports)]
2629        use super::*;
2630        #[derive(Clone, Debug, PartialEq)]
2631        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2632    }
2633
2634    impl RiskType {
2635        /// Gets the enum value.
2636        ///
2637        /// Returns `None` if the enum contains an unknown value deserialized from
2638        /// the string representation of enums.
2639        pub fn value(&self) -> std::option::Option<i32> {
2640            match self {
2641                Self::Unspecified => std::option::Option::Some(0),
2642                Self::ServiceDisruption => std::option::Option::Some(1),
2643                Self::DataLoss => std::option::Option::Some(2),
2644                Self::AccessDeny => std::option::Option::Some(3),
2645                Self::UnknownValue(u) => u.0.value(),
2646            }
2647        }
2648
2649        /// Gets the enum value as a string.
2650        ///
2651        /// Returns `None` if the enum contains an unknown value deserialized from
2652        /// the integer representation of enums.
2653        pub fn name(&self) -> std::option::Option<&str> {
2654            match self {
2655                Self::Unspecified => std::option::Option::Some("RISK_TYPE_UNSPECIFIED"),
2656                Self::ServiceDisruption => std::option::Option::Some("SERVICE_DISRUPTION"),
2657                Self::DataLoss => std::option::Option::Some("DATA_LOSS"),
2658                Self::AccessDeny => std::option::Option::Some("ACCESS_DENY"),
2659                Self::UnknownValue(u) => u.0.name(),
2660            }
2661        }
2662    }
2663
2664    impl std::default::Default for RiskType {
2665        fn default() -> Self {
2666            use std::convert::From;
2667            Self::from(0)
2668        }
2669    }
2670
2671    impl std::fmt::Display for RiskType {
2672        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
2673            wkt::internal::display_enum(f, self.name(), self.value())
2674        }
2675    }
2676
2677    impl std::convert::From<i32> for RiskType {
2678        fn from(value: i32) -> Self {
2679            match value {
2680                0 => Self::Unspecified,
2681                1 => Self::ServiceDisruption,
2682                2 => Self::DataLoss,
2683                3 => Self::AccessDeny,
2684                _ => Self::UnknownValue(risk_type::UnknownValue(
2685                    wkt::internal::UnknownEnumValue::Integer(value),
2686                )),
2687            }
2688        }
2689    }
2690
2691    impl std::convert::From<&str> for RiskType {
2692        fn from(value: &str) -> Self {
2693            use std::string::ToString;
2694            match value {
2695                "RISK_TYPE_UNSPECIFIED" => Self::Unspecified,
2696                "SERVICE_DISRUPTION" => Self::ServiceDisruption,
2697                "DATA_LOSS" => Self::DataLoss,
2698                "ACCESS_DENY" => Self::AccessDeny,
2699                _ => Self::UnknownValue(risk_type::UnknownValue(
2700                    wkt::internal::UnknownEnumValue::String(value.to_string()),
2701                )),
2702            }
2703        }
2704    }
2705
2706    impl serde::ser::Serialize for RiskType {
2707        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2708        where
2709            S: serde::Serializer,
2710        {
2711            match self {
2712                Self::Unspecified => serializer.serialize_i32(0),
2713                Self::ServiceDisruption => serializer.serialize_i32(1),
2714                Self::DataLoss => serializer.serialize_i32(2),
2715                Self::AccessDeny => serializer.serialize_i32(3),
2716                Self::UnknownValue(u) => u.0.serialize(serializer),
2717            }
2718        }
2719    }
2720
2721    impl<'de> serde::de::Deserialize<'de> for RiskType {
2722        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2723        where
2724            D: serde::Deserializer<'de>,
2725        {
2726            deserializer.deserialize_any(wkt::internal::EnumVisitor::<RiskType>::new(
2727                ".google.cloud.recommender.v1.ReliabilityProjection.RiskType",
2728            ))
2729        }
2730    }
2731}
2732
2733/// Contains the impact a recommendation can have for a given category.
2734#[derive(Clone, Default, PartialEq)]
2735#[non_exhaustive]
2736pub struct Impact {
2737    /// Category that is being targeted.
2738    pub category: crate::model::impact::Category,
2739
2740    /// Contains projections (if any) for this category.
2741    pub projection: std::option::Option<crate::model::impact::Projection>,
2742
2743    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2744}
2745
2746impl Impact {
2747    /// Creates a new default instance.
2748    pub fn new() -> Self {
2749        std::default::Default::default()
2750    }
2751
2752    /// Sets the value of [category][crate::model::Impact::category].
2753    ///
2754    /// # Example
2755    /// ```ignore,no_run
2756    /// # use google_cloud_recommender_v1::model::Impact;
2757    /// use google_cloud_recommender_v1::model::impact::Category;
2758    /// let x0 = Impact::new().set_category(Category::Cost);
2759    /// let x1 = Impact::new().set_category(Category::Security);
2760    /// let x2 = Impact::new().set_category(Category::Performance);
2761    /// ```
2762    pub fn set_category<T: std::convert::Into<crate::model::impact::Category>>(
2763        mut self,
2764        v: T,
2765    ) -> Self {
2766        self.category = v.into();
2767        self
2768    }
2769
2770    /// Sets the value of [projection][crate::model::Impact::projection].
2771    ///
2772    /// Note that all the setters affecting `projection` are mutually
2773    /// exclusive.
2774    ///
2775    /// # Example
2776    /// ```ignore,no_run
2777    /// # use google_cloud_recommender_v1::model::Impact;
2778    /// use google_cloud_recommender_v1::model::CostProjection;
2779    /// let x = Impact::new().set_projection(Some(
2780    ///     google_cloud_recommender_v1::model::impact::Projection::CostProjection(CostProjection::default().into())));
2781    /// ```
2782    pub fn set_projection<
2783        T: std::convert::Into<std::option::Option<crate::model::impact::Projection>>,
2784    >(
2785        mut self,
2786        v: T,
2787    ) -> Self {
2788        self.projection = v.into();
2789        self
2790    }
2791
2792    /// The value of [projection][crate::model::Impact::projection]
2793    /// if it holds a `CostProjection`, `None` if the field is not set or
2794    /// holds a different branch.
2795    pub fn cost_projection(
2796        &self,
2797    ) -> std::option::Option<&std::boxed::Box<crate::model::CostProjection>> {
2798        #[allow(unreachable_patterns)]
2799        self.projection.as_ref().and_then(|v| match v {
2800            crate::model::impact::Projection::CostProjection(v) => std::option::Option::Some(v),
2801            _ => std::option::Option::None,
2802        })
2803    }
2804
2805    /// Sets the value of [projection][crate::model::Impact::projection]
2806    /// to hold a `CostProjection`.
2807    ///
2808    /// Note that all the setters affecting `projection` are
2809    /// mutually exclusive.
2810    ///
2811    /// # Example
2812    /// ```ignore,no_run
2813    /// # use google_cloud_recommender_v1::model::Impact;
2814    /// use google_cloud_recommender_v1::model::CostProjection;
2815    /// let x = Impact::new().set_cost_projection(CostProjection::default()/* use setters */);
2816    /// assert!(x.cost_projection().is_some());
2817    /// assert!(x.security_projection().is_none());
2818    /// assert!(x.sustainability_projection().is_none());
2819    /// assert!(x.reliability_projection().is_none());
2820    /// ```
2821    pub fn set_cost_projection<
2822        T: std::convert::Into<std::boxed::Box<crate::model::CostProjection>>,
2823    >(
2824        mut self,
2825        v: T,
2826    ) -> Self {
2827        self.projection =
2828            std::option::Option::Some(crate::model::impact::Projection::CostProjection(v.into()));
2829        self
2830    }
2831
2832    /// The value of [projection][crate::model::Impact::projection]
2833    /// if it holds a `SecurityProjection`, `None` if the field is not set or
2834    /// holds a different branch.
2835    pub fn security_projection(
2836        &self,
2837    ) -> std::option::Option<&std::boxed::Box<crate::model::SecurityProjection>> {
2838        #[allow(unreachable_patterns)]
2839        self.projection.as_ref().and_then(|v| match v {
2840            crate::model::impact::Projection::SecurityProjection(v) => std::option::Option::Some(v),
2841            _ => std::option::Option::None,
2842        })
2843    }
2844
2845    /// Sets the value of [projection][crate::model::Impact::projection]
2846    /// to hold a `SecurityProjection`.
2847    ///
2848    /// Note that all the setters affecting `projection` are
2849    /// mutually exclusive.
2850    ///
2851    /// # Example
2852    /// ```ignore,no_run
2853    /// # use google_cloud_recommender_v1::model::Impact;
2854    /// use google_cloud_recommender_v1::model::SecurityProjection;
2855    /// let x = Impact::new().set_security_projection(SecurityProjection::default()/* use setters */);
2856    /// assert!(x.security_projection().is_some());
2857    /// assert!(x.cost_projection().is_none());
2858    /// assert!(x.sustainability_projection().is_none());
2859    /// assert!(x.reliability_projection().is_none());
2860    /// ```
2861    pub fn set_security_projection<
2862        T: std::convert::Into<std::boxed::Box<crate::model::SecurityProjection>>,
2863    >(
2864        mut self,
2865        v: T,
2866    ) -> Self {
2867        self.projection = std::option::Option::Some(
2868            crate::model::impact::Projection::SecurityProjection(v.into()),
2869        );
2870        self
2871    }
2872
2873    /// The value of [projection][crate::model::Impact::projection]
2874    /// if it holds a `SustainabilityProjection`, `None` if the field is not set or
2875    /// holds a different branch.
2876    pub fn sustainability_projection(
2877        &self,
2878    ) -> std::option::Option<&std::boxed::Box<crate::model::SustainabilityProjection>> {
2879        #[allow(unreachable_patterns)]
2880        self.projection.as_ref().and_then(|v| match v {
2881            crate::model::impact::Projection::SustainabilityProjection(v) => {
2882                std::option::Option::Some(v)
2883            }
2884            _ => std::option::Option::None,
2885        })
2886    }
2887
2888    /// Sets the value of [projection][crate::model::Impact::projection]
2889    /// to hold a `SustainabilityProjection`.
2890    ///
2891    /// Note that all the setters affecting `projection` are
2892    /// mutually exclusive.
2893    ///
2894    /// # Example
2895    /// ```ignore,no_run
2896    /// # use google_cloud_recommender_v1::model::Impact;
2897    /// use google_cloud_recommender_v1::model::SustainabilityProjection;
2898    /// let x = Impact::new().set_sustainability_projection(SustainabilityProjection::default()/* use setters */);
2899    /// assert!(x.sustainability_projection().is_some());
2900    /// assert!(x.cost_projection().is_none());
2901    /// assert!(x.security_projection().is_none());
2902    /// assert!(x.reliability_projection().is_none());
2903    /// ```
2904    pub fn set_sustainability_projection<
2905        T: std::convert::Into<std::boxed::Box<crate::model::SustainabilityProjection>>,
2906    >(
2907        mut self,
2908        v: T,
2909    ) -> Self {
2910        self.projection = std::option::Option::Some(
2911            crate::model::impact::Projection::SustainabilityProjection(v.into()),
2912        );
2913        self
2914    }
2915
2916    /// The value of [projection][crate::model::Impact::projection]
2917    /// if it holds a `ReliabilityProjection`, `None` if the field is not set or
2918    /// holds a different branch.
2919    pub fn reliability_projection(
2920        &self,
2921    ) -> std::option::Option<&std::boxed::Box<crate::model::ReliabilityProjection>> {
2922        #[allow(unreachable_patterns)]
2923        self.projection.as_ref().and_then(|v| match v {
2924            crate::model::impact::Projection::ReliabilityProjection(v) => {
2925                std::option::Option::Some(v)
2926            }
2927            _ => std::option::Option::None,
2928        })
2929    }
2930
2931    /// Sets the value of [projection][crate::model::Impact::projection]
2932    /// to hold a `ReliabilityProjection`.
2933    ///
2934    /// Note that all the setters affecting `projection` are
2935    /// mutually exclusive.
2936    ///
2937    /// # Example
2938    /// ```ignore,no_run
2939    /// # use google_cloud_recommender_v1::model::Impact;
2940    /// use google_cloud_recommender_v1::model::ReliabilityProjection;
2941    /// let x = Impact::new().set_reliability_projection(ReliabilityProjection::default()/* use setters */);
2942    /// assert!(x.reliability_projection().is_some());
2943    /// assert!(x.cost_projection().is_none());
2944    /// assert!(x.security_projection().is_none());
2945    /// assert!(x.sustainability_projection().is_none());
2946    /// ```
2947    pub fn set_reliability_projection<
2948        T: std::convert::Into<std::boxed::Box<crate::model::ReliabilityProjection>>,
2949    >(
2950        mut self,
2951        v: T,
2952    ) -> Self {
2953        self.projection = std::option::Option::Some(
2954            crate::model::impact::Projection::ReliabilityProjection(v.into()),
2955        );
2956        self
2957    }
2958}
2959
2960impl wkt::message::Message for Impact {
2961    fn typename() -> &'static str {
2962        "type.googleapis.com/google.cloud.recommender.v1.Impact"
2963    }
2964}
2965
2966/// Defines additional types related to [Impact].
2967pub mod impact {
2968    #[allow(unused_imports)]
2969    use super::*;
2970
2971    /// The category of the impact.
2972    ///
2973    /// # Working with unknown values
2974    ///
2975    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2976    /// additional enum variants at any time. Adding new variants is not considered
2977    /// a breaking change. Applications should write their code in anticipation of:
2978    ///
2979    /// - New values appearing in future releases of the client library, **and**
2980    /// - New values received dynamically, without application changes.
2981    ///
2982    /// Please consult the [Working with enums] section in the user guide for some
2983    /// guidelines.
2984    ///
2985    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2986    #[derive(Clone, Debug, PartialEq)]
2987    #[non_exhaustive]
2988    pub enum Category {
2989        /// Default unspecified category. Don't use directly.
2990        Unspecified,
2991        /// Indicates a potential increase or decrease in cost.
2992        Cost,
2993        /// Indicates a potential increase or decrease in security.
2994        Security,
2995        /// Indicates a potential increase or decrease in performance.
2996        Performance,
2997        /// Indicates a potential increase or decrease in manageability.
2998        Manageability,
2999        /// Indicates a potential increase or decrease in sustainability.
3000        Sustainability,
3001        /// Indicates a potential increase or decrease in reliability.
3002        Reliability,
3003        /// If set, the enum was initialized with an unknown value.
3004        ///
3005        /// Applications can examine the value using [Category::value] or
3006        /// [Category::name].
3007        UnknownValue(category::UnknownValue),
3008    }
3009
3010    #[doc(hidden)]
3011    pub mod category {
3012        #[allow(unused_imports)]
3013        use super::*;
3014        #[derive(Clone, Debug, PartialEq)]
3015        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3016    }
3017
3018    impl Category {
3019        /// Gets the enum value.
3020        ///
3021        /// Returns `None` if the enum contains an unknown value deserialized from
3022        /// the string representation of enums.
3023        pub fn value(&self) -> std::option::Option<i32> {
3024            match self {
3025                Self::Unspecified => std::option::Option::Some(0),
3026                Self::Cost => std::option::Option::Some(1),
3027                Self::Security => std::option::Option::Some(2),
3028                Self::Performance => std::option::Option::Some(3),
3029                Self::Manageability => std::option::Option::Some(4),
3030                Self::Sustainability => std::option::Option::Some(5),
3031                Self::Reliability => std::option::Option::Some(6),
3032                Self::UnknownValue(u) => u.0.value(),
3033            }
3034        }
3035
3036        /// Gets the enum value as a string.
3037        ///
3038        /// Returns `None` if the enum contains an unknown value deserialized from
3039        /// the integer representation of enums.
3040        pub fn name(&self) -> std::option::Option<&str> {
3041            match self {
3042                Self::Unspecified => std::option::Option::Some("CATEGORY_UNSPECIFIED"),
3043                Self::Cost => std::option::Option::Some("COST"),
3044                Self::Security => std::option::Option::Some("SECURITY"),
3045                Self::Performance => std::option::Option::Some("PERFORMANCE"),
3046                Self::Manageability => std::option::Option::Some("MANAGEABILITY"),
3047                Self::Sustainability => std::option::Option::Some("SUSTAINABILITY"),
3048                Self::Reliability => std::option::Option::Some("RELIABILITY"),
3049                Self::UnknownValue(u) => u.0.name(),
3050            }
3051        }
3052    }
3053
3054    impl std::default::Default for Category {
3055        fn default() -> Self {
3056            use std::convert::From;
3057            Self::from(0)
3058        }
3059    }
3060
3061    impl std::fmt::Display for Category {
3062        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3063            wkt::internal::display_enum(f, self.name(), self.value())
3064        }
3065    }
3066
3067    impl std::convert::From<i32> for Category {
3068        fn from(value: i32) -> Self {
3069            match value {
3070                0 => Self::Unspecified,
3071                1 => Self::Cost,
3072                2 => Self::Security,
3073                3 => Self::Performance,
3074                4 => Self::Manageability,
3075                5 => Self::Sustainability,
3076                6 => Self::Reliability,
3077                _ => Self::UnknownValue(category::UnknownValue(
3078                    wkt::internal::UnknownEnumValue::Integer(value),
3079                )),
3080            }
3081        }
3082    }
3083
3084    impl std::convert::From<&str> for Category {
3085        fn from(value: &str) -> Self {
3086            use std::string::ToString;
3087            match value {
3088                "CATEGORY_UNSPECIFIED" => Self::Unspecified,
3089                "COST" => Self::Cost,
3090                "SECURITY" => Self::Security,
3091                "PERFORMANCE" => Self::Performance,
3092                "MANAGEABILITY" => Self::Manageability,
3093                "SUSTAINABILITY" => Self::Sustainability,
3094                "RELIABILITY" => Self::Reliability,
3095                _ => Self::UnknownValue(category::UnknownValue(
3096                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3097                )),
3098            }
3099        }
3100    }
3101
3102    impl serde::ser::Serialize for Category {
3103        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3104        where
3105            S: serde::Serializer,
3106        {
3107            match self {
3108                Self::Unspecified => serializer.serialize_i32(0),
3109                Self::Cost => serializer.serialize_i32(1),
3110                Self::Security => serializer.serialize_i32(2),
3111                Self::Performance => serializer.serialize_i32(3),
3112                Self::Manageability => serializer.serialize_i32(4),
3113                Self::Sustainability => serializer.serialize_i32(5),
3114                Self::Reliability => serializer.serialize_i32(6),
3115                Self::UnknownValue(u) => u.0.serialize(serializer),
3116            }
3117        }
3118    }
3119
3120    impl<'de> serde::de::Deserialize<'de> for Category {
3121        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3122        where
3123            D: serde::Deserializer<'de>,
3124        {
3125            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Category>::new(
3126                ".google.cloud.recommender.v1.Impact.Category",
3127            ))
3128        }
3129    }
3130
3131    /// Contains projections (if any) for this category.
3132    #[derive(Clone, Debug, PartialEq)]
3133    #[non_exhaustive]
3134    pub enum Projection {
3135        /// Use with CategoryType.COST
3136        CostProjection(std::boxed::Box<crate::model::CostProjection>),
3137        /// Use with CategoryType.SECURITY
3138        SecurityProjection(std::boxed::Box<crate::model::SecurityProjection>),
3139        /// Use with CategoryType.SUSTAINABILITY
3140        SustainabilityProjection(std::boxed::Box<crate::model::SustainabilityProjection>),
3141        /// Use with CategoryType.RELIABILITY
3142        ReliabilityProjection(std::boxed::Box<crate::model::ReliabilityProjection>),
3143    }
3144}
3145
3146/// Information for state. Contains state and metadata.
3147#[derive(Clone, Default, PartialEq)]
3148#[non_exhaustive]
3149pub struct RecommendationStateInfo {
3150    /// The state of the recommendation, Eg ACTIVE, SUCCEEDED, FAILED.
3151    pub state: crate::model::recommendation_state_info::State,
3152
3153    /// A map of metadata for the state, provided by user or automations systems.
3154    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,
3155
3156    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3157}
3158
3159impl RecommendationStateInfo {
3160    /// Creates a new default instance.
3161    pub fn new() -> Self {
3162        std::default::Default::default()
3163    }
3164
3165    /// Sets the value of [state][crate::model::RecommendationStateInfo::state].
3166    ///
3167    /// # Example
3168    /// ```ignore,no_run
3169    /// # use google_cloud_recommender_v1::model::RecommendationStateInfo;
3170    /// use google_cloud_recommender_v1::model::recommendation_state_info::State;
3171    /// let x0 = RecommendationStateInfo::new().set_state(State::Active);
3172    /// let x1 = RecommendationStateInfo::new().set_state(State::Claimed);
3173    /// let x2 = RecommendationStateInfo::new().set_state(State::Succeeded);
3174    /// ```
3175    pub fn set_state<T: std::convert::Into<crate::model::recommendation_state_info::State>>(
3176        mut self,
3177        v: T,
3178    ) -> Self {
3179        self.state = v.into();
3180        self
3181    }
3182
3183    /// Sets the value of [state_metadata][crate::model::RecommendationStateInfo::state_metadata].
3184    ///
3185    /// # Example
3186    /// ```ignore,no_run
3187    /// # use google_cloud_recommender_v1::model::RecommendationStateInfo;
3188    /// let x = RecommendationStateInfo::new().set_state_metadata([
3189    ///     ("key0", "abc"),
3190    ///     ("key1", "xyz"),
3191    /// ]);
3192    /// ```
3193    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
3194    where
3195        T: std::iter::IntoIterator<Item = (K, V)>,
3196        K: std::convert::Into<std::string::String>,
3197        V: std::convert::Into<std::string::String>,
3198    {
3199        use std::iter::Iterator;
3200        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3201        self
3202    }
3203}
3204
3205impl wkt::message::Message for RecommendationStateInfo {
3206    fn typename() -> &'static str {
3207        "type.googleapis.com/google.cloud.recommender.v1.RecommendationStateInfo"
3208    }
3209}
3210
3211/// Defines additional types related to [RecommendationStateInfo].
3212pub mod recommendation_state_info {
3213    #[allow(unused_imports)]
3214    use super::*;
3215
3216    /// Represents Recommendation State.
3217    ///
3218    /// # Working with unknown values
3219    ///
3220    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3221    /// additional enum variants at any time. Adding new variants is not considered
3222    /// a breaking change. Applications should write their code in anticipation of:
3223    ///
3224    /// - New values appearing in future releases of the client library, **and**
3225    /// - New values received dynamically, without application changes.
3226    ///
3227    /// Please consult the [Working with enums] section in the user guide for some
3228    /// guidelines.
3229    ///
3230    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
3231    #[derive(Clone, Debug, PartialEq)]
3232    #[non_exhaustive]
3233    pub enum State {
3234        /// Default state. Don't use directly.
3235        Unspecified,
3236        /// Recommendation is active and can be applied. Recommendations content can
3237        /// be updated by Google.
3238        ///
3239        /// ACTIVE recommendations can be marked as CLAIMED, SUCCEEDED, or FAILED.
3240        Active,
3241        /// Recommendation is in claimed state. Recommendations content is
3242        /// immutable and cannot be updated by Google.
3243        ///
3244        /// CLAIMED recommendations can be marked as CLAIMED, SUCCEEDED, or FAILED.
3245        Claimed,
3246        /// Recommendation is in succeeded state. Recommendations content is
3247        /// immutable and cannot be updated by Google.
3248        ///
3249        /// SUCCEEDED recommendations can be marked as SUCCEEDED, or FAILED.
3250        Succeeded,
3251        /// Recommendation is in failed state. Recommendations content is immutable
3252        /// and cannot be updated by Google.
3253        ///
3254        /// FAILED recommendations can be marked as SUCCEEDED, or FAILED.
3255        Failed,
3256        /// Recommendation is in dismissed state. Recommendation content can be
3257        /// updated by Google.
3258        ///
3259        /// DISMISSED recommendations can be marked as ACTIVE.
3260        Dismissed,
3261        /// If set, the enum was initialized with an unknown value.
3262        ///
3263        /// Applications can examine the value using [State::value] or
3264        /// [State::name].
3265        UnknownValue(state::UnknownValue),
3266    }
3267
3268    #[doc(hidden)]
3269    pub mod state {
3270        #[allow(unused_imports)]
3271        use super::*;
3272        #[derive(Clone, Debug, PartialEq)]
3273        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3274    }
3275
3276    impl State {
3277        /// Gets the enum value.
3278        ///
3279        /// Returns `None` if the enum contains an unknown value deserialized from
3280        /// the string representation of enums.
3281        pub fn value(&self) -> std::option::Option<i32> {
3282            match self {
3283                Self::Unspecified => std::option::Option::Some(0),
3284                Self::Active => std::option::Option::Some(1),
3285                Self::Claimed => std::option::Option::Some(6),
3286                Self::Succeeded => std::option::Option::Some(3),
3287                Self::Failed => std::option::Option::Some(4),
3288                Self::Dismissed => std::option::Option::Some(5),
3289                Self::UnknownValue(u) => u.0.value(),
3290            }
3291        }
3292
3293        /// Gets the enum value as a string.
3294        ///
3295        /// Returns `None` if the enum contains an unknown value deserialized from
3296        /// the integer representation of enums.
3297        pub fn name(&self) -> std::option::Option<&str> {
3298            match self {
3299                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3300                Self::Active => std::option::Option::Some("ACTIVE"),
3301                Self::Claimed => std::option::Option::Some("CLAIMED"),
3302                Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
3303                Self::Failed => std::option::Option::Some("FAILED"),
3304                Self::Dismissed => std::option::Option::Some("DISMISSED"),
3305                Self::UnknownValue(u) => u.0.name(),
3306            }
3307        }
3308    }
3309
3310    impl std::default::Default for State {
3311        fn default() -> Self {
3312            use std::convert::From;
3313            Self::from(0)
3314        }
3315    }
3316
3317    impl std::fmt::Display for State {
3318        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3319            wkt::internal::display_enum(f, self.name(), self.value())
3320        }
3321    }
3322
3323    impl std::convert::From<i32> for State {
3324        fn from(value: i32) -> Self {
3325            match value {
3326                0 => Self::Unspecified,
3327                1 => Self::Active,
3328                3 => Self::Succeeded,
3329                4 => Self::Failed,
3330                5 => Self::Dismissed,
3331                6 => Self::Claimed,
3332                _ => Self::UnknownValue(state::UnknownValue(
3333                    wkt::internal::UnknownEnumValue::Integer(value),
3334                )),
3335            }
3336        }
3337    }
3338
3339    impl std::convert::From<&str> for State {
3340        fn from(value: &str) -> Self {
3341            use std::string::ToString;
3342            match value {
3343                "STATE_UNSPECIFIED" => Self::Unspecified,
3344                "ACTIVE" => Self::Active,
3345                "CLAIMED" => Self::Claimed,
3346                "SUCCEEDED" => Self::Succeeded,
3347                "FAILED" => Self::Failed,
3348                "DISMISSED" => Self::Dismissed,
3349                _ => Self::UnknownValue(state::UnknownValue(
3350                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3351                )),
3352            }
3353        }
3354    }
3355
3356    impl serde::ser::Serialize for State {
3357        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3358        where
3359            S: serde::Serializer,
3360        {
3361            match self {
3362                Self::Unspecified => serializer.serialize_i32(0),
3363                Self::Active => serializer.serialize_i32(1),
3364                Self::Claimed => serializer.serialize_i32(6),
3365                Self::Succeeded => serializer.serialize_i32(3),
3366                Self::Failed => serializer.serialize_i32(4),
3367                Self::Dismissed => serializer.serialize_i32(5),
3368                Self::UnknownValue(u) => u.0.serialize(serializer),
3369            }
3370        }
3371    }
3372
3373    impl<'de> serde::de::Deserialize<'de> for State {
3374        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3375        where
3376            D: serde::Deserializer<'de>,
3377        {
3378            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3379                ".google.cloud.recommender.v1.RecommendationStateInfo.State",
3380            ))
3381        }
3382    }
3383}
3384
3385/// Configuration for a Recommender.
3386#[derive(Clone, Default, PartialEq)]
3387#[non_exhaustive]
3388pub struct RecommenderConfig {
3389    /// Name of recommender config.
3390    /// Eg,
3391    /// projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config
3392    pub name: std::string::String,
3393
3394    /// RecommenderGenerationConfig which configures the Generation of
3395    /// recommendations for this recommender.
3396    pub recommender_generation_config:
3397        std::option::Option<crate::model::RecommenderGenerationConfig>,
3398
3399    /// Fingerprint of the RecommenderConfig. Provides optimistic locking when
3400    /// updating.
3401    pub etag: std::string::String,
3402
3403    /// Last time when the config was updated.
3404    pub update_time: std::option::Option<wkt::Timestamp>,
3405
3406    /// Output only. Immutable. The revision ID of the config.
3407    /// A new revision is committed whenever the config is changed in any way.
3408    /// The format is an 8-character hexadecimal string.
3409    pub revision_id: std::string::String,
3410
3411    /// Allows clients to store small amounts of arbitrary data. Annotations must
3412    /// follow the Kubernetes syntax.
3413    /// The total size of all keys and values combined is limited to 256k.
3414    /// Key can have 2 segments: prefix (optional) and name (required),
3415    /// separated by a slash (/).
3416    /// Prefix must be a DNS subdomain.
3417    /// Name must be 63 characters or less, begin and end with alphanumerics,
3418    /// with dashes (-), underscores (_), dots (.), and alphanumerics between.
3419    pub annotations: std::collections::HashMap<std::string::String, std::string::String>,
3420
3421    /// A user-settable field to provide a human-readable name to be used in user
3422    /// interfaces.
3423    pub display_name: std::string::String,
3424
3425    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3426}
3427
3428impl RecommenderConfig {
3429    /// Creates a new default instance.
3430    pub fn new() -> Self {
3431        std::default::Default::default()
3432    }
3433
3434    /// Sets the value of [name][crate::model::RecommenderConfig::name].
3435    ///
3436    /// # Example
3437    /// ```ignore,no_run
3438    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3439    /// let x = RecommenderConfig::new().set_name("example");
3440    /// ```
3441    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3442        self.name = v.into();
3443        self
3444    }
3445
3446    /// Sets the value of [recommender_generation_config][crate::model::RecommenderConfig::recommender_generation_config].
3447    ///
3448    /// # Example
3449    /// ```ignore,no_run
3450    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3451    /// use google_cloud_recommender_v1::model::RecommenderGenerationConfig;
3452    /// let x = RecommenderConfig::new().set_recommender_generation_config(RecommenderGenerationConfig::default()/* use setters */);
3453    /// ```
3454    pub fn set_recommender_generation_config<T>(mut self, v: T) -> Self
3455    where
3456        T: std::convert::Into<crate::model::RecommenderGenerationConfig>,
3457    {
3458        self.recommender_generation_config = std::option::Option::Some(v.into());
3459        self
3460    }
3461
3462    /// Sets or clears the value of [recommender_generation_config][crate::model::RecommenderConfig::recommender_generation_config].
3463    ///
3464    /// # Example
3465    /// ```ignore,no_run
3466    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3467    /// use google_cloud_recommender_v1::model::RecommenderGenerationConfig;
3468    /// let x = RecommenderConfig::new().set_or_clear_recommender_generation_config(Some(RecommenderGenerationConfig::default()/* use setters */));
3469    /// let x = RecommenderConfig::new().set_or_clear_recommender_generation_config(None::<RecommenderGenerationConfig>);
3470    /// ```
3471    pub fn set_or_clear_recommender_generation_config<T>(
3472        mut self,
3473        v: std::option::Option<T>,
3474    ) -> Self
3475    where
3476        T: std::convert::Into<crate::model::RecommenderGenerationConfig>,
3477    {
3478        self.recommender_generation_config = v.map(|x| x.into());
3479        self
3480    }
3481
3482    /// Sets the value of [etag][crate::model::RecommenderConfig::etag].
3483    ///
3484    /// # Example
3485    /// ```ignore,no_run
3486    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3487    /// let x = RecommenderConfig::new().set_etag("example");
3488    /// ```
3489    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3490        self.etag = v.into();
3491        self
3492    }
3493
3494    /// Sets the value of [update_time][crate::model::RecommenderConfig::update_time].
3495    ///
3496    /// # Example
3497    /// ```ignore,no_run
3498    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3499    /// use wkt::Timestamp;
3500    /// let x = RecommenderConfig::new().set_update_time(Timestamp::default()/* use setters */);
3501    /// ```
3502    pub fn set_update_time<T>(mut self, v: T) -> Self
3503    where
3504        T: std::convert::Into<wkt::Timestamp>,
3505    {
3506        self.update_time = std::option::Option::Some(v.into());
3507        self
3508    }
3509
3510    /// Sets or clears the value of [update_time][crate::model::RecommenderConfig::update_time].
3511    ///
3512    /// # Example
3513    /// ```ignore,no_run
3514    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3515    /// use wkt::Timestamp;
3516    /// let x = RecommenderConfig::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3517    /// let x = RecommenderConfig::new().set_or_clear_update_time(None::<Timestamp>);
3518    /// ```
3519    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3520    where
3521        T: std::convert::Into<wkt::Timestamp>,
3522    {
3523        self.update_time = v.map(|x| x.into());
3524        self
3525    }
3526
3527    /// Sets the value of [revision_id][crate::model::RecommenderConfig::revision_id].
3528    ///
3529    /// # Example
3530    /// ```ignore,no_run
3531    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3532    /// let x = RecommenderConfig::new().set_revision_id("example");
3533    /// ```
3534    pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3535        self.revision_id = v.into();
3536        self
3537    }
3538
3539    /// Sets the value of [annotations][crate::model::RecommenderConfig::annotations].
3540    ///
3541    /// # Example
3542    /// ```ignore,no_run
3543    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3544    /// let x = RecommenderConfig::new().set_annotations([
3545    ///     ("key0", "abc"),
3546    ///     ("key1", "xyz"),
3547    /// ]);
3548    /// ```
3549    pub fn set_annotations<T, K, V>(mut self, v: T) -> Self
3550    where
3551        T: std::iter::IntoIterator<Item = (K, V)>,
3552        K: std::convert::Into<std::string::String>,
3553        V: std::convert::Into<std::string::String>,
3554    {
3555        use std::iter::Iterator;
3556        self.annotations = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3557        self
3558    }
3559
3560    /// Sets the value of [display_name][crate::model::RecommenderConfig::display_name].
3561    ///
3562    /// # Example
3563    /// ```ignore,no_run
3564    /// # use google_cloud_recommender_v1::model::RecommenderConfig;
3565    /// let x = RecommenderConfig::new().set_display_name("example");
3566    /// ```
3567    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3568        self.display_name = v.into();
3569        self
3570    }
3571}
3572
3573impl wkt::message::Message for RecommenderConfig {
3574    fn typename() -> &'static str {
3575        "type.googleapis.com/google.cloud.recommender.v1.RecommenderConfig"
3576    }
3577}
3578
3579/// A Configuration to customize the generation of recommendations.
3580/// Eg, customizing the lookback period considered when generating a
3581/// recommendation.
3582#[derive(Clone, Default, PartialEq)]
3583#[non_exhaustive]
3584pub struct RecommenderGenerationConfig {
3585    /// Parameters for this RecommenderGenerationConfig. These configs can be used
3586    /// by or are applied to all subtypes.
3587    pub params: std::option::Option<wkt::Struct>,
3588
3589    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3590}
3591
3592impl RecommenderGenerationConfig {
3593    /// Creates a new default instance.
3594    pub fn new() -> Self {
3595        std::default::Default::default()
3596    }
3597
3598    /// Sets the value of [params][crate::model::RecommenderGenerationConfig::params].
3599    ///
3600    /// # Example
3601    /// ```ignore,no_run
3602    /// # use google_cloud_recommender_v1::model::RecommenderGenerationConfig;
3603    /// use wkt::Struct;
3604    /// let x = RecommenderGenerationConfig::new().set_params(Struct::default()/* use setters */);
3605    /// ```
3606    pub fn set_params<T>(mut self, v: T) -> Self
3607    where
3608        T: std::convert::Into<wkt::Struct>,
3609    {
3610        self.params = std::option::Option::Some(v.into());
3611        self
3612    }
3613
3614    /// Sets or clears the value of [params][crate::model::RecommenderGenerationConfig::params].
3615    ///
3616    /// # Example
3617    /// ```ignore,no_run
3618    /// # use google_cloud_recommender_v1::model::RecommenderGenerationConfig;
3619    /// use wkt::Struct;
3620    /// let x = RecommenderGenerationConfig::new().set_or_clear_params(Some(Struct::default()/* use setters */));
3621    /// let x = RecommenderGenerationConfig::new().set_or_clear_params(None::<Struct>);
3622    /// ```
3623    pub fn set_or_clear_params<T>(mut self, v: std::option::Option<T>) -> Self
3624    where
3625        T: std::convert::Into<wkt::Struct>,
3626    {
3627        self.params = v.map(|x| x.into());
3628        self
3629    }
3630}
3631
3632impl wkt::message::Message for RecommenderGenerationConfig {
3633    fn typename() -> &'static str {
3634        "type.googleapis.com/google.cloud.recommender.v1.RecommenderGenerationConfig"
3635    }
3636}
3637
3638/// Request for the `ListInsights` method.
3639#[derive(Clone, Default, PartialEq)]
3640#[non_exhaustive]
3641pub struct ListInsightsRequest {
3642    /// Required. The container resource on which to execute the request.
3643    /// Acceptable formats:
3644    ///
3645    /// * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
3646    ///
3647    /// * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
3648    ///
3649    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
3650    ///
3651    /// * `folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
3652    ///
3653    /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]`
3654    ///
3655    ///
3656    /// LOCATION here refers to GCP Locations:
3657    /// <https://cloud.google.com/about/locations/>
3658    /// INSIGHT_TYPE_ID refers to supported insight types:
3659    /// <https://cloud.google.com/recommender/docs/insights/insight-types>.
3660    pub parent: std::string::String,
3661
3662    /// Optional. The maximum number of results to return from this request.
3663    /// Non-positive values are ignored. If not specified, the server will
3664    /// determine the number of results to return.
3665    pub page_size: i32,
3666
3667    /// Optional. If present, retrieves the next batch of results from the
3668    /// preceding call to this method. `page_token` must be the value of
3669    /// `next_page_token` from the previous response. The values of other method
3670    /// parameters must be identical to those in the previous call.
3671    pub page_token: std::string::String,
3672
3673    /// Optional. Filter expression to restrict the insights returned. Supported
3674    /// filter fields:
3675    ///
3676    /// * `stateInfo.state`
3677    ///
3678    /// * `insightSubtype`
3679    ///
3680    /// * `severity`
3681    ///
3682    /// * `targetResources`
3683    ///
3684    ///
3685    /// Examples:
3686    ///
3687    /// * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED`
3688    ///
3689    /// * `insightSubtype = PERMISSIONS_USAGE`
3690    ///
3691    /// * `severity = CRITICAL OR severity = HIGH`
3692    ///
3693    /// * `targetResources :
3694    ///   //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1`
3695    ///
3696    /// * `stateInfo.state = ACTIVE AND (severity = CRITICAL OR severity = HIGH)`
3697    ///
3698    ///
3699    /// The max allowed filter length is 500 characters.
3700    ///
3701    /// (These expressions are based on the filter language described at
3702    /// <https://google.aip.dev/160>)
3703    pub filter: std::string::String,
3704
3705    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3706}
3707
3708impl ListInsightsRequest {
3709    /// Creates a new default instance.
3710    pub fn new() -> Self {
3711        std::default::Default::default()
3712    }
3713
3714    /// Sets the value of [parent][crate::model::ListInsightsRequest::parent].
3715    ///
3716    /// # Example
3717    /// ```ignore,no_run
3718    /// # use google_cloud_recommender_v1::model::ListInsightsRequest;
3719    /// let x = ListInsightsRequest::new().set_parent("example");
3720    /// ```
3721    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3722        self.parent = v.into();
3723        self
3724    }
3725
3726    /// Sets the value of [page_size][crate::model::ListInsightsRequest::page_size].
3727    ///
3728    /// # Example
3729    /// ```ignore,no_run
3730    /// # use google_cloud_recommender_v1::model::ListInsightsRequest;
3731    /// let x = ListInsightsRequest::new().set_page_size(42);
3732    /// ```
3733    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3734        self.page_size = v.into();
3735        self
3736    }
3737
3738    /// Sets the value of [page_token][crate::model::ListInsightsRequest::page_token].
3739    ///
3740    /// # Example
3741    /// ```ignore,no_run
3742    /// # use google_cloud_recommender_v1::model::ListInsightsRequest;
3743    /// let x = ListInsightsRequest::new().set_page_token("example");
3744    /// ```
3745    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3746        self.page_token = v.into();
3747        self
3748    }
3749
3750    /// Sets the value of [filter][crate::model::ListInsightsRequest::filter].
3751    ///
3752    /// # Example
3753    /// ```ignore,no_run
3754    /// # use google_cloud_recommender_v1::model::ListInsightsRequest;
3755    /// let x = ListInsightsRequest::new().set_filter("example");
3756    /// ```
3757    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3758        self.filter = v.into();
3759        self
3760    }
3761}
3762
3763impl wkt::message::Message for ListInsightsRequest {
3764    fn typename() -> &'static str {
3765        "type.googleapis.com/google.cloud.recommender.v1.ListInsightsRequest"
3766    }
3767}
3768
3769/// Response to the `ListInsights` method.
3770#[derive(Clone, Default, PartialEq)]
3771#[non_exhaustive]
3772pub struct ListInsightsResponse {
3773    /// The set of insights for the `parent` resource.
3774    pub insights: std::vec::Vec<crate::model::Insight>,
3775
3776    /// A token that can be used to request the next page of results. This field is
3777    /// empty if there are no additional results.
3778    pub next_page_token: std::string::String,
3779
3780    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3781}
3782
3783impl ListInsightsResponse {
3784    /// Creates a new default instance.
3785    pub fn new() -> Self {
3786        std::default::Default::default()
3787    }
3788
3789    /// Sets the value of [insights][crate::model::ListInsightsResponse::insights].
3790    ///
3791    /// # Example
3792    /// ```ignore,no_run
3793    /// # use google_cloud_recommender_v1::model::ListInsightsResponse;
3794    /// use google_cloud_recommender_v1::model::Insight;
3795    /// let x = ListInsightsResponse::new()
3796    ///     .set_insights([
3797    ///         Insight::default()/* use setters */,
3798    ///         Insight::default()/* use (different) setters */,
3799    ///     ]);
3800    /// ```
3801    pub fn set_insights<T, V>(mut self, v: T) -> Self
3802    where
3803        T: std::iter::IntoIterator<Item = V>,
3804        V: std::convert::Into<crate::model::Insight>,
3805    {
3806        use std::iter::Iterator;
3807        self.insights = v.into_iter().map(|i| i.into()).collect();
3808        self
3809    }
3810
3811    /// Sets the value of [next_page_token][crate::model::ListInsightsResponse::next_page_token].
3812    ///
3813    /// # Example
3814    /// ```ignore,no_run
3815    /// # use google_cloud_recommender_v1::model::ListInsightsResponse;
3816    /// let x = ListInsightsResponse::new().set_next_page_token("example");
3817    /// ```
3818    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3819        self.next_page_token = v.into();
3820        self
3821    }
3822}
3823
3824impl wkt::message::Message for ListInsightsResponse {
3825    fn typename() -> &'static str {
3826        "type.googleapis.com/google.cloud.recommender.v1.ListInsightsResponse"
3827    }
3828}
3829
3830#[doc(hidden)]
3831impl google_cloud_gax::paginator::internal::PageableResponse for ListInsightsResponse {
3832    type PageItem = crate::model::Insight;
3833
3834    fn items(self) -> std::vec::Vec<Self::PageItem> {
3835        self.insights
3836    }
3837
3838    fn next_page_token(&self) -> std::string::String {
3839        use std::clone::Clone;
3840        self.next_page_token.clone()
3841    }
3842}
3843
3844/// Request to the `GetInsight` method.
3845#[derive(Clone, Default, PartialEq)]
3846#[non_exhaustive]
3847pub struct GetInsightRequest {
3848    /// Required. Name of the insight.
3849    pub name: std::string::String,
3850
3851    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3852}
3853
3854impl GetInsightRequest {
3855    /// Creates a new default instance.
3856    pub fn new() -> Self {
3857        std::default::Default::default()
3858    }
3859
3860    /// Sets the value of [name][crate::model::GetInsightRequest::name].
3861    ///
3862    /// # Example
3863    /// ```ignore,no_run
3864    /// # use google_cloud_recommender_v1::model::GetInsightRequest;
3865    /// let x = GetInsightRequest::new().set_name("example");
3866    /// ```
3867    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3868        self.name = v.into();
3869        self
3870    }
3871}
3872
3873impl wkt::message::Message for GetInsightRequest {
3874    fn typename() -> &'static str {
3875        "type.googleapis.com/google.cloud.recommender.v1.GetInsightRequest"
3876    }
3877}
3878
3879/// Request for the `MarkInsightAccepted` method.
3880#[derive(Clone, Default, PartialEq)]
3881#[non_exhaustive]
3882pub struct MarkInsightAcceptedRequest {
3883    /// Required. Name of the insight.
3884    pub name: std::string::String,
3885
3886    /// Optional. State properties user wish to include with this state.  Full
3887    /// replace of the current state_metadata.
3888    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,
3889
3890    /// Required. Fingerprint of the Insight. Provides optimistic locking.
3891    pub etag: std::string::String,
3892
3893    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3894}
3895
3896impl MarkInsightAcceptedRequest {
3897    /// Creates a new default instance.
3898    pub fn new() -> Self {
3899        std::default::Default::default()
3900    }
3901
3902    /// Sets the value of [name][crate::model::MarkInsightAcceptedRequest::name].
3903    ///
3904    /// # Example
3905    /// ```ignore,no_run
3906    /// # use google_cloud_recommender_v1::model::MarkInsightAcceptedRequest;
3907    /// let x = MarkInsightAcceptedRequest::new().set_name("example");
3908    /// ```
3909    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3910        self.name = v.into();
3911        self
3912    }
3913
3914    /// Sets the value of [state_metadata][crate::model::MarkInsightAcceptedRequest::state_metadata].
3915    ///
3916    /// # Example
3917    /// ```ignore,no_run
3918    /// # use google_cloud_recommender_v1::model::MarkInsightAcceptedRequest;
3919    /// let x = MarkInsightAcceptedRequest::new().set_state_metadata([
3920    ///     ("key0", "abc"),
3921    ///     ("key1", "xyz"),
3922    /// ]);
3923    /// ```
3924    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
3925    where
3926        T: std::iter::IntoIterator<Item = (K, V)>,
3927        K: std::convert::Into<std::string::String>,
3928        V: std::convert::Into<std::string::String>,
3929    {
3930        use std::iter::Iterator;
3931        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3932        self
3933    }
3934
3935    /// Sets the value of [etag][crate::model::MarkInsightAcceptedRequest::etag].
3936    ///
3937    /// # Example
3938    /// ```ignore,no_run
3939    /// # use google_cloud_recommender_v1::model::MarkInsightAcceptedRequest;
3940    /// let x = MarkInsightAcceptedRequest::new().set_etag("example");
3941    /// ```
3942    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3943        self.etag = v.into();
3944        self
3945    }
3946}
3947
3948impl wkt::message::Message for MarkInsightAcceptedRequest {
3949    fn typename() -> &'static str {
3950        "type.googleapis.com/google.cloud.recommender.v1.MarkInsightAcceptedRequest"
3951    }
3952}
3953
3954/// Request for the `ListRecommendations` method.
3955#[derive(Clone, Default, PartialEq)]
3956#[non_exhaustive]
3957pub struct ListRecommendationsRequest {
3958    /// Required. The container resource on which to execute the request.
3959    /// Acceptable formats:
3960    ///
3961    /// * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
3962    ///
3963    /// * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
3964    ///
3965    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
3966    ///
3967    /// * `folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
3968    ///
3969    /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]`
3970    ///
3971    ///
3972    /// LOCATION here refers to GCP Locations:
3973    /// <https://cloud.google.com/about/locations/>
3974    /// RECOMMENDER_ID refers to supported recommenders:
3975    /// <https://cloud.google.com/recommender/docs/recommenders>.
3976    pub parent: std::string::String,
3977
3978    /// Optional. The maximum number of results to return from this request.
3979    /// Non-positive values are ignored. If not specified, the server will
3980    /// determine the number of results to return.
3981    pub page_size: i32,
3982
3983    /// Optional. If present, retrieves the next batch of results from the
3984    /// preceding call to this method. `page_token` must be the value of
3985    /// `next_page_token` from the previous response. The values of other method
3986    /// parameters must be identical to those in the previous call.
3987    pub page_token: std::string::String,
3988
3989    /// Filter expression to restrict the recommendations returned. Supported
3990    /// filter fields:
3991    ///
3992    /// * `state_info.state`
3993    ///
3994    /// * `recommenderSubtype`
3995    ///
3996    /// * `priority`
3997    ///
3998    /// * `targetResources`
3999    ///
4000    ///
4001    /// Examples:
4002    ///
4003    /// * `stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED`
4004    ///
4005    /// * `recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE`
4006    ///
4007    /// * `priority = P1 OR priority = P2`
4008    ///
4009    /// * `targetResources :
4010    ///   //compute.googleapis.com/projects/1234/zones/us-central1-a/instances/instance-1`
4011    ///
4012    /// * `stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)`
4013    ///
4014    ///
4015    /// The max allowed filter length is 500 characters.
4016    ///
4017    /// (These expressions are based on the filter language described at
4018    /// <https://google.aip.dev/160>)
4019    pub filter: std::string::String,
4020
4021    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4022}
4023
4024impl ListRecommendationsRequest {
4025    /// Creates a new default instance.
4026    pub fn new() -> Self {
4027        std::default::Default::default()
4028    }
4029
4030    /// Sets the value of [parent][crate::model::ListRecommendationsRequest::parent].
4031    ///
4032    /// # Example
4033    /// ```ignore,no_run
4034    /// # use google_cloud_recommender_v1::model::ListRecommendationsRequest;
4035    /// let x = ListRecommendationsRequest::new().set_parent("example");
4036    /// ```
4037    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4038        self.parent = v.into();
4039        self
4040    }
4041
4042    /// Sets the value of [page_size][crate::model::ListRecommendationsRequest::page_size].
4043    ///
4044    /// # Example
4045    /// ```ignore,no_run
4046    /// # use google_cloud_recommender_v1::model::ListRecommendationsRequest;
4047    /// let x = ListRecommendationsRequest::new().set_page_size(42);
4048    /// ```
4049    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4050        self.page_size = v.into();
4051        self
4052    }
4053
4054    /// Sets the value of [page_token][crate::model::ListRecommendationsRequest::page_token].
4055    ///
4056    /// # Example
4057    /// ```ignore,no_run
4058    /// # use google_cloud_recommender_v1::model::ListRecommendationsRequest;
4059    /// let x = ListRecommendationsRequest::new().set_page_token("example");
4060    /// ```
4061    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4062        self.page_token = v.into();
4063        self
4064    }
4065
4066    /// Sets the value of [filter][crate::model::ListRecommendationsRequest::filter].
4067    ///
4068    /// # Example
4069    /// ```ignore,no_run
4070    /// # use google_cloud_recommender_v1::model::ListRecommendationsRequest;
4071    /// let x = ListRecommendationsRequest::new().set_filter("example");
4072    /// ```
4073    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4074        self.filter = v.into();
4075        self
4076    }
4077}
4078
4079impl wkt::message::Message for ListRecommendationsRequest {
4080    fn typename() -> &'static str {
4081        "type.googleapis.com/google.cloud.recommender.v1.ListRecommendationsRequest"
4082    }
4083}
4084
4085/// Response to the `ListRecommendations` method.
4086#[derive(Clone, Default, PartialEq)]
4087#[non_exhaustive]
4088pub struct ListRecommendationsResponse {
4089    /// The set of recommendations for the `parent` resource.
4090    pub recommendations: std::vec::Vec<crate::model::Recommendation>,
4091
4092    /// A token that can be used to request the next page of results. This field is
4093    /// empty if there are no additional results.
4094    pub next_page_token: std::string::String,
4095
4096    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4097}
4098
4099impl ListRecommendationsResponse {
4100    /// Creates a new default instance.
4101    pub fn new() -> Self {
4102        std::default::Default::default()
4103    }
4104
4105    /// Sets the value of [recommendations][crate::model::ListRecommendationsResponse::recommendations].
4106    ///
4107    /// # Example
4108    /// ```ignore,no_run
4109    /// # use google_cloud_recommender_v1::model::ListRecommendationsResponse;
4110    /// use google_cloud_recommender_v1::model::Recommendation;
4111    /// let x = ListRecommendationsResponse::new()
4112    ///     .set_recommendations([
4113    ///         Recommendation::default()/* use setters */,
4114    ///         Recommendation::default()/* use (different) setters */,
4115    ///     ]);
4116    /// ```
4117    pub fn set_recommendations<T, V>(mut self, v: T) -> Self
4118    where
4119        T: std::iter::IntoIterator<Item = V>,
4120        V: std::convert::Into<crate::model::Recommendation>,
4121    {
4122        use std::iter::Iterator;
4123        self.recommendations = v.into_iter().map(|i| i.into()).collect();
4124        self
4125    }
4126
4127    /// Sets the value of [next_page_token][crate::model::ListRecommendationsResponse::next_page_token].
4128    ///
4129    /// # Example
4130    /// ```ignore,no_run
4131    /// # use google_cloud_recommender_v1::model::ListRecommendationsResponse;
4132    /// let x = ListRecommendationsResponse::new().set_next_page_token("example");
4133    /// ```
4134    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4135        self.next_page_token = v.into();
4136        self
4137    }
4138}
4139
4140impl wkt::message::Message for ListRecommendationsResponse {
4141    fn typename() -> &'static str {
4142        "type.googleapis.com/google.cloud.recommender.v1.ListRecommendationsResponse"
4143    }
4144}
4145
4146#[doc(hidden)]
4147impl google_cloud_gax::paginator::internal::PageableResponse for ListRecommendationsResponse {
4148    type PageItem = crate::model::Recommendation;
4149
4150    fn items(self) -> std::vec::Vec<Self::PageItem> {
4151        self.recommendations
4152    }
4153
4154    fn next_page_token(&self) -> std::string::String {
4155        use std::clone::Clone;
4156        self.next_page_token.clone()
4157    }
4158}
4159
4160/// Request to the `GetRecommendation` method.
4161#[derive(Clone, Default, PartialEq)]
4162#[non_exhaustive]
4163pub struct GetRecommendationRequest {
4164    /// Required. Name of the recommendation.
4165    pub name: std::string::String,
4166
4167    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4168}
4169
4170impl GetRecommendationRequest {
4171    /// Creates a new default instance.
4172    pub fn new() -> Self {
4173        std::default::Default::default()
4174    }
4175
4176    /// Sets the value of [name][crate::model::GetRecommendationRequest::name].
4177    ///
4178    /// # Example
4179    /// ```ignore,no_run
4180    /// # use google_cloud_recommender_v1::model::GetRecommendationRequest;
4181    /// let x = GetRecommendationRequest::new().set_name("example");
4182    /// ```
4183    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4184        self.name = v.into();
4185        self
4186    }
4187}
4188
4189impl wkt::message::Message for GetRecommendationRequest {
4190    fn typename() -> &'static str {
4191        "type.googleapis.com/google.cloud.recommender.v1.GetRecommendationRequest"
4192    }
4193}
4194
4195/// Request for the `MarkRecommendationDismissed` Method.
4196#[derive(Clone, Default, PartialEq)]
4197#[non_exhaustive]
4198pub struct MarkRecommendationDismissedRequest {
4199    /// Required. Name of the recommendation.
4200    pub name: std::string::String,
4201
4202    /// Fingerprint of the Recommendation. Provides optimistic locking.
4203    pub etag: std::string::String,
4204
4205    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4206}
4207
4208impl MarkRecommendationDismissedRequest {
4209    /// Creates a new default instance.
4210    pub fn new() -> Self {
4211        std::default::Default::default()
4212    }
4213
4214    /// Sets the value of [name][crate::model::MarkRecommendationDismissedRequest::name].
4215    ///
4216    /// # Example
4217    /// ```ignore,no_run
4218    /// # use google_cloud_recommender_v1::model::MarkRecommendationDismissedRequest;
4219    /// let x = MarkRecommendationDismissedRequest::new().set_name("example");
4220    /// ```
4221    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4222        self.name = v.into();
4223        self
4224    }
4225
4226    /// Sets the value of [etag][crate::model::MarkRecommendationDismissedRequest::etag].
4227    ///
4228    /// # Example
4229    /// ```ignore,no_run
4230    /// # use google_cloud_recommender_v1::model::MarkRecommendationDismissedRequest;
4231    /// let x = MarkRecommendationDismissedRequest::new().set_etag("example");
4232    /// ```
4233    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4234        self.etag = v.into();
4235        self
4236    }
4237}
4238
4239impl wkt::message::Message for MarkRecommendationDismissedRequest {
4240    fn typename() -> &'static str {
4241        "type.googleapis.com/google.cloud.recommender.v1.MarkRecommendationDismissedRequest"
4242    }
4243}
4244
4245/// Request for the `MarkRecommendationClaimed` Method.
4246#[derive(Clone, Default, PartialEq)]
4247#[non_exhaustive]
4248pub struct MarkRecommendationClaimedRequest {
4249    /// Required. Name of the recommendation.
4250    pub name: std::string::String,
4251
4252    /// State properties to include with this state. Overwrites any existing
4253    /// `state_metadata`.
4254    /// Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`.
4255    /// Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
4256    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,
4257
4258    /// Required. Fingerprint of the Recommendation. Provides optimistic locking.
4259    pub etag: std::string::String,
4260
4261    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4262}
4263
4264impl MarkRecommendationClaimedRequest {
4265    /// Creates a new default instance.
4266    pub fn new() -> Self {
4267        std::default::Default::default()
4268    }
4269
4270    /// Sets the value of [name][crate::model::MarkRecommendationClaimedRequest::name].
4271    ///
4272    /// # Example
4273    /// ```ignore,no_run
4274    /// # use google_cloud_recommender_v1::model::MarkRecommendationClaimedRequest;
4275    /// let x = MarkRecommendationClaimedRequest::new().set_name("example");
4276    /// ```
4277    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4278        self.name = v.into();
4279        self
4280    }
4281
4282    /// Sets the value of [state_metadata][crate::model::MarkRecommendationClaimedRequest::state_metadata].
4283    ///
4284    /// # Example
4285    /// ```ignore,no_run
4286    /// # use google_cloud_recommender_v1::model::MarkRecommendationClaimedRequest;
4287    /// let x = MarkRecommendationClaimedRequest::new().set_state_metadata([
4288    ///     ("key0", "abc"),
4289    ///     ("key1", "xyz"),
4290    /// ]);
4291    /// ```
4292    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
4293    where
4294        T: std::iter::IntoIterator<Item = (K, V)>,
4295        K: std::convert::Into<std::string::String>,
4296        V: std::convert::Into<std::string::String>,
4297    {
4298        use std::iter::Iterator;
4299        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4300        self
4301    }
4302
4303    /// Sets the value of [etag][crate::model::MarkRecommendationClaimedRequest::etag].
4304    ///
4305    /// # Example
4306    /// ```ignore,no_run
4307    /// # use google_cloud_recommender_v1::model::MarkRecommendationClaimedRequest;
4308    /// let x = MarkRecommendationClaimedRequest::new().set_etag("example");
4309    /// ```
4310    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4311        self.etag = v.into();
4312        self
4313    }
4314}
4315
4316impl wkt::message::Message for MarkRecommendationClaimedRequest {
4317    fn typename() -> &'static str {
4318        "type.googleapis.com/google.cloud.recommender.v1.MarkRecommendationClaimedRequest"
4319    }
4320}
4321
4322/// Request for the `MarkRecommendationSucceeded` Method.
4323#[derive(Clone, Default, PartialEq)]
4324#[non_exhaustive]
4325pub struct MarkRecommendationSucceededRequest {
4326    /// Required. Name of the recommendation.
4327    pub name: std::string::String,
4328
4329    /// State properties to include with this state. Overwrites any existing
4330    /// `state_metadata`.
4331    /// Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`.
4332    /// Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
4333    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,
4334
4335    /// Required. Fingerprint of the Recommendation. Provides optimistic locking.
4336    pub etag: std::string::String,
4337
4338    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4339}
4340
4341impl MarkRecommendationSucceededRequest {
4342    /// Creates a new default instance.
4343    pub fn new() -> Self {
4344        std::default::Default::default()
4345    }
4346
4347    /// Sets the value of [name][crate::model::MarkRecommendationSucceededRequest::name].
4348    ///
4349    /// # Example
4350    /// ```ignore,no_run
4351    /// # use google_cloud_recommender_v1::model::MarkRecommendationSucceededRequest;
4352    /// let x = MarkRecommendationSucceededRequest::new().set_name("example");
4353    /// ```
4354    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4355        self.name = v.into();
4356        self
4357    }
4358
4359    /// Sets the value of [state_metadata][crate::model::MarkRecommendationSucceededRequest::state_metadata].
4360    ///
4361    /// # Example
4362    /// ```ignore,no_run
4363    /// # use google_cloud_recommender_v1::model::MarkRecommendationSucceededRequest;
4364    /// let x = MarkRecommendationSucceededRequest::new().set_state_metadata([
4365    ///     ("key0", "abc"),
4366    ///     ("key1", "xyz"),
4367    /// ]);
4368    /// ```
4369    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
4370    where
4371        T: std::iter::IntoIterator<Item = (K, V)>,
4372        K: std::convert::Into<std::string::String>,
4373        V: std::convert::Into<std::string::String>,
4374    {
4375        use std::iter::Iterator;
4376        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4377        self
4378    }
4379
4380    /// Sets the value of [etag][crate::model::MarkRecommendationSucceededRequest::etag].
4381    ///
4382    /// # Example
4383    /// ```ignore,no_run
4384    /// # use google_cloud_recommender_v1::model::MarkRecommendationSucceededRequest;
4385    /// let x = MarkRecommendationSucceededRequest::new().set_etag("example");
4386    /// ```
4387    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4388        self.etag = v.into();
4389        self
4390    }
4391}
4392
4393impl wkt::message::Message for MarkRecommendationSucceededRequest {
4394    fn typename() -> &'static str {
4395        "type.googleapis.com/google.cloud.recommender.v1.MarkRecommendationSucceededRequest"
4396    }
4397}
4398
4399/// Request for the `MarkRecommendationFailed` Method.
4400#[derive(Clone, Default, PartialEq)]
4401#[non_exhaustive]
4402pub struct MarkRecommendationFailedRequest {
4403    /// Required. Name of the recommendation.
4404    pub name: std::string::String,
4405
4406    /// State properties to include with this state. Overwrites any existing
4407    /// `state_metadata`.
4408    /// Keys must match the regex `/^[a-z0-9][a-z0-9_.-]{0,62}$/`.
4409    /// Values must match the regex `/^[a-zA-Z0-9_./-]{0,255}$/`.
4410    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,
4411
4412    /// Required. Fingerprint of the Recommendation. Provides optimistic locking.
4413    pub etag: std::string::String,
4414
4415    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4416}
4417
4418impl MarkRecommendationFailedRequest {
4419    /// Creates a new default instance.
4420    pub fn new() -> Self {
4421        std::default::Default::default()
4422    }
4423
4424    /// Sets the value of [name][crate::model::MarkRecommendationFailedRequest::name].
4425    ///
4426    /// # Example
4427    /// ```ignore,no_run
4428    /// # use google_cloud_recommender_v1::model::MarkRecommendationFailedRequest;
4429    /// let x = MarkRecommendationFailedRequest::new().set_name("example");
4430    /// ```
4431    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4432        self.name = v.into();
4433        self
4434    }
4435
4436    /// Sets the value of [state_metadata][crate::model::MarkRecommendationFailedRequest::state_metadata].
4437    ///
4438    /// # Example
4439    /// ```ignore,no_run
4440    /// # use google_cloud_recommender_v1::model::MarkRecommendationFailedRequest;
4441    /// let x = MarkRecommendationFailedRequest::new().set_state_metadata([
4442    ///     ("key0", "abc"),
4443    ///     ("key1", "xyz"),
4444    /// ]);
4445    /// ```
4446    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
4447    where
4448        T: std::iter::IntoIterator<Item = (K, V)>,
4449        K: std::convert::Into<std::string::String>,
4450        V: std::convert::Into<std::string::String>,
4451    {
4452        use std::iter::Iterator;
4453        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
4454        self
4455    }
4456
4457    /// Sets the value of [etag][crate::model::MarkRecommendationFailedRequest::etag].
4458    ///
4459    /// # Example
4460    /// ```ignore,no_run
4461    /// # use google_cloud_recommender_v1::model::MarkRecommendationFailedRequest;
4462    /// let x = MarkRecommendationFailedRequest::new().set_etag("example");
4463    /// ```
4464    pub fn set_etag<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4465        self.etag = v.into();
4466        self
4467    }
4468}
4469
4470impl wkt::message::Message for MarkRecommendationFailedRequest {
4471    fn typename() -> &'static str {
4472        "type.googleapis.com/google.cloud.recommender.v1.MarkRecommendationFailedRequest"
4473    }
4474}
4475
4476/// Request for the GetRecommenderConfig` method.
4477#[derive(Clone, Default, PartialEq)]
4478#[non_exhaustive]
4479pub struct GetRecommenderConfigRequest {
4480    /// Required. Name of the Recommendation Config to get.
4481    ///
4482    /// Acceptable formats:
4483    ///
4484    /// * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
4485    ///
4486    /// * `projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
4487    ///
4488    /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
4489    ///
4490    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config`
4491    ///
4492    pub name: std::string::String,
4493
4494    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4495}
4496
4497impl GetRecommenderConfigRequest {
4498    /// Creates a new default instance.
4499    pub fn new() -> Self {
4500        std::default::Default::default()
4501    }
4502
4503    /// Sets the value of [name][crate::model::GetRecommenderConfigRequest::name].
4504    ///
4505    /// # Example
4506    /// ```ignore,no_run
4507    /// # use google_cloud_recommender_v1::model::GetRecommenderConfigRequest;
4508    /// let x = GetRecommenderConfigRequest::new().set_name("example");
4509    /// ```
4510    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4511        self.name = v.into();
4512        self
4513    }
4514}
4515
4516impl wkt::message::Message for GetRecommenderConfigRequest {
4517    fn typename() -> &'static str {
4518        "type.googleapis.com/google.cloud.recommender.v1.GetRecommenderConfigRequest"
4519    }
4520}
4521
4522/// Request for the `UpdateRecommenderConfig` method.
4523#[derive(Clone, Default, PartialEq)]
4524#[non_exhaustive]
4525pub struct UpdateRecommenderConfigRequest {
4526    /// Required. The RecommenderConfig to update.
4527    pub recommender_config: std::option::Option<crate::model::RecommenderConfig>,
4528
4529    /// The list of fields to be updated.
4530    pub update_mask: std::option::Option<wkt::FieldMask>,
4531
4532    /// If true, validate the request and preview the change, but do not actually
4533    /// update it.
4534    pub validate_only: bool,
4535
4536    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4537}
4538
4539impl UpdateRecommenderConfigRequest {
4540    /// Creates a new default instance.
4541    pub fn new() -> Self {
4542        std::default::Default::default()
4543    }
4544
4545    /// Sets the value of [recommender_config][crate::model::UpdateRecommenderConfigRequest::recommender_config].
4546    ///
4547    /// # Example
4548    /// ```ignore,no_run
4549    /// # use google_cloud_recommender_v1::model::UpdateRecommenderConfigRequest;
4550    /// use google_cloud_recommender_v1::model::RecommenderConfig;
4551    /// let x = UpdateRecommenderConfigRequest::new().set_recommender_config(RecommenderConfig::default()/* use setters */);
4552    /// ```
4553    pub fn set_recommender_config<T>(mut self, v: T) -> Self
4554    where
4555        T: std::convert::Into<crate::model::RecommenderConfig>,
4556    {
4557        self.recommender_config = std::option::Option::Some(v.into());
4558        self
4559    }
4560
4561    /// Sets or clears the value of [recommender_config][crate::model::UpdateRecommenderConfigRequest::recommender_config].
4562    ///
4563    /// # Example
4564    /// ```ignore,no_run
4565    /// # use google_cloud_recommender_v1::model::UpdateRecommenderConfigRequest;
4566    /// use google_cloud_recommender_v1::model::RecommenderConfig;
4567    /// let x = UpdateRecommenderConfigRequest::new().set_or_clear_recommender_config(Some(RecommenderConfig::default()/* use setters */));
4568    /// let x = UpdateRecommenderConfigRequest::new().set_or_clear_recommender_config(None::<RecommenderConfig>);
4569    /// ```
4570    pub fn set_or_clear_recommender_config<T>(mut self, v: std::option::Option<T>) -> Self
4571    where
4572        T: std::convert::Into<crate::model::RecommenderConfig>,
4573    {
4574        self.recommender_config = v.map(|x| x.into());
4575        self
4576    }
4577
4578    /// Sets the value of [update_mask][crate::model::UpdateRecommenderConfigRequest::update_mask].
4579    ///
4580    /// # Example
4581    /// ```ignore,no_run
4582    /// # use google_cloud_recommender_v1::model::UpdateRecommenderConfigRequest;
4583    /// use wkt::FieldMask;
4584    /// let x = UpdateRecommenderConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4585    /// ```
4586    pub fn set_update_mask<T>(mut self, v: T) -> Self
4587    where
4588        T: std::convert::Into<wkt::FieldMask>,
4589    {
4590        self.update_mask = std::option::Option::Some(v.into());
4591        self
4592    }
4593
4594    /// Sets or clears the value of [update_mask][crate::model::UpdateRecommenderConfigRequest::update_mask].
4595    ///
4596    /// # Example
4597    /// ```ignore,no_run
4598    /// # use google_cloud_recommender_v1::model::UpdateRecommenderConfigRequest;
4599    /// use wkt::FieldMask;
4600    /// let x = UpdateRecommenderConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4601    /// let x = UpdateRecommenderConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4602    /// ```
4603    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4604    where
4605        T: std::convert::Into<wkt::FieldMask>,
4606    {
4607        self.update_mask = v.map(|x| x.into());
4608        self
4609    }
4610
4611    /// Sets the value of [validate_only][crate::model::UpdateRecommenderConfigRequest::validate_only].
4612    ///
4613    /// # Example
4614    /// ```ignore,no_run
4615    /// # use google_cloud_recommender_v1::model::UpdateRecommenderConfigRequest;
4616    /// let x = UpdateRecommenderConfigRequest::new().set_validate_only(true);
4617    /// ```
4618    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4619        self.validate_only = v.into();
4620        self
4621    }
4622}
4623
4624impl wkt::message::Message for UpdateRecommenderConfigRequest {
4625    fn typename() -> &'static str {
4626        "type.googleapis.com/google.cloud.recommender.v1.UpdateRecommenderConfigRequest"
4627    }
4628}
4629
4630/// Request for the GetInsightTypeConfig` method.
4631#[derive(Clone, Default, PartialEq)]
4632#[non_exhaustive]
4633pub struct GetInsightTypeConfigRequest {
4634    /// Required. Name of the InsightTypeConfig to get.
4635    ///
4636    /// Acceptable formats:
4637    ///
4638    /// * `projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
4639    ///
4640    /// * `projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
4641    ///
4642    /// * `organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
4643    ///
4644    /// * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/config`
4645    ///
4646    pub name: std::string::String,
4647
4648    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4649}
4650
4651impl GetInsightTypeConfigRequest {
4652    /// Creates a new default instance.
4653    pub fn new() -> Self {
4654        std::default::Default::default()
4655    }
4656
4657    /// Sets the value of [name][crate::model::GetInsightTypeConfigRequest::name].
4658    ///
4659    /// # Example
4660    /// ```ignore,no_run
4661    /// # use google_cloud_recommender_v1::model::GetInsightTypeConfigRequest;
4662    /// let x = GetInsightTypeConfigRequest::new().set_name("example");
4663    /// ```
4664    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4665        self.name = v.into();
4666        self
4667    }
4668}
4669
4670impl wkt::message::Message for GetInsightTypeConfigRequest {
4671    fn typename() -> &'static str {
4672        "type.googleapis.com/google.cloud.recommender.v1.GetInsightTypeConfigRequest"
4673    }
4674}
4675
4676/// Request for the `UpdateInsightTypeConfig` method.
4677#[derive(Clone, Default, PartialEq)]
4678#[non_exhaustive]
4679pub struct UpdateInsightTypeConfigRequest {
4680    /// Required. The InsightTypeConfig to update.
4681    pub insight_type_config: std::option::Option<crate::model::InsightTypeConfig>,
4682
4683    /// The list of fields to be updated.
4684    pub update_mask: std::option::Option<wkt::FieldMask>,
4685
4686    /// If true, validate the request and preview the change, but do not actually
4687    /// update it.
4688    pub validate_only: bool,
4689
4690    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4691}
4692
4693impl UpdateInsightTypeConfigRequest {
4694    /// Creates a new default instance.
4695    pub fn new() -> Self {
4696        std::default::Default::default()
4697    }
4698
4699    /// Sets the value of [insight_type_config][crate::model::UpdateInsightTypeConfigRequest::insight_type_config].
4700    ///
4701    /// # Example
4702    /// ```ignore,no_run
4703    /// # use google_cloud_recommender_v1::model::UpdateInsightTypeConfigRequest;
4704    /// use google_cloud_recommender_v1::model::InsightTypeConfig;
4705    /// let x = UpdateInsightTypeConfigRequest::new().set_insight_type_config(InsightTypeConfig::default()/* use setters */);
4706    /// ```
4707    pub fn set_insight_type_config<T>(mut self, v: T) -> Self
4708    where
4709        T: std::convert::Into<crate::model::InsightTypeConfig>,
4710    {
4711        self.insight_type_config = std::option::Option::Some(v.into());
4712        self
4713    }
4714
4715    /// Sets or clears the value of [insight_type_config][crate::model::UpdateInsightTypeConfigRequest::insight_type_config].
4716    ///
4717    /// # Example
4718    /// ```ignore,no_run
4719    /// # use google_cloud_recommender_v1::model::UpdateInsightTypeConfigRequest;
4720    /// use google_cloud_recommender_v1::model::InsightTypeConfig;
4721    /// let x = UpdateInsightTypeConfigRequest::new().set_or_clear_insight_type_config(Some(InsightTypeConfig::default()/* use setters */));
4722    /// let x = UpdateInsightTypeConfigRequest::new().set_or_clear_insight_type_config(None::<InsightTypeConfig>);
4723    /// ```
4724    pub fn set_or_clear_insight_type_config<T>(mut self, v: std::option::Option<T>) -> Self
4725    where
4726        T: std::convert::Into<crate::model::InsightTypeConfig>,
4727    {
4728        self.insight_type_config = v.map(|x| x.into());
4729        self
4730    }
4731
4732    /// Sets the value of [update_mask][crate::model::UpdateInsightTypeConfigRequest::update_mask].
4733    ///
4734    /// # Example
4735    /// ```ignore,no_run
4736    /// # use google_cloud_recommender_v1::model::UpdateInsightTypeConfigRequest;
4737    /// use wkt::FieldMask;
4738    /// let x = UpdateInsightTypeConfigRequest::new().set_update_mask(FieldMask::default()/* use setters */);
4739    /// ```
4740    pub fn set_update_mask<T>(mut self, v: T) -> Self
4741    where
4742        T: std::convert::Into<wkt::FieldMask>,
4743    {
4744        self.update_mask = std::option::Option::Some(v.into());
4745        self
4746    }
4747
4748    /// Sets or clears the value of [update_mask][crate::model::UpdateInsightTypeConfigRequest::update_mask].
4749    ///
4750    /// # Example
4751    /// ```ignore,no_run
4752    /// # use google_cloud_recommender_v1::model::UpdateInsightTypeConfigRequest;
4753    /// use wkt::FieldMask;
4754    /// let x = UpdateInsightTypeConfigRequest::new().set_or_clear_update_mask(Some(FieldMask::default()/* use setters */));
4755    /// let x = UpdateInsightTypeConfigRequest::new().set_or_clear_update_mask(None::<FieldMask>);
4756    /// ```
4757    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4758    where
4759        T: std::convert::Into<wkt::FieldMask>,
4760    {
4761        self.update_mask = v.map(|x| x.into());
4762        self
4763    }
4764
4765    /// Sets the value of [validate_only][crate::model::UpdateInsightTypeConfigRequest::validate_only].
4766    ///
4767    /// # Example
4768    /// ```ignore,no_run
4769    /// # use google_cloud_recommender_v1::model::UpdateInsightTypeConfigRequest;
4770    /// let x = UpdateInsightTypeConfigRequest::new().set_validate_only(true);
4771    /// ```
4772    pub fn set_validate_only<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4773        self.validate_only = v.into();
4774        self
4775    }
4776}
4777
4778impl wkt::message::Message for UpdateInsightTypeConfigRequest {
4779    fn typename() -> &'static str {
4780        "type.googleapis.com/google.cloud.recommender.v1.UpdateInsightTypeConfigRequest"
4781    }
4782}