aws_sdk_evidently/types/_evaluation_rule.rs
1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <p>A structure that contains the information about an evaluation rule for this feature, if it is used in a launch or experiment.</p>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct EvaluationRule {
7 /// <p>The name of the experiment or launch.</p>
8 pub name: ::std::option::Option<::std::string::String>,
9 /// <p>This value is <code>aws.evidently.splits</code> if this is an evaluation rule for a launch, and it is <code>aws.evidently.onlineab</code> if this is an evaluation rule for an experiment.</p>
10 pub r#type: ::std::string::String,
11}
12impl EvaluationRule {
13 /// <p>The name of the experiment or launch.</p>
14 pub fn name(&self) -> ::std::option::Option<&str> {
15 self.name.as_deref()
16 }
17 /// <p>This value is <code>aws.evidently.splits</code> if this is an evaluation rule for a launch, and it is <code>aws.evidently.onlineab</code> if this is an evaluation rule for an experiment.</p>
18 pub fn r#type(&self) -> &str {
19 use std::ops::Deref;
20 self.r#type.deref()
21 }
22}
23impl EvaluationRule {
24 /// Creates a new builder-style object to manufacture [`EvaluationRule`](crate::types::EvaluationRule).
25 pub fn builder() -> crate::types::builders::EvaluationRuleBuilder {
26 crate::types::builders::EvaluationRuleBuilder::default()
27 }
28}
29
30/// A builder for [`EvaluationRule`](crate::types::EvaluationRule).
31#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
32#[non_exhaustive]
33pub struct EvaluationRuleBuilder {
34 pub(crate) name: ::std::option::Option<::std::string::String>,
35 pub(crate) r#type: ::std::option::Option<::std::string::String>,
36}
37impl EvaluationRuleBuilder {
38 /// <p>The name of the experiment or launch.</p>
39 pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
40 self.name = ::std::option::Option::Some(input.into());
41 self
42 }
43 /// <p>The name of the experiment or launch.</p>
44 pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
45 self.name = input;
46 self
47 }
48 /// <p>The name of the experiment or launch.</p>
49 pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
50 &self.name
51 }
52 /// <p>This value is <code>aws.evidently.splits</code> if this is an evaluation rule for a launch, and it is <code>aws.evidently.onlineab</code> if this is an evaluation rule for an experiment.</p>
53 /// This field is required.
54 pub fn r#type(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
55 self.r#type = ::std::option::Option::Some(input.into());
56 self
57 }
58 /// <p>This value is <code>aws.evidently.splits</code> if this is an evaluation rule for a launch, and it is <code>aws.evidently.onlineab</code> if this is an evaluation rule for an experiment.</p>
59 pub fn set_type(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
60 self.r#type = input;
61 self
62 }
63 /// <p>This value is <code>aws.evidently.splits</code> if this is an evaluation rule for a launch, and it is <code>aws.evidently.onlineab</code> if this is an evaluation rule for an experiment.</p>
64 pub fn get_type(&self) -> &::std::option::Option<::std::string::String> {
65 &self.r#type
66 }
67 /// Consumes the builder and constructs a [`EvaluationRule`](crate::types::EvaluationRule).
68 /// This method will fail if any of the following fields are not set:
69 /// - [`r#type`](crate::types::builders::EvaluationRuleBuilder::type)
70 pub fn build(self) -> ::std::result::Result<crate::types::EvaluationRule, ::aws_smithy_types::error::operation::BuildError> {
71 ::std::result::Result::Ok(crate::types::EvaluationRule {
72 name: self.name,
73 r#type: self.r#type.ok_or_else(|| {
74 ::aws_smithy_types::error::operation::BuildError::missing_field(
75 "r#type",
76 "r#type was not specified but it is required when building EvaluationRule",
77 )
78 })?,
79 })
80 }
81}