1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>This structure defines a metric that is being used to evaluate the variations during a launch or experiment.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct MetricDefinition {
/// <p>The name of the metric.</p>
pub name: ::std::option::Option<::std::string::String>,
/// <p>The entity, such as a user or session, that does an action that causes a metric value to be recorded.</p>
pub entity_id_key: ::std::option::Option<::std::string::String>,
/// <p>The value that is tracked to produce the metric.</p>
pub value_key: ::std::option::Option<::std::string::String>,
/// <p>The EventBridge event pattern that defines how the metric is recorded.</p>
/// <p>For more information about EventBridge event patterns, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a>.</p>
pub event_pattern: ::std::option::Option<::std::string::String>,
/// <p>The label for the units that the metric is measuring.</p>
pub unit_label: ::std::option::Option<::std::string::String>,
}
impl MetricDefinition {
/// <p>The name of the metric.</p>
pub fn name(&self) -> ::std::option::Option<&str> {
self.name.as_deref()
}
/// <p>The entity, such as a user or session, that does an action that causes a metric value to be recorded.</p>
pub fn entity_id_key(&self) -> ::std::option::Option<&str> {
self.entity_id_key.as_deref()
}
/// <p>The value that is tracked to produce the metric.</p>
pub fn value_key(&self) -> ::std::option::Option<&str> {
self.value_key.as_deref()
}
/// <p>The EventBridge event pattern that defines how the metric is recorded.</p>
/// <p>For more information about EventBridge event patterns, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a>.</p>
pub fn event_pattern(&self) -> ::std::option::Option<&str> {
self.event_pattern.as_deref()
}
/// <p>The label for the units that the metric is measuring.</p>
pub fn unit_label(&self) -> ::std::option::Option<&str> {
self.unit_label.as_deref()
}
}
impl MetricDefinition {
/// Creates a new builder-style object to manufacture [`MetricDefinition`](crate::types::MetricDefinition).
pub fn builder() -> crate::types::builders::MetricDefinitionBuilder {
crate::types::builders::MetricDefinitionBuilder::default()
}
}
/// A builder for [`MetricDefinition`](crate::types::MetricDefinition).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct MetricDefinitionBuilder {
pub(crate) name: ::std::option::Option<::std::string::String>,
pub(crate) entity_id_key: ::std::option::Option<::std::string::String>,
pub(crate) value_key: ::std::option::Option<::std::string::String>,
pub(crate) event_pattern: ::std::option::Option<::std::string::String>,
pub(crate) unit_label: ::std::option::Option<::std::string::String>,
}
impl MetricDefinitionBuilder {
/// <p>The name of the metric.</p>
pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.name = ::std::option::Option::Some(input.into());
self
}
/// <p>The name of the metric.</p>
pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.name = input;
self
}
/// <p>The name of the metric.</p>
pub fn get_name(&self) -> &::std::option::Option<::std::string::String> {
&self.name
}
/// <p>The entity, such as a user or session, that does an action that causes a metric value to be recorded.</p>
pub fn entity_id_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.entity_id_key = ::std::option::Option::Some(input.into());
self
}
/// <p>The entity, such as a user or session, that does an action that causes a metric value to be recorded.</p>
pub fn set_entity_id_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.entity_id_key = input;
self
}
/// <p>The entity, such as a user or session, that does an action that causes a metric value to be recorded.</p>
pub fn get_entity_id_key(&self) -> &::std::option::Option<::std::string::String> {
&self.entity_id_key
}
/// <p>The value that is tracked to produce the metric.</p>
pub fn value_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.value_key = ::std::option::Option::Some(input.into());
self
}
/// <p>The value that is tracked to produce the metric.</p>
pub fn set_value_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.value_key = input;
self
}
/// <p>The value that is tracked to produce the metric.</p>
pub fn get_value_key(&self) -> &::std::option::Option<::std::string::String> {
&self.value_key
}
/// <p>The EventBridge event pattern that defines how the metric is recorded.</p>
/// <p>For more information about EventBridge event patterns, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a>.</p>
pub fn event_pattern(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.event_pattern = ::std::option::Option::Some(input.into());
self
}
/// <p>The EventBridge event pattern that defines how the metric is recorded.</p>
/// <p>For more information about EventBridge event patterns, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a>.</p>
pub fn set_event_pattern(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.event_pattern = input;
self
}
/// <p>The EventBridge event pattern that defines how the metric is recorded.</p>
/// <p>For more information about EventBridge event patterns, see <a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html">Amazon EventBridge event patterns</a>.</p>
pub fn get_event_pattern(&self) -> &::std::option::Option<::std::string::String> {
&self.event_pattern
}
/// <p>The label for the units that the metric is measuring.</p>
pub fn unit_label(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
self.unit_label = ::std::option::Option::Some(input.into());
self
}
/// <p>The label for the units that the metric is measuring.</p>
pub fn set_unit_label(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
self.unit_label = input;
self
}
/// <p>The label for the units that the metric is measuring.</p>
pub fn get_unit_label(&self) -> &::std::option::Option<::std::string::String> {
&self.unit_label
}
/// Consumes the builder and constructs a [`MetricDefinition`](crate::types::MetricDefinition).
pub fn build(self) -> crate::types::MetricDefinition {
crate::types::MetricDefinition {
name: self.name,
entity_id_key: self.entity_id_key,
value_key: self.value_key,
event_pattern: self.event_pattern,
unit_label: self.unit_label,
}
}
}