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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p>Describes a load-based auto scaling upscaling or downscaling threshold configuration, which specifies when AWS OpsWorks Stacks starts or stops load-based instances.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct AutoScalingThresholds {
/// <p>The number of instances to add or remove when the load exceeds a threshold.</p>
pub instance_count: ::std::option::Option<i32>,
/// <p>The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.</p>
pub thresholds_wait_time: ::std::option::Option<i32>,
/// <p>The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks Stacks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks Stacks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. <code>IgnoreMetricsTime</code> allows you to direct AWS OpsWorks Stacks to suppress scaling events long enough to get the new instances online.</p>
pub ignore_metrics_time: ::std::option::Option<i32>,
/// <p>The CPU utilization threshold, as a percent of the available CPU. A value of -1 disables the threshold.</p>
pub cpu_threshold: ::std::option::Option<f64>,
/// <p>The memory utilization threshold, as a percent of the available memory. A value of -1 disables the threshold.</p>
pub memory_threshold: ::std::option::Option<f64>,
/// <p>The load threshold. A value of -1 disables the threshold. For more information about how load is computed, see <a href="http://en.wikipedia.org/wiki/Load_%28computing%29">Load (computing)</a>.</p>
pub load_threshold: ::std::option::Option<f64>,
/// <p>Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack.</p><note>
/// <p>To use custom alarms, you must update your service role to allow <code>cloudwatch:DescribeAlarms</code>. You can either have AWS OpsWorks Stacks update the role for you when you first use this feature or you can edit the role manually. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-servicerole.html">Allowing AWS OpsWorks Stacks to Act on Your Behalf</a>.</p>
/// </note>
pub alarms: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl AutoScalingThresholds {
/// <p>The number of instances to add or remove when the load exceeds a threshold.</p>
pub fn instance_count(&self) -> ::std::option::Option<i32> {
self.instance_count
}
/// <p>The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.</p>
pub fn thresholds_wait_time(&self) -> ::std::option::Option<i32> {
self.thresholds_wait_time
}
/// <p>The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks Stacks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks Stacks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. <code>IgnoreMetricsTime</code> allows you to direct AWS OpsWorks Stacks to suppress scaling events long enough to get the new instances online.</p>
pub fn ignore_metrics_time(&self) -> ::std::option::Option<i32> {
self.ignore_metrics_time
}
/// <p>The CPU utilization threshold, as a percent of the available CPU. A value of -1 disables the threshold.</p>
pub fn cpu_threshold(&self) -> ::std::option::Option<f64> {
self.cpu_threshold
}
/// <p>The memory utilization threshold, as a percent of the available memory. A value of -1 disables the threshold.</p>
pub fn memory_threshold(&self) -> ::std::option::Option<f64> {
self.memory_threshold
}
/// <p>The load threshold. A value of -1 disables the threshold. For more information about how load is computed, see <a href="http://en.wikipedia.org/wiki/Load_%28computing%29">Load (computing)</a>.</p>
pub fn load_threshold(&self) -> ::std::option::Option<f64> {
self.load_threshold
}
/// <p>Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack.</p><note>
/// <p>To use custom alarms, you must update your service role to allow <code>cloudwatch:DescribeAlarms</code>. You can either have AWS OpsWorks Stacks update the role for you when you first use this feature or you can edit the role manually. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-servicerole.html">Allowing AWS OpsWorks Stacks to Act on Your Behalf</a>.</p>
/// </note>
///
/// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.alarms.is_none()`.
pub fn alarms(&self) -> &[::std::string::String] {
self.alarms.as_deref().unwrap_or_default()
}
}
impl AutoScalingThresholds {
/// Creates a new builder-style object to manufacture [`AutoScalingThresholds`](crate::types::AutoScalingThresholds).
pub fn builder() -> crate::types::builders::AutoScalingThresholdsBuilder {
crate::types::builders::AutoScalingThresholdsBuilder::default()
}
}
/// A builder for [`AutoScalingThresholds`](crate::types::AutoScalingThresholds).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct AutoScalingThresholdsBuilder {
pub(crate) instance_count: ::std::option::Option<i32>,
pub(crate) thresholds_wait_time: ::std::option::Option<i32>,
pub(crate) ignore_metrics_time: ::std::option::Option<i32>,
pub(crate) cpu_threshold: ::std::option::Option<f64>,
pub(crate) memory_threshold: ::std::option::Option<f64>,
pub(crate) load_threshold: ::std::option::Option<f64>,
pub(crate) alarms: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
}
impl AutoScalingThresholdsBuilder {
/// <p>The number of instances to add or remove when the load exceeds a threshold.</p>
pub fn instance_count(mut self, input: i32) -> Self {
self.instance_count = ::std::option::Option::Some(input);
self
}
/// <p>The number of instances to add or remove when the load exceeds a threshold.</p>
pub fn set_instance_count(mut self, input: ::std::option::Option<i32>) -> Self {
self.instance_count = input;
self
}
/// <p>The number of instances to add or remove when the load exceeds a threshold.</p>
pub fn get_instance_count(&self) -> &::std::option::Option<i32> {
&self.instance_count
}
/// <p>The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.</p>
pub fn thresholds_wait_time(mut self, input: i32) -> Self {
self.thresholds_wait_time = ::std::option::Option::Some(input);
self
}
/// <p>The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.</p>
pub fn set_thresholds_wait_time(mut self, input: ::std::option::Option<i32>) -> Self {
self.thresholds_wait_time = input;
self
}
/// <p>The amount of time, in minutes, that the load must exceed a threshold before more instances are added or removed.</p>
pub fn get_thresholds_wait_time(&self) -> &::std::option::Option<i32> {
&self.thresholds_wait_time
}
/// <p>The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks Stacks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks Stacks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. <code>IgnoreMetricsTime</code> allows you to direct AWS OpsWorks Stacks to suppress scaling events long enough to get the new instances online.</p>
pub fn ignore_metrics_time(mut self, input: i32) -> Self {
self.ignore_metrics_time = ::std::option::Option::Some(input);
self
}
/// <p>The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks Stacks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks Stacks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. <code>IgnoreMetricsTime</code> allows you to direct AWS OpsWorks Stacks to suppress scaling events long enough to get the new instances online.</p>
pub fn set_ignore_metrics_time(mut self, input: ::std::option::Option<i32>) -> Self {
self.ignore_metrics_time = input;
self
}
/// <p>The amount of time (in minutes) after a scaling event occurs that AWS OpsWorks Stacks should ignore metrics and suppress additional scaling events. For example, AWS OpsWorks Stacks adds new instances following an upscaling event but the instances won't start reducing the load until they have been booted and configured. There is no point in raising additional scaling events during that operation, which typically takes several minutes. <code>IgnoreMetricsTime</code> allows you to direct AWS OpsWorks Stacks to suppress scaling events long enough to get the new instances online.</p>
pub fn get_ignore_metrics_time(&self) -> &::std::option::Option<i32> {
&self.ignore_metrics_time
}
/// <p>The CPU utilization threshold, as a percent of the available CPU. A value of -1 disables the threshold.</p>
pub fn cpu_threshold(mut self, input: f64) -> Self {
self.cpu_threshold = ::std::option::Option::Some(input);
self
}
/// <p>The CPU utilization threshold, as a percent of the available CPU. A value of -1 disables the threshold.</p>
pub fn set_cpu_threshold(mut self, input: ::std::option::Option<f64>) -> Self {
self.cpu_threshold = input;
self
}
/// <p>The CPU utilization threshold, as a percent of the available CPU. A value of -1 disables the threshold.</p>
pub fn get_cpu_threshold(&self) -> &::std::option::Option<f64> {
&self.cpu_threshold
}
/// <p>The memory utilization threshold, as a percent of the available memory. A value of -1 disables the threshold.</p>
pub fn memory_threshold(mut self, input: f64) -> Self {
self.memory_threshold = ::std::option::Option::Some(input);
self
}
/// <p>The memory utilization threshold, as a percent of the available memory. A value of -1 disables the threshold.</p>
pub fn set_memory_threshold(mut self, input: ::std::option::Option<f64>) -> Self {
self.memory_threshold = input;
self
}
/// <p>The memory utilization threshold, as a percent of the available memory. A value of -1 disables the threshold.</p>
pub fn get_memory_threshold(&self) -> &::std::option::Option<f64> {
&self.memory_threshold
}
/// <p>The load threshold. A value of -1 disables the threshold. For more information about how load is computed, see <a href="http://en.wikipedia.org/wiki/Load_%28computing%29">Load (computing)</a>.</p>
pub fn load_threshold(mut self, input: f64) -> Self {
self.load_threshold = ::std::option::Option::Some(input);
self
}
/// <p>The load threshold. A value of -1 disables the threshold. For more information about how load is computed, see <a href="http://en.wikipedia.org/wiki/Load_%28computing%29">Load (computing)</a>.</p>
pub fn set_load_threshold(mut self, input: ::std::option::Option<f64>) -> Self {
self.load_threshold = input;
self
}
/// <p>The load threshold. A value of -1 disables the threshold. For more information about how load is computed, see <a href="http://en.wikipedia.org/wiki/Load_%28computing%29">Load (computing)</a>.</p>
pub fn get_load_threshold(&self) -> &::std::option::Option<f64> {
&self.load_threshold
}
/// Appends an item to `alarms`.
///
/// To override the contents of this collection use [`set_alarms`](Self::set_alarms).
///
/// <p>Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack.</p><note>
/// <p>To use custom alarms, you must update your service role to allow <code>cloudwatch:DescribeAlarms</code>. You can either have AWS OpsWorks Stacks update the role for you when you first use this feature or you can edit the role manually. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-servicerole.html">Allowing AWS OpsWorks Stacks to Act on Your Behalf</a>.</p>
/// </note>
pub fn alarms(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
let mut v = self.alarms.unwrap_or_default();
v.push(input.into());
self.alarms = ::std::option::Option::Some(v);
self
}
/// <p>Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack.</p><note>
/// <p>To use custom alarms, you must update your service role to allow <code>cloudwatch:DescribeAlarms</code>. You can either have AWS OpsWorks Stacks update the role for you when you first use this feature or you can edit the role manually. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-servicerole.html">Allowing AWS OpsWorks Stacks to Act on Your Behalf</a>.</p>
/// </note>
pub fn set_alarms(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
self.alarms = input;
self
}
/// <p>Custom Cloudwatch auto scaling alarms, to be used as thresholds. This parameter takes a list of up to five alarm names, which are case sensitive and must be in the same region as the stack.</p><note>
/// <p>To use custom alarms, you must update your service role to allow <code>cloudwatch:DescribeAlarms</code>. You can either have AWS OpsWorks Stacks update the role for you when you first use this feature or you can edit the role manually. For more information, see <a href="https://docs.aws.amazon.com/opsworks/latest/userguide/opsworks-security-servicerole.html">Allowing AWS OpsWorks Stacks to Act on Your Behalf</a>.</p>
/// </note>
pub fn get_alarms(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
&self.alarms
}
/// Consumes the builder and constructs a [`AutoScalingThresholds`](crate::types::AutoScalingThresholds).
pub fn build(self) -> crate::types::AutoScalingThresholds {
crate::types::AutoScalingThresholds {
instance_count: self.instance_count,
thresholds_wait_time: self.thresholds_wait_time,
ignore_metrics_time: self.ignore_metrics_time,
cpu_threshold: self.cpu_threshold,
memory_threshold: self.memory_threshold,
load_threshold: self.load_threshold,
alarms: self.alarms,
}
}
}