aws_sdk_evidently/operation/evaluate_feature/builders.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2pub use crate::operation::evaluate_feature::_evaluate_feature_output::EvaluateFeatureOutputBuilder;
3
4pub use crate::operation::evaluate_feature::_evaluate_feature_input::EvaluateFeatureInputBuilder;
5
6impl crate::operation::evaluate_feature::builders::EvaluateFeatureInputBuilder {
7 /// Sends a request with this input using the given client.
8 pub async fn send_with(
9 self,
10 client: &crate::Client,
11 ) -> ::std::result::Result<
12 crate::operation::evaluate_feature::EvaluateFeatureOutput,
13 ::aws_smithy_runtime_api::client::result::SdkError<
14 crate::operation::evaluate_feature::EvaluateFeatureError,
15 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
16 >,
17 > {
18 let mut fluent_builder = client.evaluate_feature();
19 fluent_builder.inner = self;
20 fluent_builder.send().await
21 }
22}
23/// Fluent builder constructing a request to `EvaluateFeature`.
24///
25/// <p>This operation assigns a feature variation to one given user session. You pass in an <code>entityID</code> that represents the user. Evidently then checks the evaluation rules and assigns the variation.</p>
26/// <p>The first rules that are evaluated are the override rules. If the user's <code>entityID</code> matches an override rule, the user is served the variation specified by that rule.</p>
27/// <p>If there is a current launch with this feature that uses segment overrides, and if the user session's <code>evaluationContext</code> matches a segment rule defined in a segment override, the configuration in the segment overrides is used. For more information about segments, see <a href="https://docs.aws.amazon.com/cloudwatchevidently/latest/APIReference/API_CreateSegment.html">CreateSegment</a> and <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html">Use segments to focus your audience</a>.</p>
28/// <p>If there is a launch with no segment overrides, the user might be assigned to a variation in the launch. The chance of this depends on the percentage of users that are allocated to that launch. If the user is enrolled in the launch, the variation they are served depends on the allocation of the various feature variations used for the launch.</p>
29/// <p>If the user is not assigned to a launch, and there is an ongoing experiment for this feature, the user might be assigned to a variation in the experiment. The chance of this depends on the percentage of users that are allocated to that experiment.</p>
30/// <p>If the experiment uses a segment, then only user sessions with <code>evaluationContext</code> values that match the segment rule are used in the experiment.</p>
31/// <p>If the user is enrolled in the experiment, the variation they are served depends on the allocation of the various feature variations used for the experiment.</p>
32/// <p>If the user is not assigned to a launch or experiment, they are served the default variation.</p>
33#[derive(::std::clone::Clone, ::std::fmt::Debug)]
34pub struct EvaluateFeatureFluentBuilder {
35 handle: ::std::sync::Arc<crate::client::Handle>,
36 inner: crate::operation::evaluate_feature::builders::EvaluateFeatureInputBuilder,
37 config_override: ::std::option::Option<crate::config::Builder>,
38}
39impl
40 crate::client::customize::internal::CustomizableSend<
41 crate::operation::evaluate_feature::EvaluateFeatureOutput,
42 crate::operation::evaluate_feature::EvaluateFeatureError,
43 > for EvaluateFeatureFluentBuilder
44{
45 fn send(
46 self,
47 config_override: crate::config::Builder,
48 ) -> crate::client::customize::internal::BoxFuture<
49 crate::client::customize::internal::SendResult<
50 crate::operation::evaluate_feature::EvaluateFeatureOutput,
51 crate::operation::evaluate_feature::EvaluateFeatureError,
52 >,
53 > {
54 ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await })
55 }
56}
57impl EvaluateFeatureFluentBuilder {
58 /// Creates a new `EvaluateFeatureFluentBuilder`.
59 pub(crate) fn new(handle: ::std::sync::Arc<crate::client::Handle>) -> Self {
60 Self {
61 handle,
62 inner: ::std::default::Default::default(),
63 config_override: ::std::option::Option::None,
64 }
65 }
66 /// Access the EvaluateFeature as a reference.
67 pub fn as_input(&self) -> &crate::operation::evaluate_feature::builders::EvaluateFeatureInputBuilder {
68 &self.inner
69 }
70 /// Sends the request and returns the response.
71 ///
72 /// If an error occurs, an `SdkError` will be returned with additional details that
73 /// can be matched against.
74 ///
75 /// By default, any retryable failures will be retried twice. Retry behavior
76 /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be
77 /// set when configuring the client.
78 pub async fn send(
79 self,
80 ) -> ::std::result::Result<
81 crate::operation::evaluate_feature::EvaluateFeatureOutput,
82 ::aws_smithy_runtime_api::client::result::SdkError<
83 crate::operation::evaluate_feature::EvaluateFeatureError,
84 ::aws_smithy_runtime_api::client::orchestrator::HttpResponse,
85 >,
86 > {
87 let input = self
88 .inner
89 .build()
90 .map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?;
91 let runtime_plugins = crate::operation::evaluate_feature::EvaluateFeature::operation_runtime_plugins(
92 self.handle.runtime_plugins.clone(),
93 &self.handle.conf,
94 self.config_override,
95 );
96 crate::operation::evaluate_feature::EvaluateFeature::orchestrate(&runtime_plugins, input).await
97 }
98
99 /// Consumes this builder, creating a customizable operation that can be modified before being sent.
100 pub fn customize(
101 self,
102 ) -> crate::client::customize::CustomizableOperation<
103 crate::operation::evaluate_feature::EvaluateFeatureOutput,
104 crate::operation::evaluate_feature::EvaluateFeatureError,
105 Self,
106 > {
107 crate::client::customize::CustomizableOperation::new(self)
108 }
109 pub(crate) fn config_override(mut self, config_override: impl ::std::convert::Into<crate::config::Builder>) -> Self {
110 self.set_config_override(::std::option::Option::Some(config_override.into()));
111 self
112 }
113
114 pub(crate) fn set_config_override(&mut self, config_override: ::std::option::Option<crate::config::Builder>) -> &mut Self {
115 self.config_override = config_override;
116 self
117 }
118 /// <p>The name or ARN of the project that contains this feature.</p>
119 pub fn project(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
120 self.inner = self.inner.project(input.into());
121 self
122 }
123 /// <p>The name or ARN of the project that contains this feature.</p>
124 pub fn set_project(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
125 self.inner = self.inner.set_project(input);
126 self
127 }
128 /// <p>The name or ARN of the project that contains this feature.</p>
129 pub fn get_project(&self) -> &::std::option::Option<::std::string::String> {
130 self.inner.get_project()
131 }
132 /// <p>The name of the feature being evaluated.</p>
133 pub fn feature(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
134 self.inner = self.inner.feature(input.into());
135 self
136 }
137 /// <p>The name of the feature being evaluated.</p>
138 pub fn set_feature(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
139 self.inner = self.inner.set_feature(input);
140 self
141 }
142 /// <p>The name of the feature being evaluated.</p>
143 pub fn get_feature(&self) -> &::std::option::Option<::std::string::String> {
144 self.inner.get_feature()
145 }
146 /// <p>An internal ID that represents a unique user of the application. This <code>entityID</code> is checked against any override rules assigned for this feature.</p>
147 pub fn entity_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
148 self.inner = self.inner.entity_id(input.into());
149 self
150 }
151 /// <p>An internal ID that represents a unique user of the application. This <code>entityID</code> is checked against any override rules assigned for this feature.</p>
152 pub fn set_entity_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
153 self.inner = self.inner.set_entity_id(input);
154 self
155 }
156 /// <p>An internal ID that represents a unique user of the application. This <code>entityID</code> is checked against any override rules assigned for this feature.</p>
157 pub fn get_entity_id(&self) -> &::std::option::Option<::std::string::String> {
158 self.inner.get_entity_id()
159 }
160 /// <p>A JSON object of attributes that you can optionally pass in as part of the evaluation event sent to Evidently from the user session. Evidently can use this value to match user sessions with defined audience segments. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html">Use segments to focus your audience</a>.</p>
161 /// <p>If you include this parameter, the value must be a JSON object. A JSON array is not supported.</p>
162 pub fn evaluation_context(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
163 self.inner = self.inner.evaluation_context(input.into());
164 self
165 }
166 /// <p>A JSON object of attributes that you can optionally pass in as part of the evaluation event sent to Evidently from the user session. Evidently can use this value to match user sessions with defined audience segments. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html">Use segments to focus your audience</a>.</p>
167 /// <p>If you include this parameter, the value must be a JSON object. A JSON array is not supported.</p>
168 pub fn set_evaluation_context(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
169 self.inner = self.inner.set_evaluation_context(input);
170 self
171 }
172 /// <p>A JSON object of attributes that you can optionally pass in as part of the evaluation event sent to Evidently from the user session. Evidently can use this value to match user sessions with defined audience segments. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Evidently-segments.html">Use segments to focus your audience</a>.</p>
173 /// <p>If you include this parameter, the value must be a JSON object. A JSON array is not supported.</p>
174 pub fn get_evaluation_context(&self) -> &::std::option::Option<::std::string::String> {
175 self.inner.get_evaluation_context()
176 }
177}