#[non_exhaustive]pub struct Control {
pub name: String,
pub display_name: String,
pub associated_serving_config_ids: Vec<String>,
pub solution_type: SolutionType,
pub use_cases: Vec<SearchUseCase>,
pub conditions: Vec<Condition>,
pub action: Option<Action>,
/* private fields */
}control-service only.Expand description
Defines a conditioned behavior to employ during serving.
Must be attached to a
ServingConfig to be
considered at serving time. Permitted actions dependent on SolutionType.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringImmutable. Fully qualified name
projects/*/locations/global/dataStore/*/controls/*
display_name: StringRequired. Human readable name. The identifier used in UI views.
Must be UTF-8 encoded string. Length limit is 128 characters. Otherwise an INVALID ARGUMENT error is thrown.
associated_serving_config_ids: Vec<String>Output only. List of all ServingConfig IDs this control is attached to. May take up to 10 minutes to update after changes.
solution_type: SolutionTypeRequired. Immutable. What solution the control belongs to.
Must be compatible with vertical of resource. Otherwise an INVALID ARGUMENT error is thrown.
use_cases: Vec<SearchUseCase>Specifies the use case for the control. Affects what condition fields can be set. Only applies to SOLUTION_TYPE_SEARCH. Currently only allow one use case per control. Must be set when solution_type is SolutionType.SOLUTION_TYPE_SEARCH.
conditions: Vec<Condition>Determines when the associated action will trigger.
Omit to always apply the action. Currently only a single condition may be specified. Otherwise an INVALID ARGUMENT error is thrown.
action: Option<Action>Actions are restricted by Vertical and Solution
Required.
Implementations§
Source§impl Control
impl Control
pub fn new() -> Self
Sourcepub fn set_display_name<T: Into<String>>(self, v: T) -> Self
pub fn set_display_name<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_associated_serving_config_ids<T, V>(self, v: T) -> Self
pub fn set_associated_serving_config_ids<T, V>(self, v: T) -> Self
Sets the value of associated_serving_config_ids.
§Example
let x = Control::new().set_associated_serving_config_ids(["a", "b", "c"]);Sourcepub fn set_solution_type<T: Into<SolutionType>>(self, v: T) -> Self
pub fn set_solution_type<T: Into<SolutionType>>(self, v: T) -> Self
Sets the value of solution_type.
§Example
use google_cloud_discoveryengine_v1::model::SolutionType;
let x0 = Control::new().set_solution_type(SolutionType::Recommendation);
let x1 = Control::new().set_solution_type(SolutionType::Search);
let x2 = Control::new().set_solution_type(SolutionType::Chat);Sourcepub fn set_use_cases<T, V>(self, v: T) -> Self
pub fn set_use_cases<T, V>(self, v: T) -> Self
Sourcepub fn set_conditions<T, V>(self, v: T) -> Self
pub fn set_conditions<T, V>(self, v: T) -> Self
Sets the value of conditions.
§Example
use google_cloud_discoveryengine_v1::model::Condition;
let x = Control::new()
.set_conditions([
Condition::default()/* use setters */,
Condition::default()/* use (different) setters */,
]);Sourcepub fn set_action<T: Into<Option<Action>>>(self, v: T) -> Self
pub fn set_action<T: Into<Option<Action>>>(self, v: T) -> Self
Sets the value of action.
Note that all the setters affecting action are mutually
exclusive.
§Example
use google_cloud_discoveryengine_v1::model::control::BoostAction;
let x = Control::new().set_action(Some(
google_cloud_discoveryengine_v1::model::control::Action::BoostAction(BoostAction::default().into())));Sourcepub fn boost_action(&self) -> Option<&Box<BoostAction>>
pub fn boost_action(&self) -> Option<&Box<BoostAction>>
The value of action
if it holds a BoostAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_boost_action<T: Into<Box<BoostAction>>>(self, v: T) -> Self
pub fn set_boost_action<T: Into<Box<BoostAction>>>(self, v: T) -> Self
Sets the value of action
to hold a BoostAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_discoveryengine_v1::model::control::BoostAction;
let x = Control::new().set_boost_action(BoostAction::default()/* use setters */);
assert!(x.boost_action().is_some());
assert!(x.filter_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.synonyms_action().is_none());
assert!(x.promote_action().is_none());Sourcepub fn filter_action(&self) -> Option<&Box<FilterAction>>
pub fn filter_action(&self) -> Option<&Box<FilterAction>>
The value of action
if it holds a FilterAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_filter_action<T: Into<Box<FilterAction>>>(self, v: T) -> Self
pub fn set_filter_action<T: Into<Box<FilterAction>>>(self, v: T) -> Self
Sets the value of action
to hold a FilterAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_discoveryengine_v1::model::control::FilterAction;
let x = Control::new().set_filter_action(FilterAction::default()/* use setters */);
assert!(x.filter_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.synonyms_action().is_none());
assert!(x.promote_action().is_none());Sourcepub fn redirect_action(&self) -> Option<&Box<RedirectAction>>
pub fn redirect_action(&self) -> Option<&Box<RedirectAction>>
The value of action
if it holds a RedirectAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_redirect_action<T: Into<Box<RedirectAction>>>(self, v: T) -> Self
pub fn set_redirect_action<T: Into<Box<RedirectAction>>>(self, v: T) -> Self
Sets the value of action
to hold a RedirectAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_discoveryengine_v1::model::control::RedirectAction;
let x = Control::new().set_redirect_action(RedirectAction::default()/* use setters */);
assert!(x.redirect_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.synonyms_action().is_none());
assert!(x.promote_action().is_none());Sourcepub fn synonyms_action(&self) -> Option<&Box<SynonymsAction>>
pub fn synonyms_action(&self) -> Option<&Box<SynonymsAction>>
The value of action
if it holds a SynonymsAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_synonyms_action<T: Into<Box<SynonymsAction>>>(self, v: T) -> Self
pub fn set_synonyms_action<T: Into<Box<SynonymsAction>>>(self, v: T) -> Self
Sets the value of action
to hold a SynonymsAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_discoveryengine_v1::model::control::SynonymsAction;
let x = Control::new().set_synonyms_action(SynonymsAction::default()/* use setters */);
assert!(x.synonyms_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.promote_action().is_none());Sourcepub fn promote_action(&self) -> Option<&Box<PromoteAction>>
pub fn promote_action(&self) -> Option<&Box<PromoteAction>>
The value of action
if it holds a PromoteAction, None if the field is not set or
holds a different branch.
Sourcepub fn set_promote_action<T: Into<Box<PromoteAction>>>(self, v: T) -> Self
pub fn set_promote_action<T: Into<Box<PromoteAction>>>(self, v: T) -> Self
Sets the value of action
to hold a PromoteAction.
Note that all the setters affecting action are
mutually exclusive.
§Example
use google_cloud_discoveryengine_v1::model::control::PromoteAction;
let x = Control::new().set_promote_action(PromoteAction::default()/* use setters */);
assert!(x.promote_action().is_some());
assert!(x.boost_action().is_none());
assert!(x.filter_action().is_none());
assert!(x.redirect_action().is_none());
assert!(x.synonyms_action().is_none());