Skip to main content

google_cloud_recommender_logging_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 bytes;
21extern crate google_cloud_recommender_v1;
22extern crate serde;
23extern crate serde_json;
24extern crate serde_with;
25extern crate std;
26extern crate wkt;
27
28mod debug;
29mod deserialize;
30mod serialize;
31
32/// Log content of an action on a recommendation. This includes Mark* actions.
33#[derive(Clone, Default, PartialEq)]
34#[non_exhaustive]
35pub struct ActionLog {
36    /// Required. User that executed this action. Eg, foo@gmail.com
37    pub actor: std::string::String,
38
39    /// Required. State change that was made by the actor. Eg, SUCCEEDED.
40    pub state: google_cloud_recommender_v1::model::recommendation_state_info::State,
41
42    /// Optional. Metadata that was included with the action that was taken.
43    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,
44
45    /// Required. Name of the recommendation which was acted on. Eg, :
46    /// 'projects/123/locations/global/recommenders/roleReco/recommendations/r1'
47    pub recommendation_name: std::string::String,
48
49    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
50}
51
52impl ActionLog {
53    /// Creates a new default instance.
54    pub fn new() -> Self {
55        std::default::Default::default()
56    }
57
58    /// Sets the value of [actor][crate::model::ActionLog::actor].
59    ///
60    /// # Example
61    /// ```ignore,no_run
62    /// # use google_cloud_recommender_logging_v1::model::ActionLog;
63    /// let x = ActionLog::new().set_actor("example");
64    /// ```
65    pub fn set_actor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
66        self.actor = v.into();
67        self
68    }
69
70    /// Sets the value of [state][crate::model::ActionLog::state].
71    ///
72    /// # Example
73    /// ```ignore,no_run
74    /// # use google_cloud_recommender_logging_v1::model::ActionLog;
75    /// use google_cloud_recommender_v1::model::recommendation_state_info::State;
76    /// let x0 = ActionLog::new().set_state(State::Active);
77    /// let x1 = ActionLog::new().set_state(State::Claimed);
78    /// let x2 = ActionLog::new().set_state(State::Succeeded);
79    /// ```
80    pub fn set_state<
81        T: std::convert::Into<google_cloud_recommender_v1::model::recommendation_state_info::State>,
82    >(
83        mut self,
84        v: T,
85    ) -> Self {
86        self.state = v.into();
87        self
88    }
89
90    /// Sets the value of [state_metadata][crate::model::ActionLog::state_metadata].
91    ///
92    /// # Example
93    /// ```ignore,no_run
94    /// # use google_cloud_recommender_logging_v1::model::ActionLog;
95    /// let x = ActionLog::new().set_state_metadata([
96    ///     ("key0", "abc"),
97    ///     ("key1", "xyz"),
98    /// ]);
99    /// ```
100    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
101    where
102        T: std::iter::IntoIterator<Item = (K, V)>,
103        K: std::convert::Into<std::string::String>,
104        V: std::convert::Into<std::string::String>,
105    {
106        use std::iter::Iterator;
107        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
108        self
109    }
110
111    /// Sets the value of [recommendation_name][crate::model::ActionLog::recommendation_name].
112    ///
113    /// # Example
114    /// ```ignore,no_run
115    /// # use google_cloud_recommender_logging_v1::model::ActionLog;
116    /// let x = ActionLog::new().set_recommendation_name("example");
117    /// ```
118    pub fn set_recommendation_name<T: std::convert::Into<std::string::String>>(
119        mut self,
120        v: T,
121    ) -> Self {
122        self.recommendation_name = v.into();
123        self
124    }
125}
126
127impl wkt::message::Message for ActionLog {
128    fn typename() -> &'static str {
129        "type.googleapis.com/google.cloud.recommender.logging.v1.ActionLog"
130    }
131}
132
133/// Log content of an action on an insight. This includes Mark* actions.
134#[derive(Clone, Default, PartialEq)]
135#[non_exhaustive]
136pub struct InsightActionLog {
137    /// Required. User that executed this action. Eg, foo@gmail.com
138    pub actor: std::string::String,
139
140    /// Required. State change that was made by the actor. Eg, ACCEPTED.
141    pub state: google_cloud_recommender_v1::model::insight_state_info::State,
142
143    /// Optional. Metadata that was included with the action that was taken.
144    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,
145
146    /// Required. Name of the insight which was acted on. Eg, :
147    /// 'projects/123/locations/global/insightTypes/roleInsight/insights/i1'
148    pub insight: std::string::String,
149
150    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
151}
152
153impl InsightActionLog {
154    /// Creates a new default instance.
155    pub fn new() -> Self {
156        std::default::Default::default()
157    }
158
159    /// Sets the value of [actor][crate::model::InsightActionLog::actor].
160    ///
161    /// # Example
162    /// ```ignore,no_run
163    /// # use google_cloud_recommender_logging_v1::model::InsightActionLog;
164    /// let x = InsightActionLog::new().set_actor("example");
165    /// ```
166    pub fn set_actor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
167        self.actor = v.into();
168        self
169    }
170
171    /// Sets the value of [state][crate::model::InsightActionLog::state].
172    ///
173    /// # Example
174    /// ```ignore,no_run
175    /// # use google_cloud_recommender_logging_v1::model::InsightActionLog;
176    /// use google_cloud_recommender_v1::model::insight_state_info::State;
177    /// let x0 = InsightActionLog::new().set_state(State::Active);
178    /// let x1 = InsightActionLog::new().set_state(State::Accepted);
179    /// let x2 = InsightActionLog::new().set_state(State::Dismissed);
180    /// ```
181    pub fn set_state<
182        T: std::convert::Into<google_cloud_recommender_v1::model::insight_state_info::State>,
183    >(
184        mut self,
185        v: T,
186    ) -> Self {
187        self.state = v.into();
188        self
189    }
190
191    /// Sets the value of [state_metadata][crate::model::InsightActionLog::state_metadata].
192    ///
193    /// # Example
194    /// ```ignore,no_run
195    /// # use google_cloud_recommender_logging_v1::model::InsightActionLog;
196    /// let x = InsightActionLog::new().set_state_metadata([
197    ///     ("key0", "abc"),
198    ///     ("key1", "xyz"),
199    /// ]);
200    /// ```
201    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
202    where
203        T: std::iter::IntoIterator<Item = (K, V)>,
204        K: std::convert::Into<std::string::String>,
205        V: std::convert::Into<std::string::String>,
206    {
207        use std::iter::Iterator;
208        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
209        self
210    }
211
212    /// Sets the value of [insight][crate::model::InsightActionLog::insight].
213    ///
214    /// # Example
215    /// ```ignore,no_run
216    /// # use google_cloud_recommender_logging_v1::model::InsightActionLog;
217    /// # let project_id = "project_id";
218    /// # let location_id = "location_id";
219    /// # let insight_type_id = "insight_type_id";
220    /// # let insight_id = "insight_id";
221    /// let x = InsightActionLog::new().set_insight(format!("projects/{project_id}/locations/{location_id}/insightTypes/{insight_type_id}/insights/{insight_id}"));
222    /// ```
223    pub fn set_insight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
224        self.insight = v.into();
225        self
226    }
227}
228
229impl wkt::message::Message for InsightActionLog {
230    fn typename() -> &'static str {
231        "type.googleapis.com/google.cloud.recommender.logging.v1.InsightActionLog"
232    }
233}