google-cloud-recommender-logging-v1 1.7.0

Google Cloud Client Libraries for Rust - Recommender API Logging
Documentation
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate bytes;
extern crate google_cloud_recommender_v1;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Log content of an action on a recommendation. This includes Mark* actions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ActionLog {
    /// Required. User that executed this action. Eg, foo@gmail.com
    pub actor: std::string::String,

    /// Required. State change that was made by the actor. Eg, SUCCEEDED.
    pub state: google_cloud_recommender_v1::model::recommendation_state_info::State,

    /// Optional. Metadata that was included with the action that was taken.
    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Name of the recommendation which was acted on. Eg, :
    /// 'projects/123/locations/global/recommenders/roleReco/recommendations/r1'
    pub recommendation_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ActionLog {
    /// Creates a new default instance.
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [actor][crate::model::ActionLog::actor].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_recommender_logging_v1::model::ActionLog;
    /// let x = ActionLog::new().set_actor("example");
    /// ```
    pub fn set_actor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.actor = v.into();
        self
    }

    /// Sets the value of [state][crate::model::ActionLog::state].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_recommender_logging_v1::model::ActionLog;
    /// use google_cloud_recommender_v1::model::recommendation_state_info::State;
    /// let x0 = ActionLog::new().set_state(State::Active);
    /// let x1 = ActionLog::new().set_state(State::Claimed);
    /// let x2 = ActionLog::new().set_state(State::Succeeded);
    /// ```
    pub fn set_state<
        T: std::convert::Into<google_cloud_recommender_v1::model::recommendation_state_info::State>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_metadata][crate::model::ActionLog::state_metadata].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_recommender_logging_v1::model::ActionLog;
    /// let x = ActionLog::new().set_state_metadata([
    ///     ("key0", "abc"),
    ///     ("key1", "xyz"),
    /// ]);
    /// ```
    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [recommendation_name][crate::model::ActionLog::recommendation_name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_recommender_logging_v1::model::ActionLog;
    /// let x = ActionLog::new().set_recommendation_name("example");
    /// ```
    pub fn set_recommendation_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.recommendation_name = v.into();
        self
    }
}

impl wkt::message::Message for ActionLog {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.recommender.logging.v1.ActionLog"
    }
}

/// Log content of an action on an insight. This includes Mark* actions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InsightActionLog {
    /// Required. User that executed this action. Eg, foo@gmail.com
    pub actor: std::string::String,

    /// Required. State change that was made by the actor. Eg, ACCEPTED.
    pub state: google_cloud_recommender_v1::model::insight_state_info::State,

    /// Optional. Metadata that was included with the action that was taken.
    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Name of the insight which was acted on. Eg, :
    /// 'projects/123/locations/global/insightTypes/roleInsight/insights/i1'
    pub insight: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl InsightActionLog {
    /// Creates a new default instance.
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [actor][crate::model::InsightActionLog::actor].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_recommender_logging_v1::model::InsightActionLog;
    /// let x = InsightActionLog::new().set_actor("example");
    /// ```
    pub fn set_actor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.actor = v.into();
        self
    }

    /// Sets the value of [state][crate::model::InsightActionLog::state].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_recommender_logging_v1::model::InsightActionLog;
    /// use google_cloud_recommender_v1::model::insight_state_info::State;
    /// let x0 = InsightActionLog::new().set_state(State::Active);
    /// let x1 = InsightActionLog::new().set_state(State::Accepted);
    /// let x2 = InsightActionLog::new().set_state(State::Dismissed);
    /// ```
    pub fn set_state<
        T: std::convert::Into<google_cloud_recommender_v1::model::insight_state_info::State>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_metadata][crate::model::InsightActionLog::state_metadata].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_recommender_logging_v1::model::InsightActionLog;
    /// let x = InsightActionLog::new().set_state_metadata([
    ///     ("key0", "abc"),
    ///     ("key1", "xyz"),
    /// ]);
    /// ```
    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [insight][crate::model::InsightActionLog::insight].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_recommender_logging_v1::model::InsightActionLog;
    /// let x = InsightActionLog::new().set_insight("example");
    /// ```
    pub fn set_insight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.insight = v.into();
        self
    }
}

impl wkt::message::Message for InsightActionLog {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.recommender.logging.v1.InsightActionLog"
    }
}