-
Notifications
You must be signed in to change notification settings - Fork 242
/
_service_configuration.rs
172 lines (170 loc) · 10.8 KB
/
_service_configuration.rs
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
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// <p> The Amazon ECS service configurations used for recommendations. </p>
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)]
pub struct ServiceConfiguration {
/// <p> The amount of memory used by the tasks in the ECS service. </p>
#[doc(hidden)]
pub memory: std::option::Option<i32>,
/// <p> The number of CPU units used by the tasks in the ECS service. </p>
#[doc(hidden)]
pub cpu: std::option::Option<i32>,
/// <p> The container configurations within a task of an ECS service. </p>
#[doc(hidden)]
pub container_configurations:
std::option::Option<std::vec::Vec<crate::types::ContainerConfiguration>>,
/// <p> Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated recommendations. For example, if Auto Scaling is configured on a ECS service’s CPU, then Compute Optimizer doesn’t generate CPU size recommendations. </p>
/// <p>The Auto Scaling configuration methods include:</p>
/// <ul>
/// <li> <p> <code>TARGET_TRACKING_SCALING_CPU</code> — If the ECS service is configured to use target scaling on CPU, Compute Optimizer doesn't generate CPU recommendations.</p> </li>
/// <li> <p> <code>TARGET_TRACKING_SCALING_MEMORY</code> — If the ECS service is configured to use target scaling on memory, Compute Optimizer doesn't generate memory recommendations.</p> </li>
/// </ul>
/// <p>For more information about step scaling and target scaling, see <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-step-scaling-policies.html"> Step scaling policies for Application Auto Scaling</a> and <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking.html"> Target tracking scaling policies for Application Auto Scaling</a> in the <i>Application Auto Scaling User Guide</i>.</p>
#[doc(hidden)]
pub auto_scaling_configuration: std::option::Option<crate::types::AutoScalingConfiguration>,
/// <p> The task definition ARN used by the tasks in the ECS service. </p>
#[doc(hidden)]
pub task_definition_arn: std::option::Option<std::string::String>,
}
impl ServiceConfiguration {
/// <p> The amount of memory used by the tasks in the ECS service. </p>
pub fn memory(&self) -> std::option::Option<i32> {
self.memory
}
/// <p> The number of CPU units used by the tasks in the ECS service. </p>
pub fn cpu(&self) -> std::option::Option<i32> {
self.cpu
}
/// <p> The container configurations within a task of an ECS service. </p>
pub fn container_configurations(
&self,
) -> std::option::Option<&[crate::types::ContainerConfiguration]> {
self.container_configurations.as_deref()
}
/// <p> Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated recommendations. For example, if Auto Scaling is configured on a ECS service’s CPU, then Compute Optimizer doesn’t generate CPU size recommendations. </p>
/// <p>The Auto Scaling configuration methods include:</p>
/// <ul>
/// <li> <p> <code>TARGET_TRACKING_SCALING_CPU</code> — If the ECS service is configured to use target scaling on CPU, Compute Optimizer doesn't generate CPU recommendations.</p> </li>
/// <li> <p> <code>TARGET_TRACKING_SCALING_MEMORY</code> — If the ECS service is configured to use target scaling on memory, Compute Optimizer doesn't generate memory recommendations.</p> </li>
/// </ul>
/// <p>For more information about step scaling and target scaling, see <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-step-scaling-policies.html"> Step scaling policies for Application Auto Scaling</a> and <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking.html"> Target tracking scaling policies for Application Auto Scaling</a> in the <i>Application Auto Scaling User Guide</i>.</p>
pub fn auto_scaling_configuration(
&self,
) -> std::option::Option<&crate::types::AutoScalingConfiguration> {
self.auto_scaling_configuration.as_ref()
}
/// <p> The task definition ARN used by the tasks in the ECS service. </p>
pub fn task_definition_arn(&self) -> std::option::Option<&str> {
self.task_definition_arn.as_deref()
}
}
impl ServiceConfiguration {
/// Creates a new builder-style object to manufacture [`ServiceConfiguration`](crate::types::ServiceConfiguration).
pub fn builder() -> crate::types::builders::ServiceConfigurationBuilder {
crate::types::builders::ServiceConfigurationBuilder::default()
}
}
/// A builder for [`ServiceConfiguration`](crate::types::ServiceConfiguration).
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default, std::fmt::Debug)]
pub struct ServiceConfigurationBuilder {
pub(crate) memory: std::option::Option<i32>,
pub(crate) cpu: std::option::Option<i32>,
pub(crate) container_configurations:
std::option::Option<std::vec::Vec<crate::types::ContainerConfiguration>>,
pub(crate) auto_scaling_configuration:
std::option::Option<crate::types::AutoScalingConfiguration>,
pub(crate) task_definition_arn: std::option::Option<std::string::String>,
}
impl ServiceConfigurationBuilder {
/// <p> The amount of memory used by the tasks in the ECS service. </p>
pub fn memory(mut self, input: i32) -> Self {
self.memory = Some(input);
self
}
/// <p> The amount of memory used by the tasks in the ECS service. </p>
pub fn set_memory(mut self, input: std::option::Option<i32>) -> Self {
self.memory = input;
self
}
/// <p> The number of CPU units used by the tasks in the ECS service. </p>
pub fn cpu(mut self, input: i32) -> Self {
self.cpu = Some(input);
self
}
/// <p> The number of CPU units used by the tasks in the ECS service. </p>
pub fn set_cpu(mut self, input: std::option::Option<i32>) -> Self {
self.cpu = input;
self
}
/// Appends an item to `container_configurations`.
///
/// To override the contents of this collection use [`set_container_configurations`](Self::set_container_configurations).
///
/// <p> The container configurations within a task of an ECS service. </p>
pub fn container_configurations(mut self, input: crate::types::ContainerConfiguration) -> Self {
let mut v = self.container_configurations.unwrap_or_default();
v.push(input);
self.container_configurations = Some(v);
self
}
/// <p> The container configurations within a task of an ECS service. </p>
pub fn set_container_configurations(
mut self,
input: std::option::Option<std::vec::Vec<crate::types::ContainerConfiguration>>,
) -> Self {
self.container_configurations = input;
self
}
/// <p> Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated recommendations. For example, if Auto Scaling is configured on a ECS service’s CPU, then Compute Optimizer doesn’t generate CPU size recommendations. </p>
/// <p>The Auto Scaling configuration methods include:</p>
/// <ul>
/// <li> <p> <code>TARGET_TRACKING_SCALING_CPU</code> — If the ECS service is configured to use target scaling on CPU, Compute Optimizer doesn't generate CPU recommendations.</p> </li>
/// <li> <p> <code>TARGET_TRACKING_SCALING_MEMORY</code> — If the ECS service is configured to use target scaling on memory, Compute Optimizer doesn't generate memory recommendations.</p> </li>
/// </ul>
/// <p>For more information about step scaling and target scaling, see <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-step-scaling-policies.html"> Step scaling policies for Application Auto Scaling</a> and <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking.html"> Target tracking scaling policies for Application Auto Scaling</a> in the <i>Application Auto Scaling User Guide</i>.</p>
pub fn auto_scaling_configuration(
mut self,
input: crate::types::AutoScalingConfiguration,
) -> Self {
self.auto_scaling_configuration = Some(input);
self
}
/// <p> Describes the Auto Scaling configuration methods for an Amazon ECS service. This affects the generated recommendations. For example, if Auto Scaling is configured on a ECS service’s CPU, then Compute Optimizer doesn’t generate CPU size recommendations. </p>
/// <p>The Auto Scaling configuration methods include:</p>
/// <ul>
/// <li> <p> <code>TARGET_TRACKING_SCALING_CPU</code> — If the ECS service is configured to use target scaling on CPU, Compute Optimizer doesn't generate CPU recommendations.</p> </li>
/// <li> <p> <code>TARGET_TRACKING_SCALING_MEMORY</code> — If the ECS service is configured to use target scaling on memory, Compute Optimizer doesn't generate memory recommendations.</p> </li>
/// </ul>
/// <p>For more information about step scaling and target scaling, see <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-step-scaling-policies.html"> Step scaling policies for Application Auto Scaling</a> and <a href="https://docs.aws.amazon.com/autoscaling/application/userguide/application-auto-scaling-target-tracking.html"> Target tracking scaling policies for Application Auto Scaling</a> in the <i>Application Auto Scaling User Guide</i>.</p>
pub fn set_auto_scaling_configuration(
mut self,
input: std::option::Option<crate::types::AutoScalingConfiguration>,
) -> Self {
self.auto_scaling_configuration = input;
self
}
/// <p> The task definition ARN used by the tasks in the ECS service. </p>
pub fn task_definition_arn(mut self, input: impl Into<std::string::String>) -> Self {
self.task_definition_arn = Some(input.into());
self
}
/// <p> The task definition ARN used by the tasks in the ECS service. </p>
pub fn set_task_definition_arn(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.task_definition_arn = input;
self
}
/// Consumes the builder and constructs a [`ServiceConfiguration`](crate::types::ServiceConfiguration).
pub fn build(self) -> crate::types::ServiceConfiguration {
crate::types::ServiceConfiguration {
memory: self.memory,
cpu: self.cpu,
container_configurations: self.container_configurations,
auto_scaling_configuration: self.auto_scaling_configuration,
task_definition_arn: self.task_definition_arn,
}
}
}