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