aws_lite_rs/types/ecs.rs
1//! Types for the Amazon Elastic Container Service API (v1).
2//!
3//! Auto-generated from the AWS Botocore Model.
4//! **Do not edit manually** — modify the manifest and re-run codegen.
5
6use serde::{Deserialize, Serialize};
7use std::collections::HashMap;
8
9///
10/// **AWS API**: `ecs.v1.ListClustersRequest`
11/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//ListClustersRequest>
12#[derive(Debug, Clone, Default, Serialize, Deserialize)]
13#[serde(rename_all = "camelCase")]
14pub struct ListClustersRequest {
15 /// The nextToken value returned from a ListClusters request indicating that more results
16 /// are available to fulfill the request and further calls are needed. If maxResults was
17 /// provided, it's possible the number of results to be fewer than maxResults. This token
18 /// should be treated as an opaque identifier that is only used to retrieve the next items
19 /// in a list and not for other programmatic purposes.
20 #[serde(skip_serializing_if = "Option::is_none")]
21 pub next_token: Option<String>,
22
23 /// The maximum number of cluster results that ListClusters returned in paginated output.
24 /// When this parameter is used, ListClusters only returns maxResults results in a single
25 /// page along with a nextToken response element. The remaining results of the initial
26 /// request can be seen by sending another ListClusters request with the returned nextToken
27 /// value. This value can be between 1 and 100. If this parameter isn't used, then
28 /// ListClusters returns up to 100 results and a nextToken value if applicable.
29 #[serde(skip_serializing_if = "Option::is_none")]
30 pub max_results: Option<i32>,
31}
32
33impl ListClustersRequest {
34 #[cfg(any(test, feature = "test-support"))]
35 /// Create a fixture instance for testing.
36 pub fn fixture() -> Self {
37 Self {
38 next_token: Some("test-next_token".into()),
39 max_results: Some(100),
40 }
41 }
42}
43
44///
45/// **AWS API**: `ecs.v1.ListClustersResponse`
46/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//ListClustersResponse>
47#[derive(Debug, Clone, Default, Serialize, Deserialize)]
48#[serde(rename_all = "camelCase")]
49pub struct ListClustersResponse {
50 /// The list of full Amazon Resource Name (ARN) entries for each cluster that's associated
51 /// with your account.
52 #[serde(default)]
53 #[serde(skip_serializing_if = "Vec::is_empty")]
54 pub cluster_arns: Vec<String>,
55
56 /// The nextToken value to include in a future ListClusters request. When the results of a
57 /// ListClusters request exceed maxResults, this value can be used to retrieve the next page
58 /// of results. This value is null when there are no more results to return.
59 #[serde(skip_serializing_if = "Option::is_none")]
60 pub next_token: Option<String>,
61}
62
63impl ListClustersResponse {
64 #[cfg(any(test, feature = "test-support"))]
65 /// Create a fixture instance for testing.
66 pub fn fixture() -> Self {
67 Self {
68 cluster_arns: vec![],
69 next_token: Some("test-next_token".into()),
70 }
71 }
72}
73
74///
75/// **AWS API**: `ecs.v1.DescribeClustersRequest`
76/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//DescribeClustersRequest>
77#[derive(Debug, Clone, Default, Serialize, Deserialize)]
78#[serde(rename_all = "camelCase")]
79pub struct DescribeClustersRequest {
80 /// A list of up to 100 cluster names or full cluster Amazon Resource Name (ARN) entries. If
81 /// you do not specify a cluster, the default cluster is assumed.
82 #[serde(default)]
83 #[serde(skip_serializing_if = "Vec::is_empty")]
84 pub clusters: Vec<String>,
85
86 /// Determines whether to include additional information about the clusters in the response.
87 /// If this field is omitted, this information isn't included. If ATTACHMENTS is specified,
88 /// the attachments for the container instances or tasks within the cluster are included,
89 /// for example the capacity providers. If SETTINGS is specified, the settings for the
90 /// cluster are included. If CONFIGURATIONS is specified, the configuration for the cluster
91 /// is included. If STATISTICS is specified, the task and service count is included,
92 /// separated by launch type. If TAGS is specified, the metadata tags associated with the
93 /// cluster are included.
94 #[serde(default)]
95 #[serde(skip_serializing_if = "Vec::is_empty")]
96 pub include: Vec<String>,
97}
98
99impl DescribeClustersRequest {
100 #[cfg(any(test, feature = "test-support"))]
101 /// Create a fixture instance for testing.
102 pub fn fixture() -> Self {
103 Self {
104 clusters: vec![],
105 include: vec![],
106 }
107 }
108}
109
110///
111/// **AWS API**: `ecs.v1.DescribeClustersResponse`
112/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//DescribeClustersResponse>
113#[derive(Debug, Clone, Default, Serialize, Deserialize)]
114#[serde(rename_all = "camelCase")]
115pub struct DescribeClustersResponse {
116 /// The list of clusters.
117 #[serde(default)]
118 #[serde(skip_serializing_if = "Vec::is_empty")]
119 pub clusters: Vec<Cluster>,
120
121 /// Any failures associated with the call.
122 #[serde(default)]
123 #[serde(skip_serializing_if = "Vec::is_empty")]
124 pub failures: Vec<Failure>,
125}
126
127impl DescribeClustersResponse {
128 #[cfg(any(test, feature = "test-support"))]
129 /// Create a fixture instance for testing.
130 pub fn fixture() -> Self {
131 Self {
132 clusters: vec![],
133 failures: vec![],
134 }
135 }
136}
137
138/// A regional grouping of one or more container instances where you can run task requests. Each
139/// account receives a default cluster the first time you use the Amazon ECS service, but you
140/// may also create other clusters. Clusters may contain more than one instance type
141/// simultaneously.
142///
143/// **AWS API**: `ecs.v1.Cluster`
144/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//Cluster>
145///
146/// ## Coverage
147/// 10 of 16 fields included.
148/// Omitted fields:
149/// - `configuration` — not selected in manifest
150/// - `statistics` — not selected in manifest
151/// - `defaultCapacityProviderStrategy` — not selected in manifest
152/// - `attachments` — not selected in manifest
153/// - `attachmentsStatus` — not selected in manifest
154/// - `serviceConnectDefaults` — not selected in manifest
155#[derive(Debug, Clone, Default, Serialize, Deserialize)]
156#[serde(rename_all = "camelCase")]
157pub struct Cluster {
158 /// The Amazon Resource Name (ARN) that identifies the cluster. For more information about
159 /// the ARN format, see Amazon Resource Name (ARN) in the Amazon ECS Developer Guide.
160 #[serde(skip_serializing_if = "Option::is_none")]
161 pub cluster_arn: Option<String>,
162
163 /// A user-generated string that you use to identify your cluster.
164 #[serde(skip_serializing_if = "Option::is_none")]
165 pub cluster_name: Option<String>,
166
167 /// The status of the cluster. The following are the possible states that are returned.
168 /// ACTIVE The cluster is ready to accept tasks and if applicable you can register container
169 /// instances with the cluster. PROVISIONING The cluster has capacity providers that are
170 /// associated with it and the resources needed for the capacity provider are being created.
171 /// DEPROVISIONING The cluster has capacity providers that are associated with it and the
172 /// resources needed for the capacity provider are being deleted. FAILED The cluster has
173 /// capacity providers that are associated with it and the resources needed for the capacity
174 /// provider have failed to create. INACTIVE The cluster has been deleted. Clusters with an
175 /// INACTIVE status may remain discoverable in your account for a period of time. However,
176 /// this behavior is subject to change in the future. We don't recommend that you rely on
177 /// INACTIVE clusters persisting.
178 #[serde(skip_serializing_if = "Option::is_none")]
179 pub status: Option<String>,
180
181 /// The number of container instances registered into the cluster. This includes container
182 /// instances in both ACTIVE and DRAINING status.
183 #[serde(skip_serializing_if = "Option::is_none")]
184 pub registered_container_instances_count: Option<i32>,
185
186 /// The number of tasks in the cluster that are in the RUNNING state.
187 #[serde(skip_serializing_if = "Option::is_none")]
188 pub running_tasks_count: Option<i32>,
189
190 /// The number of tasks in the cluster that are in the PENDING state.
191 #[serde(skip_serializing_if = "Option::is_none")]
192 pub pending_tasks_count: Option<i32>,
193
194 /// The number of services that are running on the cluster in an ACTIVE state. You can view
195 /// these services with ListServices.
196 #[serde(skip_serializing_if = "Option::is_none")]
197 pub active_services_count: Option<i32>,
198
199 /// The metadata that you apply to the cluster to help you categorize and organize them.
200 /// Each tag consists of a key and an optional value. You define both. The following basic
201 /// restrictions apply to tags: Maximum number of tags per resource - 50 For each resource,
202 /// each tag key must be unique, and each tag key can have only one value. Maximum key
203 /// length - 128 Unicode characters in UTF-8 Maximum value length - 256 Unicode characters
204 /// in UTF-8 If your tagging schema is used across multiple services and resources, remember
205 /// that other services may have restrictions on allowed characters. Generally allowed
206 /// characters are: letters, numbers, and spaces representable in UTF-8, and the following
207 /// characters: + - = . _ : / @. Tag keys and values are case-sensitive. Do not use aws:,
208 /// AWS:, or any upper or lowercase combination of such as a prefix for either keys or
209 /// values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys
210 /// or values with this prefix. Tags with this prefix do not count against your tags per
211 /// resource limit.
212 #[serde(default)]
213 #[serde(skip_serializing_if = "Vec::is_empty")]
214 pub tags: Vec<Tag>,
215
216 /// The settings for the cluster. This parameter indicates whether CloudWatch Container
217 /// Insights is on or off for a cluster.
218 #[serde(default)]
219 #[serde(skip_serializing_if = "Vec::is_empty")]
220 pub settings: Vec<ClusterSetting>,
221
222 /// The capacity providers associated with the cluster.
223 #[serde(default)]
224 #[serde(skip_serializing_if = "Vec::is_empty")]
225 pub capacity_providers: Vec<String>,
226}
227
228impl Cluster {
229 #[cfg(any(test, feature = "test-support"))]
230 /// Create a fixture instance for testing.
231 pub fn fixture() -> Self {
232 Self {
233 cluster_arn: Some("test-cluster_arn".into()),
234 cluster_name: Some("test-cluster_name".into()),
235 status: Some("test-status".into()),
236 registered_container_instances_count: Some(100),
237 running_tasks_count: Some(100),
238 pending_tasks_count: Some(100),
239 active_services_count: Some(100),
240 tags: vec![],
241 settings: vec![],
242 capacity_providers: vec![],
243 }
244 }
245}
246
247/// A key-value pair object.
248///
249/// **AWS API**: `ecs.v1.KeyValuePair`
250/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//KeyValuePair>
251#[derive(Debug, Clone, Default, Serialize, Deserialize)]
252#[serde(rename_all = "camelCase")]
253pub struct KeyValuePair {
254 /// The name of the key-value pair. For environment variables, this is the name of the
255 /// environment variable.
256 #[serde(skip_serializing_if = "Option::is_none")]
257 pub name: Option<String>,
258
259 /// The value of the key-value pair. For environment variables, this is the value of the
260 /// environment variable.
261 #[serde(skip_serializing_if = "Option::is_none")]
262 pub value: Option<String>,
263}
264
265impl KeyValuePair {
266 #[cfg(any(test, feature = "test-support"))]
267 /// Create a fixture instance for testing.
268 pub fn fixture() -> Self {
269 Self {
270 name: Some("test-key_value_pair".into()),
271 value: Some("test-value".into()),
272 }
273 }
274}
275
276/// The settings to use when creating a cluster. This parameter is used to turn on CloudWatch
277/// Container Insights with enhanced observability or CloudWatch Container Insights for a
278/// cluster. Container Insights with enhanced observability provides all the Container Insights
279/// metrics, plus additional task and container metrics. This version supports enhanced
280/// observability for Amazon ECS clusters using the Amazon EC2 and Fargate launch types. After
281/// you configure Container Insights with enhanced observability on Amazon ECS, Container
282/// Insights auto-collects detailed infrastructure telemetry from the cluster level down to the
283/// container level in your environment and displays these critical performance data in curated
284/// dashboards removing the heavy lifting in observability set-up. For more information, see
285/// Monitor Amazon ECS containers using Container Insights with enhanced observability in the
286/// Amazon Elastic Container Service Developer Guide.
287///
288/// **AWS API**: `ecs.v1.ClusterSetting`
289/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//ClusterSetting>
290#[derive(Debug, Clone, Default, Serialize, Deserialize)]
291#[serde(rename_all = "camelCase")]
292pub struct ClusterSetting {
293 /// The name of the cluster setting. The value is containerInsights.
294 #[serde(skip_serializing_if = "Option::is_none")]
295 pub name: Option<String>,
296
297 /// The value to set for the cluster setting. The supported values are enhanced, enabled,
298 /// and disabled. To use Container Insights with enhanced observability, set the
299 /// containerInsights account setting to enhanced. To use Container Insights, set the
300 /// containerInsights account setting to enabled. If a cluster value is specified, it will
301 /// override the containerInsights value set with PutAccountSetting or
302 /// PutAccountSettingDefault.
303 #[serde(skip_serializing_if = "Option::is_none")]
304 pub value: Option<String>,
305}
306
307impl ClusterSetting {
308 #[cfg(any(test, feature = "test-support"))]
309 /// Create a fixture instance for testing.
310 pub fn fixture() -> Self {
311 Self {
312 name: Some("test-cluster_setting".into()),
313 value: Some("test-value".into()),
314 }
315 }
316}
317
318/// The metadata that you apply to a resource to help you categorize and organize them. Each tag
319/// consists of a key and an optional value. You define them. The following basic restrictions
320/// apply to tags: Maximum number of tags per resource - 50 For each resource, each tag key must
321/// be unique, and each tag key can have only one value. Maximum key length - 128 Unicode
322/// characters in UTF-8 Maximum value length - 256 Unicode characters in UTF-8 If your tagging
323/// schema is used across multiple services and resources, remember that other services may have
324/// restrictions on allowed characters. Generally allowed characters are: letters, numbers, and
325/// spaces representable in UTF-8, and the following characters: + - = . _ : / @. Tag keys and
326/// values are case-sensitive. Do not use aws:, AWS:, or any upper or lowercase combination of
327/// such as a prefix for either keys or values as it is reserved for Amazon Web Services use.
328/// You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not
329/// count against your tags per resource limit.
330///
331/// **AWS API**: `ecs.v1.Tag`
332/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//Tag>
333#[derive(Debug, Clone, Default, Serialize, Deserialize)]
334#[serde(rename_all = "camelCase")]
335pub struct Tag {
336 /// One part of a key-value pair that make up a tag. A key is a general label that acts like
337 /// a category for more specific tag values.
338 #[serde(skip_serializing_if = "Option::is_none")]
339 pub key: Option<String>,
340
341 /// The optional part of a key-value pair that make up a tag. A value acts as a descriptor
342 /// within a tag category (key).
343 #[serde(skip_serializing_if = "Option::is_none")]
344 pub value: Option<String>,
345}
346
347impl Tag {
348 #[cfg(any(test, feature = "test-support"))]
349 /// Create a fixture instance for testing.
350 pub fn fixture() -> Self {
351 Self {
352 key: Some("test-key".into()),
353 value: Some("test-value".into()),
354 }
355 }
356}
357
358/// A failed resource. For a list of common causes, see API failure reasons in the Amazon
359/// Elastic Container Service Developer Guide.
360///
361/// **AWS API**: `ecs.v1.Failure`
362/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//Failure>
363#[derive(Debug, Clone, Default, Serialize, Deserialize)]
364#[serde(rename_all = "camelCase")]
365pub struct Failure {
366 /// The Amazon Resource Name (ARN) of the failed resource.
367 #[serde(skip_serializing_if = "Option::is_none")]
368 pub arn: Option<String>,
369
370 /// The reason for the failure.
371 #[serde(skip_serializing_if = "Option::is_none")]
372 pub reason: Option<String>,
373
374 /// The details of the failure.
375 #[serde(skip_serializing_if = "Option::is_none")]
376 pub detail: Option<String>,
377}
378
379impl Failure {
380 #[cfg(any(test, feature = "test-support"))]
381 /// Create a fixture instance for testing.
382 pub fn fixture() -> Self {
383 Self {
384 arn: Some("test-arn".into()),
385 reason: Some("test-reason".into()),
386 detail: Some("test-detail".into()),
387 }
388 }
389}
390
391///
392/// **AWS API**: `ecs.v1.ListServicesRequest`
393/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//ListServicesRequest>
394///
395/// ## Coverage
396/// 5 of 6 fields included.
397/// Omitted fields:
398/// - `resourceManagementType` — not selected in manifest
399#[derive(Debug, Clone, Default, Serialize, Deserialize)]
400#[serde(rename_all = "camelCase")]
401pub struct ListServicesRequest {
402 /// The short name or full Amazon Resource Name (ARN) of the cluster to use when filtering
403 /// the ListServices results. If you do not specify a cluster, the default cluster is
404 /// assumed.
405 #[serde(skip_serializing_if = "Option::is_none")]
406 pub cluster: Option<String>,
407
408 /// The nextToken value returned from a ListServices request indicating that more results
409 /// are available to fulfill the request and further calls will be needed. If maxResults was
410 /// provided, it is possible the number of results to be fewer than maxResults. This token
411 /// should be treated as an opaque identifier that is only used to retrieve the next items
412 /// in a list and not for other programmatic purposes.
413 #[serde(skip_serializing_if = "Option::is_none")]
414 pub next_token: Option<String>,
415
416 /// The maximum number of service results that ListServices returned in paginated output.
417 /// When this parameter is used, ListServices only returns maxResults results in a single
418 /// page along with a nextToken response element. The remaining results of the initial
419 /// request can be seen by sending another ListServices request with the returned nextToken
420 /// value. This value can be between 1 and 100. If this parameter isn't used, then
421 /// ListServices returns up to 10 results and a nextToken value if applicable.
422 #[serde(skip_serializing_if = "Option::is_none")]
423 pub max_results: Option<i32>,
424
425 /// The launch type to use when filtering the ListServices results.
426 #[serde(skip_serializing_if = "Option::is_none")]
427 pub launch_type: Option<String>,
428
429 /// The scheduling strategy to use when filtering the ListServices results.
430 #[serde(skip_serializing_if = "Option::is_none")]
431 pub scheduling_strategy: Option<String>,
432}
433
434impl ListServicesRequest {
435 #[cfg(any(test, feature = "test-support"))]
436 /// Create a fixture instance for testing.
437 pub fn fixture() -> Self {
438 Self {
439 cluster: Some("test-cluster".into()),
440 next_token: Some("test-next_token".into()),
441 max_results: Some(100),
442 launch_type: Some("test-launch_type".into()),
443 scheduling_strategy: Some("test-scheduling_strategy".into()),
444 }
445 }
446}
447
448///
449/// **AWS API**: `ecs.v1.ListServicesResponse`
450/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//ListServicesResponse>
451#[derive(Debug, Clone, Default, Serialize, Deserialize)]
452#[serde(rename_all = "camelCase")]
453pub struct ListServicesResponse {
454 /// The list of full ARN entries for each service that's associated with the specified
455 /// cluster.
456 #[serde(default)]
457 #[serde(skip_serializing_if = "Vec::is_empty")]
458 pub service_arns: Vec<String>,
459
460 /// The nextToken value to include in a future ListServices request. When the results of a
461 /// ListServices request exceed maxResults, this value can be used to retrieve the next page
462 /// of results. This value is null when there are no more results to return.
463 #[serde(skip_serializing_if = "Option::is_none")]
464 pub next_token: Option<String>,
465}
466
467impl ListServicesResponse {
468 #[cfg(any(test, feature = "test-support"))]
469 /// Create a fixture instance for testing.
470 pub fn fixture() -> Self {
471 Self {
472 service_arns: vec![],
473 next_token: Some("test-next_token".into()),
474 }
475 }
476}
477
478///
479/// **AWS API**: `ecs.v1.DescribeServicesRequest`
480/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//DescribeServicesRequest>
481#[derive(Debug, Clone, Default, Serialize, Deserialize)]
482#[serde(rename_all = "camelCase")]
483pub struct DescribeServicesRequest {
484 /// The short name or full Amazon Resource Name (ARN)the cluster that hosts the service to
485 /// describe. If you do not specify a cluster, the default cluster is assumed. This
486 /// parameter is required if the service or services you are describing were launched in any
487 /// cluster other than the default cluster.
488 #[serde(skip_serializing_if = "Option::is_none")]
489 pub cluster: Option<String>,
490
491 /// A list of services to describe. You may specify up to 10 services to describe in a
492 /// single operation.
493 #[serde(default)]
494 pub services: Vec<String>,
495
496 /// Determines whether you want to see the resource tags for the service. If TAGS is
497 /// specified, the tags are included in the response. If this field is omitted, tags aren't
498 /// included in the response.
499 #[serde(default)]
500 #[serde(skip_serializing_if = "Vec::is_empty")]
501 pub include: Vec<String>,
502}
503
504impl DescribeServicesRequest {
505 #[cfg(any(test, feature = "test-support"))]
506 /// Create a fixture instance for testing.
507 pub fn fixture() -> Self {
508 Self {
509 cluster: Some("test-cluster".into()),
510 services: vec![],
511 include: vec![],
512 }
513 }
514}
515
516///
517/// **AWS API**: `ecs.v1.DescribeServicesResponse`
518/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//DescribeServicesResponse>
519#[derive(Debug, Clone, Default, Serialize, Deserialize)]
520#[serde(rename_all = "camelCase")]
521pub struct DescribeServicesResponse {
522 /// The list of services described.
523 #[serde(default)]
524 #[serde(skip_serializing_if = "Vec::is_empty")]
525 pub services: Vec<Service>,
526
527 /// Any failures associated with the call.
528 #[serde(default)]
529 #[serde(skip_serializing_if = "Vec::is_empty")]
530 pub failures: Vec<Failure>,
531}
532
533impl DescribeServicesResponse {
534 #[cfg(any(test, feature = "test-support"))]
535 /// Create a fixture instance for testing.
536 pub fn fixture() -> Self {
537 Self {
538 services: vec![],
539 failures: vec![],
540 }
541 }
542}
543
544/// Details on a service within a cluster.
545///
546/// **AWS API**: `ecs.v1.Service`
547/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//Service>
548///
549/// ## Coverage
550/// 17 of 35 fields included.
551/// Omitted fields:
552/// - `serviceRegistries` — not selected in manifest
553/// - `capacityProviderStrategy` — not selected in manifest
554/// - `platformFamily` — not selected in manifest
555/// - `deploymentConfiguration` — not selected in manifest
556/// - `taskSets` — not selected in manifest
557/// - `roleArn` — not selected in manifest
558/// - `currentServiceDeployment` — not selected in manifest
559/// - `currentServiceRevisions` — not selected in manifest
560/// - `placementConstraints` — not selected in manifest
561/// - `placementStrategy` — not selected in manifest
562/// - `healthCheckGracePeriodSeconds` — not selected in manifest
563/// - `deploymentController` — not selected in manifest
564/// - `tags` — not selected in manifest
565/// - `createdBy` — not selected in manifest
566/// - `enableECSManagedTags` — not selected in manifest
567/// - `propagateTags` — not selected in manifest
568/// - `availabilityZoneRebalancing` — not selected in manifest
569/// - `resourceManagementType` — not selected in manifest
570#[derive(Debug, Clone, Default, Serialize, Deserialize)]
571#[serde(rename_all = "camelCase")]
572pub struct Service {
573 /// The ARN that identifies the service. For more information about the ARN format, see
574 /// Amazon Resource Name (ARN) in the Amazon ECS Developer Guide.
575 #[serde(skip_serializing_if = "Option::is_none")]
576 pub service_arn: Option<String>,
577
578 /// The name of your service. Up to 255 letters (uppercase and lowercase), numbers,
579 /// underscores, and hyphens are allowed. Service names must be unique within a cluster.
580 /// However, you can have similarly named services in multiple clusters within a Region or
581 /// across multiple Regions.
582 #[serde(skip_serializing_if = "Option::is_none")]
583 pub service_name: Option<String>,
584
585 /// The Amazon Resource Name (ARN) of the cluster that hosts the service.
586 #[serde(skip_serializing_if = "Option::is_none")]
587 pub cluster_arn: Option<String>,
588
589 /// A list of Elastic Load Balancing load balancer objects. It contains the load balancer
590 /// name, the container name, and the container port to access from the load balancer. The
591 /// container name is as it appears in a container definition.
592 #[serde(default)]
593 #[serde(skip_serializing_if = "Vec::is_empty")]
594 pub load_balancers: Vec<LoadBalancer>,
595
596 /// The status of the service. The valid values are ACTIVE, DRAINING, or INACTIVE.
597 #[serde(skip_serializing_if = "Option::is_none")]
598 pub status: Option<String>,
599
600 /// The desired number of instantiations of the task definition to keep running on the
601 /// service. This value is specified when the service is created with CreateService , and it
602 /// can be modified with UpdateService.
603 #[serde(skip_serializing_if = "Option::is_none")]
604 pub desired_count: Option<i32>,
605
606 /// The number of tasks in the cluster that are in the RUNNING state.
607 #[serde(skip_serializing_if = "Option::is_none")]
608 pub running_count: Option<i32>,
609
610 /// The number of tasks in the cluster that are in the PENDING state.
611 #[serde(skip_serializing_if = "Option::is_none")]
612 pub pending_count: Option<i32>,
613
614 /// The launch type the service is using. When using the DescribeServices API, this field is
615 /// omitted if the service was created using a capacity provider strategy.
616 #[serde(skip_serializing_if = "Option::is_none")]
617 pub launch_type: Option<String>,
618
619 /// The task definition to use for tasks in the service. This value is specified when the
620 /// service is created with CreateService, and it can be modified with UpdateService.
621 #[serde(skip_serializing_if = "Option::is_none")]
622 pub task_definition: Option<String>,
623
624 /// The current state of deployments for the service.
625 #[serde(default)]
626 #[serde(skip_serializing_if = "Vec::is_empty")]
627 pub deployments: Vec<Deployment>,
628
629 /// The event stream for your service. A maximum of 100 of the latest events are displayed.
630 #[serde(default)]
631 #[serde(skip_serializing_if = "Vec::is_empty")]
632 pub events: Vec<ServiceEvent>,
633
634 /// The Unix timestamp for the time when the service was created.
635 #[serde(skip_serializing_if = "Option::is_none")]
636 pub created_at: Option<f64>,
637
638 /// The platform version to run your service on. A platform version is only specified for
639 /// tasks that are hosted on Fargate. If one isn't specified, the LATEST platform version is
640 /// used. For more information, see Fargate Platform Versions in the Amazon Elastic
641 /// Container Service Developer Guide.
642 #[serde(skip_serializing_if = "Option::is_none")]
643 pub platform_version: Option<String>,
644
645 /// The VPC subnet and security group configuration for tasks that receive their own elastic
646 /// network interface by using the awsvpc networking mode.
647 #[serde(skip_serializing_if = "Option::is_none")]
648 pub network_configuration: Option<NetworkConfiguration>,
649
650 /// The scheduling strategy to use for the service. For more information, see Services.
651 /// There are two service scheduler strategies available. REPLICA-The replica scheduling
652 /// strategy places and maintains the desired number of tasks across your cluster. By
653 /// default, the service scheduler spreads tasks across Availability Zones. You can use task
654 /// placement strategies and constraints to customize task placement decisions. DAEMON-The
655 /// daemon scheduling strategy deploys exactly one task on each active container instance.
656 /// This task meets all of the task placement constraints that you specify in your cluster.
657 /// The service scheduler also evaluates the task placement constraints for running tasks.
658 /// It stop tasks that don't meet the placement constraints. Fargate tasks don't support the
659 /// DAEMON scheduling strategy.
660 #[serde(skip_serializing_if = "Option::is_none")]
661 pub scheduling_strategy: Option<String>,
662
663 /// Determines whether the execute command functionality is turned on for the service. If
664 /// true, the execute command functionality is turned on for all containers in tasks as part
665 /// of the service.
666 #[serde(skip_serializing_if = "Option::is_none")]
667 pub enable_execute_command: Option<bool>,
668}
669
670impl Service {
671 #[cfg(any(test, feature = "test-support"))]
672 /// Create a fixture instance for testing.
673 pub fn fixture() -> Self {
674 Self {
675 service_arn: Some("test-service_arn".into()),
676 service_name: Some("test-service_name".into()),
677 cluster_arn: Some("test-cluster_arn".into()),
678 load_balancers: vec![],
679 status: Some("test-status".into()),
680 desired_count: Some(100),
681 running_count: Some(100),
682 pending_count: Some(100),
683 launch_type: Some("test-launch_type".into()),
684 task_definition: Some("test-task_definition".into()),
685 deployments: vec![],
686 events: vec![],
687 platform_version: Some("test-platform_version".into()),
688 network_configuration: Some(NetworkConfiguration::fixture()),
689 scheduling_strategy: Some("test-scheduling_strategy".into()),
690 enable_execute_command: Some(false),
691 ..Default::default()
692 }
693 }
694}
695
696/// The details of an Amazon ECS service deployment. This is used only when a service uses the
697/// ECS deployment controller type.
698///
699/// **AWS API**: `ecs.v1.Deployment`
700/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//Deployment>
701///
702/// ## Coverage
703/// 13 of 21 fields included.
704/// Omitted fields:
705/// - `capacityProviderStrategy` — not selected in manifest
706/// - `platformFamily` — not selected in manifest
707/// - `networkConfiguration` — not selected in manifest
708/// - `serviceConnectConfiguration` — not selected in manifest
709/// - `serviceConnectResources` — not selected in manifest
710/// - `volumeConfigurations` — not selected in manifest
711/// - `fargateEphemeralStorage` — not selected in manifest
712/// - `vpcLatticeConfigurations` — not selected in manifest
713#[derive(Debug, Clone, Default, Serialize, Deserialize)]
714#[serde(rename_all = "camelCase")]
715pub struct Deployment {
716 /// The ID of the deployment.
717 #[serde(skip_serializing_if = "Option::is_none")]
718 pub id: Option<String>,
719
720 /// The status of the deployment. The following describes each state. PRIMARY The most
721 /// recent deployment of a service. ACTIVE A service deployment that still has running
722 /// tasks, but are in the process of being replaced with a new PRIMARY deployment. INACTIVE
723 /// A deployment that has been completely replaced.
724 #[serde(skip_serializing_if = "Option::is_none")]
725 pub status: Option<String>,
726
727 /// The most recent task definition that was specified for the tasks in the service to use.
728 #[serde(skip_serializing_if = "Option::is_none")]
729 pub task_definition: Option<String>,
730
731 /// The most recent desired count of tasks that was specified for the service to deploy or
732 /// maintain.
733 #[serde(skip_serializing_if = "Option::is_none")]
734 pub desired_count: Option<i32>,
735
736 /// The number of tasks in the deployment that are in the PENDING status.
737 #[serde(skip_serializing_if = "Option::is_none")]
738 pub pending_count: Option<i32>,
739
740 /// The number of tasks in the deployment that are in the RUNNING status.
741 #[serde(skip_serializing_if = "Option::is_none")]
742 pub running_count: Option<i32>,
743
744 /// The number of consecutively failed tasks in the deployment. A task is considered a
745 /// failure if the service scheduler can't launch the task, the task doesn't transition to a
746 /// RUNNING state, or if it fails any of its defined health checks and is stopped. Once a
747 /// service deployment has one or more successfully running tasks, the failed task count
748 /// resets to zero and stops being evaluated.
749 #[serde(skip_serializing_if = "Option::is_none")]
750 pub failed_tasks: Option<i32>,
751
752 /// The Unix timestamp for the time when the service deployment was created.
753 #[serde(skip_serializing_if = "Option::is_none")]
754 pub created_at: Option<f64>,
755
756 /// The Unix timestamp for the time when the service deployment was last updated.
757 #[serde(skip_serializing_if = "Option::is_none")]
758 pub updated_at: Option<f64>,
759
760 /// The launch type the tasks in the service are using. For more information, see Amazon ECS
761 /// Launch Types in the Amazon Elastic Container Service Developer Guide.
762 #[serde(skip_serializing_if = "Option::is_none")]
763 pub launch_type: Option<String>,
764
765 /// The platform version that your tasks in the service run on. A platform version is only
766 /// specified for tasks using the Fargate launch type. If one isn't specified, the LATEST
767 /// platform version is used. For more information, see Fargate Platform Versions in the
768 /// Amazon Elastic Container Service Developer Guide.
769 #[serde(skip_serializing_if = "Option::is_none")]
770 pub platform_version: Option<String>,
771
772 /// The rolloutState of a service is only returned for services that use the rolling update
773 /// (ECS) deployment type that aren't behind a Classic Load Balancer. The rollout state of
774 /// the deployment. When a service deployment is started, it begins in an IN_PROGRESS state.
775 /// When the service reaches a steady state, the deployment transitions to a COMPLETED
776 /// state. If the service fails to reach a steady state and circuit breaker is turned on,
777 /// the deployment transitions to a FAILED state. A deployment in FAILED state doesn't
778 /// launch any new tasks. For more information, see DeploymentCircuitBreaker.
779 #[serde(skip_serializing_if = "Option::is_none")]
780 pub rollout_state: Option<String>,
781
782 /// A description of the rollout state of a deployment.
783 #[serde(skip_serializing_if = "Option::is_none")]
784 pub rollout_state_reason: Option<String>,
785}
786
787impl Deployment {
788 #[cfg(any(test, feature = "test-support"))]
789 /// Create a fixture instance for testing.
790 pub fn fixture() -> Self {
791 Self {
792 id: Some("test-id".into()),
793 status: Some("test-status".into()),
794 task_definition: Some("test-task_definition".into()),
795 desired_count: Some(100),
796 pending_count: Some(100),
797 running_count: Some(100),
798 failed_tasks: Some(100),
799 launch_type: Some("test-launch_type".into()),
800 platform_version: Some("test-platform_version".into()),
801 rollout_state: Some("test-rollout_state".into()),
802 rollout_state_reason: Some("test-rollout_state_reason".into()),
803 ..Default::default()
804 }
805 }
806}
807
808/// The details for an event that's associated with a service.
809///
810/// **AWS API**: `ecs.v1.ServiceEvent`
811/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//ServiceEvent>
812#[derive(Debug, Clone, Default, Serialize, Deserialize)]
813#[serde(rename_all = "camelCase")]
814pub struct ServiceEvent {
815 /// The ID string for the event.
816 #[serde(skip_serializing_if = "Option::is_none")]
817 pub id: Option<String>,
818
819 /// The Unix timestamp for the time when the event was triggered.
820 #[serde(skip_serializing_if = "Option::is_none")]
821 pub created_at: Option<f64>,
822
823 /// The event message.
824 #[serde(skip_serializing_if = "Option::is_none")]
825 pub message: Option<String>,
826}
827
828impl ServiceEvent {
829 #[cfg(any(test, feature = "test-support"))]
830 /// Create a fixture instance for testing.
831 pub fn fixture() -> Self {
832 Self {
833 id: Some("test-id".into()),
834 message: Some("test-message".into()),
835 ..Default::default()
836 }
837 }
838}
839
840/// The load balancer configuration to use with a service or task set. When you add, update, or
841/// remove a load balancer configuration, Amazon ECS starts a new deployment with the updated
842/// Elastic Load Balancing configuration. This causes tasks to register to and deregister from
843/// load balancers. We recommend that you verify this on a test environment before you update
844/// the Elastic Load Balancing configuration. A service-linked role is required for services
845/// that use multiple target groups. For more information, see Using service-linked roles in the
846/// Amazon Elastic Container Service Developer Guide.
847///
848/// **AWS API**: `ecs.v1.LoadBalancer`
849/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//LoadBalancer>
850///
851/// ## Coverage
852/// 4 of 5 fields included.
853/// Omitted fields:
854/// - `advancedConfiguration` — not selected in manifest
855#[derive(Debug, Clone, Default, Serialize, Deserialize)]
856#[serde(rename_all = "camelCase")]
857pub struct LoadBalancer {
858 /// The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group or groups
859 /// associated with a service or task set. A target group ARN is only specified when using
860 /// an Application Load Balancer or Network Load Balancer. For services using the ECS
861 /// deployment controller, you can specify one or multiple target groups. For more
862 /// information, see Registering multiple target groups with a service in the Amazon Elastic
863 /// Container Service Developer Guide. For services using the CODE_DEPLOY deployment
864 /// controller, you're required to define two target groups for the load balancer. For more
865 /// information, see Blue/green deployment with CodeDeploy in the Amazon Elastic Container
866 /// Service Developer Guide. If your service's task definition uses the awsvpc network mode,
867 /// you must choose ip as the target type, not instance. Do this when creating your target
868 /// groups because tasks that use the awsvpc network mode are associated with an elastic
869 /// network interface, not an Amazon EC2 instance. This network mode is required for the
870 /// Fargate launch type.
871 #[serde(skip_serializing_if = "Option::is_none")]
872 pub target_group_arn: Option<String>,
873
874 /// The name of the load balancer to associate with the Amazon ECS service or task set. If
875 /// you are using an Application Load Balancer or a Network Load Balancer the load balancer
876 /// name parameter should be omitted.
877 #[serde(skip_serializing_if = "Option::is_none")]
878 pub load_balancer_name: Option<String>,
879
880 /// The name of the container (as it appears in a container definition) to associate with
881 /// the load balancer. You need to specify the container name when configuring the target
882 /// group for an Amazon ECS load balancer.
883 #[serde(skip_serializing_if = "Option::is_none")]
884 pub container_name: Option<String>,
885
886 /// The port on the container to associate with the load balancer. This port must correspond
887 /// to a containerPort in the task definition the tasks in the service are using. For tasks
888 /// that use the EC2 launch type, the container instance they're launched on must allow
889 /// ingress traffic on the hostPort of the port mapping.
890 #[serde(skip_serializing_if = "Option::is_none")]
891 pub container_port: Option<i32>,
892}
893
894impl LoadBalancer {
895 #[cfg(any(test, feature = "test-support"))]
896 /// Create a fixture instance for testing.
897 pub fn fixture() -> Self {
898 Self {
899 target_group_arn: Some("test-target_group_arn".into()),
900 load_balancer_name: Some("test-load_balancer_name".into()),
901 container_name: Some("test-container_name".into()),
902 container_port: Some(100),
903 }
904 }
905}
906
907/// The network configuration for a task or service.
908///
909/// **AWS API**: `ecs.v1.NetworkConfiguration`
910/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//NetworkConfiguration>
911#[derive(Debug, Clone, Default, Serialize, Deserialize)]
912#[serde(rename_all = "camelCase")]
913pub struct NetworkConfiguration {
914 /// The VPC subnets and security groups that are associated with a task. All specified
915 /// subnets and security groups must be from the same VPC.
916 #[serde(skip_serializing_if = "Option::is_none")]
917 pub awsvpc_configuration: Option<AwsVpcConfiguration>,
918}
919
920impl NetworkConfiguration {
921 #[cfg(any(test, feature = "test-support"))]
922 /// Create a fixture instance for testing.
923 pub fn fixture() -> Self {
924 Self {
925 awsvpc_configuration: Some(AwsVpcConfiguration::fixture()),
926 }
927 }
928}
929
930/// An object representing the networking details for a task or service. For example
931/// awsVpcConfiguration={subnets=["subnet-12344321"],securityGroups=["sg-12344321"]}.
932///
933/// **AWS API**: `ecs.v1.AwsVpcConfiguration`
934/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//AwsVpcConfiguration>
935#[derive(Debug, Clone, Default, Serialize, Deserialize)]
936#[serde(rename_all = "camelCase")]
937pub struct AwsVpcConfiguration {
938 /// The IDs of the subnets associated with the task or service. There's a limit of 16
939 /// subnets that can be specified. All specified subnets must be from the same VPC.
940 #[serde(default)]
941 pub subnets: Vec<String>,
942
943 /// The IDs of the security groups associated with the task or service. If you don't specify
944 /// a security group, the default security group for the VPC is used. There's a limit of 5
945 /// security groups that can be specified. All specified security groups must be from the
946 /// same VPC.
947 #[serde(default)]
948 #[serde(skip_serializing_if = "Vec::is_empty")]
949 pub security_groups: Vec<String>,
950
951 /// Whether the task's elastic network interface receives a public IP address. Consider the
952 /// following when you set this value: When you use create-service or update-service, the
953 /// default is DISABLED. When the service deploymentController is ECS, the value must be
954 /// DISABLED.
955 #[serde(skip_serializing_if = "Option::is_none")]
956 pub assign_public_ip: Option<String>,
957}
958
959impl AwsVpcConfiguration {
960 #[cfg(any(test, feature = "test-support"))]
961 /// Create a fixture instance for testing.
962 pub fn fixture() -> Self {
963 Self {
964 subnets: vec![],
965 security_groups: vec![],
966 assign_public_ip: Some("test-assign_public_ip".into()),
967 }
968 }
969}
970
971///
972/// **AWS API**: `ecs.v1.DescribeTaskDefinitionRequest`
973/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//DescribeTaskDefinitionRequest>
974#[derive(Debug, Clone, Default, Serialize, Deserialize)]
975#[serde(rename_all = "camelCase")]
976pub struct DescribeTaskDefinitionRequest {
977 /// The family for the latest ACTIVE revision, family and revision (family:revision) for a
978 /// specific revision in the family, or full Amazon Resource Name (ARN) of the task
979 /// definition to describe.
980 pub task_definition: String,
981
982 /// Determines whether to see the resource tags for the task definition. If TAGS is
983 /// specified, the tags are included in the response. If this field is omitted, tags aren't
984 /// included in the response.
985 #[serde(default)]
986 #[serde(skip_serializing_if = "Vec::is_empty")]
987 pub include: Vec<String>,
988}
989
990impl DescribeTaskDefinitionRequest {
991 #[cfg(any(test, feature = "test-support"))]
992 /// Create a fixture instance for testing.
993 pub fn fixture() -> Self {
994 Self {
995 task_definition: "test-task_definition".into(),
996 include: vec![],
997 }
998 }
999}
1000
1001///
1002/// **AWS API**: `ecs.v1.DescribeTaskDefinitionResponse`
1003/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//DescribeTaskDefinitionResponse>
1004#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1005#[serde(rename_all = "camelCase")]
1006pub struct DescribeTaskDefinitionResponse {
1007 /// The full task definition description.
1008 #[serde(skip_serializing_if = "Option::is_none")]
1009 pub task_definition: Option<TaskDefinition>,
1010
1011 /// The metadata that's applied to the task definition to help you categorize and organize
1012 /// them. Each tag consists of a key and an optional value. You define both. The following
1013 /// basic restrictions apply to tags: Maximum number of tags per resource - 50 For each
1014 /// resource, each tag key must be unique, and each tag key can have only one value. Maximum
1015 /// key length - 128 Unicode characters in UTF-8 Maximum value length - 256 Unicode
1016 /// characters in UTF-8 If your tagging schema is used across multiple services and
1017 /// resources, remember that other services may have restrictions on allowed characters.
1018 /// Generally allowed characters are: letters, numbers, and spaces representable in UTF-8,
1019 /// and the following characters: + - = . _ : / @. Tag keys and values are case-sensitive.
1020 /// Do not use aws:, AWS:, or any upper or lowercase combination of such as a prefix for
1021 /// either keys or values as it is reserved for Amazon Web Services use. You cannot edit or
1022 /// delete tag keys or values with this prefix. Tags with this prefix do not count against
1023 /// your tags per resource limit.
1024 #[serde(default)]
1025 #[serde(skip_serializing_if = "Vec::is_empty")]
1026 pub tags: Vec<Tag>,
1027}
1028
1029impl DescribeTaskDefinitionResponse {
1030 #[cfg(any(test, feature = "test-support"))]
1031 /// Create a fixture instance for testing.
1032 pub fn fixture() -> Self {
1033 Self {
1034 task_definition: Some(TaskDefinition::fixture()),
1035 tags: vec![],
1036 }
1037 }
1038}
1039
1040/// The details of a task definition which describes the container and volume definitions of an
1041/// Amazon Elastic Container Service task. You can specify which Docker images to use, the
1042/// required resources, and other configurations related to launching the task definition
1043/// through an Amazon ECS service or task.
1044///
1045/// **AWS API**: `ecs.v1.TaskDefinition`
1046/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//TaskDefinition>
1047///
1048/// ## Coverage
1049/// 14 of 25 fields included.
1050/// Omitted fields:
1051/// - `volumes` — not selected in manifest
1052/// - `requiresAttributes` — not selected in manifest
1053/// - `placementConstraints` — not selected in manifest
1054/// - `runtimePlatform` — not selected in manifest
1055/// - `inferenceAccelerators` — not selected in manifest
1056/// - `pidMode` — not selected in manifest
1057/// - `ipcMode` — not selected in manifest
1058/// - `proxyConfiguration` — not selected in manifest
1059/// - `registeredBy` — not selected in manifest
1060/// - `ephemeralStorage` — not selected in manifest
1061/// - `enableFaultInjection` — not selected in manifest
1062#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1063#[serde(rename_all = "camelCase")]
1064pub struct TaskDefinition {
1065 /// The full Amazon Resource Name (ARN) of the task definition.
1066 #[serde(skip_serializing_if = "Option::is_none")]
1067 pub task_definition_arn: Option<String>,
1068
1069 /// A list of container definitions in JSON format that describe the different containers
1070 /// that make up your task. For more information about container definition parameters and
1071 /// defaults, see Amazon ECS Task Definitions in the Amazon Elastic Container Service
1072 /// Developer Guide.
1073 #[serde(default)]
1074 #[serde(skip_serializing_if = "Vec::is_empty")]
1075 pub container_definitions: Vec<ContainerDefinition>,
1076
1077 /// The name of a family that this task definition is registered to. Up to 255 characters
1078 /// are allowed. Letters (both uppercase and lowercase letters), numbers, hyphens (-), and
1079 /// underscores (_) are allowed. A family groups multiple versions of a task definition.
1080 /// Amazon ECS gives the first task definition that you registered to a family a revision
1081 /// number of 1. Amazon ECS gives sequential revision numbers to each task definition that
1082 /// you add.
1083 #[serde(skip_serializing_if = "Option::is_none")]
1084 pub family: Option<String>,
1085
1086 /// The short name or full Amazon Resource Name (ARN) of the Identity and Access Management
1087 /// role that grants containers in the task permission to call Amazon Web Services APIs on
1088 /// your behalf. For informationabout the required IAM roles for Amazon ECS, see IAM roles
1089 /// for Amazon ECS in the Amazon Elastic Container Service Developer Guide.
1090 #[serde(skip_serializing_if = "Option::is_none")]
1091 pub task_role_arn: Option<String>,
1092
1093 /// The Amazon Resource Name (ARN) of the task execution role that grants the Amazon ECS
1094 /// container agent permission to make Amazon Web Services API calls on your behalf. For
1095 /// informationabout the required IAM roles for Amazon ECS, see IAM roles for Amazon ECS in
1096 /// the Amazon Elastic Container Service Developer Guide.
1097 #[serde(skip_serializing_if = "Option::is_none")]
1098 pub execution_role_arn: Option<String>,
1099
1100 /// The Docker networking mode to use for the containers in the task. The valid values are
1101 /// none, bridge, awsvpc, and host. If no network mode is specified, the default is bridge.
1102 /// For Amazon ECS tasks on Fargate, the awsvpc network mode is required. For Amazon ECS
1103 /// tasks on Amazon EC2 Linux instances, any network mode can be used. For Amazon ECS tasks
1104 /// on Amazon EC2 Windows instances, <default> or awsvpc can be used. If the network
1105 /// mode is set to none, you cannot specify port mappings in your container definitions, and
1106 /// the tasks containers do not have external connectivity. The host and awsvpc network
1107 /// modes offer the highest networking performance for containers because they use the EC2
1108 /// network stack instead of the virtualized network stack provided by the bridge mode. With
1109 /// the host and awsvpc network modes, exposed container ports are mapped directly to the
1110 /// corresponding host port (for the host network mode) or the attached elastic network
1111 /// interface port (for the awsvpc network mode), so you cannot take advantage of dynamic
1112 /// host port mappings. When using the host network mode, you should not run containers
1113 /// using the root user (UID 0). It is considered best practice to use a non-root user. If
1114 /// the network mode is awsvpc, the task is allocated an elastic network interface, and you
1115 /// must specify a NetworkConfiguration value when you create a service or run a task with
1116 /// the task definition. For more information, see Task Networking in the Amazon Elastic
1117 /// Container Service Developer Guide. If the network mode is host, you cannot run multiple
1118 /// instantiations of the same task on a single container instance when port mappings are
1119 /// used.
1120 #[serde(skip_serializing_if = "Option::is_none")]
1121 pub network_mode: Option<String>,
1122
1123 /// The revision of the task in a particular family. The revision is a version number of a
1124 /// task definition in a family. When you register a task definition for the first time, the
1125 /// revision is 1. Each time that you register a new revision of a task definition in the
1126 /// same family, the revision value always increases by one. This is even if you
1127 /// deregistered previous revisions in this family.
1128 #[serde(skip_serializing_if = "Option::is_none")]
1129 pub revision: Option<i32>,
1130
1131 /// The status of the task definition.
1132 #[serde(skip_serializing_if = "Option::is_none")]
1133 pub status: Option<String>,
1134
1135 /// Amazon ECS validates the task definition parameters with those supported by the launch
1136 /// type. For more information, see Amazon ECS launch types in the Amazon Elastic Container
1137 /// Service Developer Guide.
1138 #[serde(default)]
1139 #[serde(skip_serializing_if = "Vec::is_empty")]
1140 pub compatibilities: Vec<String>,
1141
1142 /// The task launch types the task definition was validated against. The valid values are
1143 /// MANAGED_INSTANCES, EC2, FARGATE, and EXTERNAL. For more information, see Amazon ECS
1144 /// launch types in the Amazon Elastic Container Service Developer Guide.
1145 #[serde(default)]
1146 #[serde(skip_serializing_if = "Vec::is_empty")]
1147 pub requires_compatibilities: Vec<String>,
1148
1149 /// The number of cpu units used by the task. If you use the EC2 launch type, this field is
1150 /// optional. Any value can be used. If you use the Fargate launch type, this field is
1151 /// required. You must use one of the following values. The value that you choose determines
1152 /// your range of valid values for the memory parameter. If you're using the EC2 launch type
1153 /// or the external launch type, this field is optional. Supported values are between 128
1154 /// CPU units (0.125 vCPUs) and 196608 CPU units (192 vCPUs). This field is required for
1155 /// Fargate. For information about the valid values, see Task size in the Amazon Elastic
1156 /// Container Service Developer Guide.
1157 #[serde(skip_serializing_if = "Option::is_none")]
1158 pub cpu: Option<String>,
1159
1160 /// The amount (in MiB) of memory used by the task. If your tasks runs on Amazon EC2
1161 /// instances, you must specify either a task-level memory value or a container-level memory
1162 /// value. This field is optional and any value can be used. If a task-level memory value is
1163 /// specified, the container-level memory value is optional. For more information regarding
1164 /// container-level memory and memory reservation, see ContainerDefinition. If your tasks
1165 /// runs on Fargate, this field is required. You must use one of the following values. The
1166 /// value you choose determines your range of valid values for the cpu parameter. 512 (0.5
1167 /// GB), 1024 (1 GB), 2048 (2 GB)
1168 /// - Available cpu values: 256 (.25 vCPU) 1024 (1 GB), 2048 (2 GB), 3072 (3 GB), 4096 (4
1169 /// GB)
1170 /// - Available cpu values: 512 (.5 vCPU) 2048 (2 GB), 3072 (3 GB), 4096 (4 GB), 5120 (5
1171 /// GB), 6144 (6 GB), 7168 (7 GB), 8192 (8 GB)
1172 /// - Available cpu values: 1024 (1 vCPU) Between 4096 (4 GB) and 16384 (16 GB) in
1173 /// increments of 1024 (1 GB)
1174 /// - Available cpu values: 2048 (2 vCPU) Between 8192 (8 GB) and 30720 (30 GB) in
1175 /// increments of 1024 (1 GB)
1176 /// - Available cpu values: 4096 (4 vCPU) Between 16 GB and 60 GB in 4 GB increments
1177 /// - Available cpu values: 8192 (8 vCPU) This option requires Linux platform 1.4.0 or
1178 /// later. Between 32GB and 120 GB in 8 GB increments
1179 /// - Available cpu values: 16384 (16 vCPU) This option requires Linux platform 1.4.0 or
1180 /// later.
1181 #[serde(skip_serializing_if = "Option::is_none")]
1182 pub memory: Option<String>,
1183
1184 /// The Unix timestamp for the time when the task definition was registered.
1185 #[serde(skip_serializing_if = "Option::is_none")]
1186 pub registered_at: Option<f64>,
1187
1188 /// The Unix timestamp for the time when the task definition was deregistered.
1189 #[serde(skip_serializing_if = "Option::is_none")]
1190 pub deregistered_at: Option<f64>,
1191}
1192
1193impl TaskDefinition {
1194 #[cfg(any(test, feature = "test-support"))]
1195 /// Create a fixture instance for testing.
1196 pub fn fixture() -> Self {
1197 Self {
1198 task_definition_arn: Some("test-task_definition_arn".into()),
1199 container_definitions: vec![],
1200 family: Some("test-family".into()),
1201 task_role_arn: Some("test-task_role_arn".into()),
1202 execution_role_arn: Some("test-execution_role_arn".into()),
1203 network_mode: Some("test-network_mode".into()),
1204 revision: Some(100),
1205 status: Some("test-status".into()),
1206 compatibilities: vec![],
1207 requires_compatibilities: vec![],
1208 cpu: Some("test-cpu".into()),
1209 memory: Some("test-memory".into()),
1210 ..Default::default()
1211 }
1212 }
1213}
1214
1215/// Container definitions are used in task definitions to describe the different containers that
1216/// are launched as part of a task.
1217///
1218/// **AWS API**: `ecs.v1.ContainerDefinition`
1219/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//ContainerDefinition>
1220///
1221/// ## Coverage
1222/// 11 of 42 fields included.
1223/// Omitted fields:
1224/// - `repositoryCredentials` — not selected in manifest
1225/// - `links` — not selected in manifest
1226/// - `restartPolicy` — not selected in manifest
1227/// - `environmentFiles` — not selected in manifest
1228/// - `mountPoints` — not selected in manifest
1229/// - `volumesFrom` — not selected in manifest
1230/// - `linuxParameters` — not selected in manifest
1231/// - `secrets` — not selected in manifest
1232/// - `dependsOn` — not selected in manifest
1233/// - `startTimeout` — not selected in manifest
1234/// - `stopTimeout` — not selected in manifest
1235/// - `versionConsistency` — not selected in manifest
1236/// - `hostname` — not selected in manifest
1237/// - `user` — not selected in manifest
1238/// - `workingDirectory` — not selected in manifest
1239/// - `disableNetworking` — not selected in manifest
1240/// - `privileged` — not selected in manifest
1241/// - `readonlyRootFilesystem` — not selected in manifest
1242/// - `dnsServers` — not selected in manifest
1243/// - `dnsSearchDomains` — not selected in manifest
1244/// - `extraHosts` — not selected in manifest
1245/// - `dockerSecurityOptions` — not selected in manifest
1246/// - `interactive` — not selected in manifest
1247/// - `pseudoTerminal` — not selected in manifest
1248/// - `dockerLabels` — not selected in manifest
1249/// - `ulimits` — not selected in manifest
1250/// - `healthCheck` — not selected in manifest
1251/// - `systemControls` — not selected in manifest
1252/// - `resourceRequirements` — not selected in manifest
1253/// - `firelensConfiguration` — not selected in manifest
1254/// - `credentialSpecs` — not selected in manifest
1255#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1256#[serde(rename_all = "camelCase")]
1257pub struct ContainerDefinition {
1258 /// The name of a container. If you're linking multiple containers together in a task
1259 /// definition, the name of one container can be entered in the links of another container
1260 /// to connect the containers. Up to 255 letters (uppercase and lowercase), numbers,
1261 /// underscores, and hyphens are allowed. This parameter maps to name in the docker
1262 /// container create command and the --name option to docker run.
1263 #[serde(skip_serializing_if = "Option::is_none")]
1264 pub name: Option<String>,
1265
1266 /// The image used to start a container. This string is passed directly to the Docker
1267 /// daemon. By default, images in the Docker Hub registry are available. Other repositories
1268 /// are specified with either repository-url/image:tag or repository-url/image@digest . For
1269 /// images using tags (repository-url/image:tag), up to 255 characters total are allowed,
1270 /// including letters (uppercase and lowercase), numbers, hyphens, underscores, colons,
1271 /// periods, forward slashes, and number signs (#). For images using digests (repository-
1272 /// url/image@digest), the 255 character limit applies only to the repository URL and image
1273 /// name (everything before the @ sign). The only supported hash function is sha256, and the
1274 /// hash value after sha256: must be exactly 64 characters (only letters A-F, a-f, and
1275 /// numbers 0-9 are allowed). This parameter maps to Image in the docker container create
1276 /// command and the IMAGE parameter of docker run. When a new task starts, the Amazon ECS
1277 /// container agent pulls the latest version of the specified image and tag for the
1278 /// container to use. However, subsequent updates to a repository image aren't propagated to
1279 /// already running tasks. Images in Amazon ECR repositories can be specified by either
1280 /// using the full registry/repository:tag or registry/repository@digest. For example,
1281 /// 012345678910.dkr.ecr.<region-name>.amazonaws.com/<repository-name>:latest or
1282 /// 012345678910.dkr.ecr.<region-name>.amazonaws.com/<repository-
1283 /// name>@sha256:94afd1f2e64d908bc90dbca0035a5b567EXAMPLE. Images in official
1284 /// repositories on Docker Hub use a single name (for example, ubuntu or mongo). Images in
1285 /// other repositories on Docker Hub are qualified with an organization name (for example,
1286 /// amazon/amazon-ecs-agent). Images in other online repositories are qualified further by a
1287 /// domain name (for example, quay.io/assemblyline/ubuntu).
1288 #[serde(skip_serializing_if = "Option::is_none")]
1289 pub image: Option<String>,
1290
1291 /// The number of cpu units reserved for the container. This parameter maps to CpuShares in
1292 /// the docker container create command and the --cpu-shares option to docker run. This
1293 /// field is optional for tasks using the Fargate launch type, and the only requirement is
1294 /// that the total amount of CPU reserved for all containers within a task be lower than the
1295 /// task-level cpu value. You can determine the number of CPU units that are available per
1296 /// EC2 instance type by multiplying the vCPUs listed for that instance type on the Amazon
1297 /// EC2 Instances detail page by 1,024. Linux containers share unallocated CPU units with
1298 /// other containers on the container instance with the same ratio as their allocated
1299 /// amount. For example, if you run a single-container task on a single-core instance type
1300 /// with 512 CPU units specified for that container, and that's the only task running on the
1301 /// container instance, that container could use the full 1,024 CPU unit share at any given
1302 /// time. However, if you launched another copy of the same task on that container instance,
1303 /// each task is guaranteed a minimum of 512 CPU units when needed. Moreover, each container
1304 /// could float to higher CPU usage if the other container was not using it. If both tasks
1305 /// were 100% active all of the time, they would be limited to 512 CPU units. On Linux
1306 /// container instances, the Docker daemon on the container instance uses the CPU value to
1307 /// calculate the relative CPU share ratios for running containers. The minimum valid CPU
1308 /// share value that the Linux kernel allows is 2, and the maximum valid CPU share value
1309 /// that the Linux kernel allows is 262144. However, the CPU parameter isn't required, and
1310 /// you can use CPU values below 2 or above 262144 in your container definitions. For CPU
1311 /// values below 2 (including null) or above 262144, the behavior varies based on your
1312 /// Amazon ECS container agent version: Agent versions less than or equal to 1.1.0: Null and
1313 /// zero CPU values are passed to Docker as 0, which Docker then converts to 1,024 CPU
1314 /// shares. CPU values of 1 are passed to Docker as 1, which the Linux kernel converts to
1315 /// two CPU shares. Agent versions greater than or equal to 1.2.0: Null, zero, and CPU
1316 /// values of 1 are passed to Docker as 2. Agent versions greater than or equal to 1.84.0:
1317 /// CPU values greater than 256 vCPU are passed to Docker as 256, which is equivalent to
1318 /// 262144 CPU shares. On Windows container instances, the CPU limit is enforced as an
1319 /// absolute limit, or a quota. Windows containers only have access to the specified amount
1320 /// of CPU that's described in the task definition. A null or zero CPU value is passed to
1321 /// Docker as 0, which Windows interprets as 1% of one CPU.
1322 #[serde(skip_serializing_if = "Option::is_none")]
1323 pub cpu: Option<i32>,
1324
1325 /// The amount (in MiB) of memory to present to the container. If your container attempts to
1326 /// exceed the memory specified here, the container is killed. The total amount of memory
1327 /// reserved for all containers within a task must be lower than the task memory value, if
1328 /// one is specified. This parameter maps to Memory in the docker container create command
1329 /// and the --memory option to docker run. If using the Fargate launch type, this parameter
1330 /// is optional. If using the EC2 launch type, you must specify either a task-level memory
1331 /// value or a container-level memory value. If you specify both a container-level memory
1332 /// and memoryReservation value, memory must be greater than memoryReservation. If you
1333 /// specify memoryReservation, then that value is subtracted from the available memory
1334 /// resources for the container instance where the container is placed. Otherwise, the value
1335 /// of memory is used. The Docker 20.10.0 or later daemon reserves a minimum of 6 MiB of
1336 /// memory for a container. So, don't specify less than 6 MiB of memory for your containers.
1337 /// The Docker 19.03.13-ce or earlier daemon reserves a minimum of 4 MiB of memory for a
1338 /// container. So, don't specify less than 4 MiB of memory for your containers.
1339 #[serde(skip_serializing_if = "Option::is_none")]
1340 pub memory: Option<i32>,
1341
1342 /// The soft limit (in MiB) of memory to reserve for the container. When system memory is
1343 /// under heavy contention, Docker attempts to keep the container memory to this soft limit.
1344 /// However, your container can consume more memory when it needs to, up to either the hard
1345 /// limit specified with the memory parameter (if applicable), or all of the available
1346 /// memory on the container instance, whichever comes first. This parameter maps to
1347 /// MemoryReservation in the docker container create command and the --memory-reservation
1348 /// option to docker run. If a task-level memory value is not specified, you must specify a
1349 /// non-zero integer for one or both of memory or memoryReservation in a container
1350 /// definition. If you specify both, memory must be greater than memoryReservation. If you
1351 /// specify memoryReservation, then that value is subtracted from the available memory
1352 /// resources for the container instance where the container is placed. Otherwise, the value
1353 /// of memory is used. For example, if your container normally uses 128 MiB of memory, but
1354 /// occasionally bursts to 256 MiB of memory for short periods of time, you can set a
1355 /// memoryReservation of 128 MiB, and a memory hard limit of 300 MiB. This configuration
1356 /// would allow the container to only reserve 128 MiB of memory from the remaining resources
1357 /// on the container instance, but also allow the container to consume more memory resources
1358 /// when needed. The Docker 20.10.0 or later daemon reserves a minimum of 6 MiB of memory
1359 /// for a container. So, don't specify less than 6 MiB of memory for your containers. The
1360 /// Docker 19.03.13-ce or earlier daemon reserves a minimum of 4 MiB of memory for a
1361 /// container. So, don't specify less than 4 MiB of memory for your containers.
1362 #[serde(skip_serializing_if = "Option::is_none")]
1363 pub memory_reservation: Option<i32>,
1364
1365 /// The list of port mappings for the container. Port mappings allow containers to access
1366 /// ports on the host container instance to send or receive traffic. For task definitions
1367 /// that use the awsvpc network mode, only specify the containerPort. The hostPort can be
1368 /// left blank or it must be the same value as the containerPort. Port mappings on Windows
1369 /// use the NetNAT gateway address rather than localhost. There's no loopback for port
1370 /// mappings on Windows, so you can't access a container's mapped port from the host itself.
1371 /// This parameter maps to PortBindings in the docker container create command and the
1372 /// --publish option to docker run. If the network mode of a task definition is set to none,
1373 /// then you can't specify port mappings. If the network mode of a task definition is set to
1374 /// host, then host ports must either be undefined or they must match the container port in
1375 /// the port mapping. After a task reaches the RUNNING status, manual and automatic host and
1376 /// container port assignments are visible in the Network Bindings section of a container
1377 /// description for a selected task in the Amazon ECS console. The assignments are also
1378 /// visible in the networkBindings section DescribeTasks responses.
1379 #[serde(default)]
1380 #[serde(skip_serializing_if = "Vec::is_empty")]
1381 pub port_mappings: Vec<PortMapping>,
1382
1383 /// If the essential parameter of a container is marked as true, and that container fails or
1384 /// stops for any reason, all other containers that are part of the task are stopped. If the
1385 /// essential parameter of a container is marked as false, its failure doesn't affect the
1386 /// rest of the containers in a task. If this parameter is omitted, a container is assumed
1387 /// to be essential. All tasks must have at least one essential container. If you have an
1388 /// application that's composed of multiple containers, group containers that are used for a
1389 /// common purpose into components, and separate the different components into multiple task
1390 /// definitions. For more information, see Application Architecture in the Amazon Elastic
1391 /// Container Service Developer Guide.
1392 #[serde(skip_serializing_if = "Option::is_none")]
1393 pub essential: Option<bool>,
1394
1395 /// The environment variables to pass to a container. This parameter maps to Env in the
1396 /// docker container create command and the --env option to docker run. We don't recommend
1397 /// that you use plaintext environment variables for sensitive information, such as
1398 /// credential data.
1399 #[serde(default)]
1400 #[serde(skip_serializing_if = "Vec::is_empty")]
1401 pub environment: Vec<KeyValuePair>,
1402
1403 /// The command that's passed to the container. This parameter maps to Cmd in the docker
1404 /// container create command and the COMMAND parameter to docker run. If there are multiple
1405 /// arguments, each argument is a separated string in the array.
1406 #[serde(default)]
1407 #[serde(skip_serializing_if = "Vec::is_empty")]
1408 pub command: Vec<String>,
1409
1410 /// Early versions of the Amazon ECS container agent don't properly handle entryPoint
1411 /// parameters. If you have problems using entryPoint, update your container agent or enter
1412 /// your commands and arguments as command array items instead. The entry point that's
1413 /// passed to the container. This parameter maps to Entrypoint in the docker container
1414 /// create command and the --entrypoint option to docker run.
1415 #[serde(default)]
1416 #[serde(skip_serializing_if = "Vec::is_empty")]
1417 pub entry_point: Vec<String>,
1418
1419 /// The log configuration specification for the container. This parameter maps to LogConfig
1420 /// in the docker container create command and the --log-driver option to docker run. By
1421 /// default, containers use the same logging driver that the Docker daemon uses. However the
1422 /// container can use a different logging driver than the Docker daemon by specifying a log
1423 /// driver with this parameter in the container definition. To use a different logging
1424 /// driver for a container, the log system must be configured properly on the container
1425 /// instance (or on a different log server for remote logging options). Amazon ECS currently
1426 /// supports a subset of the logging drivers available to the Docker daemon (shown in the
1427 /// LogConfiguration data type). Additional log drivers may be available in future releases
1428 /// of the Amazon ECS container agent. This parameter requires version 1.18 of the Docker
1429 /// Remote API or greater on your container instance. To check the Docker Remote API version
1430 /// on your container instance, log in to your container instance and run the following
1431 /// command: sudo docker version --format '{{.Server.APIVersion}}' The Amazon ECS container
1432 /// agent running on a container instance must register the logging drivers available on
1433 /// that instance with the ECS_AVAILABLE_LOGGING_DRIVERS environment variable before
1434 /// containers placed on that instance can use these log configuration options. For more
1435 /// information, see Amazon ECS Container Agent Configuration in the Amazon Elastic
1436 /// Container Service Developer Guide.
1437 #[serde(skip_serializing_if = "Option::is_none")]
1438 pub log_configuration: Option<LogConfiguration>,
1439}
1440
1441impl ContainerDefinition {
1442 #[cfg(any(test, feature = "test-support"))]
1443 /// Create a fixture instance for testing.
1444 pub fn fixture() -> Self {
1445 Self {
1446 name: Some("test-container_definition".into()),
1447 image: Some("test-image".into()),
1448 cpu: Some(100),
1449 memory: Some(100),
1450 memory_reservation: Some(100),
1451 port_mappings: vec![],
1452 essential: Some(false),
1453 environment: vec![],
1454 command: vec![],
1455 entry_point: vec![],
1456 log_configuration: Some(LogConfiguration::fixture()),
1457 }
1458 }
1459}
1460
1461/// Port mappings allow containers to access ports on the host container instance to send or
1462/// receive traffic. Port mappings are specified as part of the container definition. If you use
1463/// containers in a task with the awsvpc or host network mode, specify the exposed ports using
1464/// containerPort. The hostPort can be left blank or it must be the same value as the
1465/// containerPort. Most fields of this parameter (containerPort, hostPort, protocol) maps to
1466/// PortBindings in the docker container create command and the --publish option to docker run.
1467/// If the network mode of a task definition is set to host, host ports must either be undefined
1468/// or match the container port in the port mapping. You can't expose the same container port
1469/// for multiple protocols. If you attempt this, an error is returned. After a task reaches the
1470/// RUNNING status, manual and automatic host and container port assignments are visible in the
1471/// networkBindings section of DescribeTasks API responses.
1472///
1473/// **AWS API**: `ecs.v1.PortMapping`
1474/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//PortMapping>
1475///
1476/// ## Coverage
1477/// 3 of 6 fields included.
1478/// Omitted fields:
1479/// - `name` — not selected in manifest
1480/// - `appProtocol` — not selected in manifest
1481/// - `containerPortRange` — not selected in manifest
1482#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1483#[serde(rename_all = "camelCase")]
1484pub struct PortMapping {
1485 /// The port number on the container that's bound to the user-specified or automatically
1486 /// assigned host port. If you use containers in a task with the awsvpc or host network
1487 /// mode, specify the exposed ports using containerPort. If you use containers in a task
1488 /// with the bridge network mode and you specify a container port and not a host port, your
1489 /// container automatically receives a host port in the ephemeral port range. For more
1490 /// information, see hostPort. Port mappings that are automatically assigned in this way do
1491 /// not count toward the 100 reserved ports limit of a container instance.
1492 #[serde(skip_serializing_if = "Option::is_none")]
1493 pub container_port: Option<i32>,
1494
1495 /// The port number on the container instance to reserve for your container. If you specify
1496 /// a containerPortRange, leave this field empty and the value of the hostPort is set as
1497 /// follows: For containers in a task with the awsvpc network mode, the hostPort is set to
1498 /// the same value as the containerPort. This is a static mapping strategy. For containers
1499 /// in a task with the bridge network mode, the Amazon ECS agent finds open ports on the
1500 /// host and automatically binds them to the container ports. This is a dynamic mapping
1501 /// strategy. If you use containers in a task with the awsvpc or host network mode, the
1502 /// hostPort can either be left blank or set to the same value as the containerPort. If you
1503 /// use containers in a task with the bridge network mode, you can specify a non-reserved
1504 /// host port for your container port mapping, or you can omit the hostPort (or set it to 0)
1505 /// while specifying a containerPort and your container automatically receives a port in the
1506 /// ephemeral port range for your container instance operating system and Docker version.
1507 /// The default ephemeral port range for Docker version 1.6.0 and later is listed on the
1508 /// instance under /proc/sys/net/ipv4/ip_local_port_range. If this kernel parameter is
1509 /// unavailable, the default ephemeral port range from 49153 through 65535 (Linux) or 49152
1510 /// through 65535 (Windows) is used. Do not attempt to specify a host port in the ephemeral
1511 /// port range as these are reserved for automatic assignment. In general, ports below 32768
1512 /// are outside of the ephemeral port range. The default reserved ports are 22 for SSH, the
1513 /// Docker ports 2375 and 2376, and the Amazon ECS container agent ports 51678-51680. Any
1514 /// host port that was previously specified in a running task is also reserved while the
1515 /// task is running. That is, after a task stops, the host port is released. The current
1516 /// reserved ports are displayed in the remainingResources of DescribeContainerInstances
1517 /// output. A container instance can have up to 100 reserved ports at a time. This number
1518 /// includes the default reserved ports. Automatically assigned ports aren't included in the
1519 /// 100 reserved ports quota.
1520 #[serde(skip_serializing_if = "Option::is_none")]
1521 pub host_port: Option<i32>,
1522
1523 /// The protocol used for the port mapping. Valid values are tcp and udp. The default is
1524 /// tcp. protocol is immutable in a Service Connect service. Updating this field requires a
1525 /// service deletion and redeployment.
1526 #[serde(skip_serializing_if = "Option::is_none")]
1527 pub protocol: Option<String>,
1528}
1529
1530impl PortMapping {
1531 #[cfg(any(test, feature = "test-support"))]
1532 /// Create a fixture instance for testing.
1533 pub fn fixture() -> Self {
1534 Self {
1535 container_port: Some(100),
1536 host_port: Some(100),
1537 protocol: Some("test-protocol".into()),
1538 }
1539 }
1540}
1541
1542/// The log configuration for the container. This parameter maps to LogConfig in the docker
1543/// container create command and the --log-driver option to docker run. By default, containers
1544/// use the same logging driver that the Docker daemon uses. However, the container might use a
1545/// different logging driver than the Docker daemon by specifying a log driver configuration in
1546/// the container definition. Understand the following when specifying a log configuration for
1547/// your containers. Amazon ECS currently supports a subset of the logging drivers available to
1548/// the Docker daemon. Additional log drivers may be available in future releases of the Amazon
1549/// ECS container agent. For tasks on Fargate, the supported log drivers are awslogs, splunk,
1550/// and awsfirelens. For tasks hosted on Amazon EC2 instances, the supported log drivers are
1551/// awslogs, fluentd, gelf, json-file, journald,syslog, splunk, and awsfirelens. This parameter
1552/// requires version 1.18 of the Docker Remote API or greater on your container instance. For
1553/// tasks that are hosted on Amazon EC2 instances, the Amazon ECS container agent must register
1554/// the available logging drivers with the ECS_AVAILABLE_LOGGING_DRIVERS environment variable
1555/// before containers placed on that instance can use these log configuration options. For more
1556/// information, see Amazon ECS container agent configuration in the Amazon Elastic Container
1557/// Service Developer Guide. For tasks that are on Fargate, because you don't have access to the
1558/// underlying infrastructure your tasks are hosted on, any additional software needed must be
1559/// installed outside of the task. For example, the Fluentd output aggregators or a remote host
1560/// running Logstash to send Gelf logs to.
1561///
1562/// **AWS API**: `ecs.v1.LogConfiguration`
1563/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//LogConfiguration>
1564///
1565/// ## Coverage
1566/// 2 of 3 fields included.
1567/// Omitted fields:
1568/// - `secretOptions` — not selected in manifest
1569#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1570#[serde(rename_all = "camelCase")]
1571pub struct LogConfiguration {
1572 /// The log driver to use for the container. For tasks on Fargate, the supported log drivers
1573 /// are awslogs, splunk, and awsfirelens. For tasks hosted on Amazon EC2 instances, the
1574 /// supported log drivers are awslogs, fluentd, gelf, json-file, journald, syslog, splunk,
1575 /// and awsfirelens. For more information about using the awslogs log driver, see Send
1576 /// Amazon ECS logs to CloudWatch in the Amazon Elastic Container Service Developer Guide.
1577 /// For more information about using the awsfirelens log driver, see Send Amazon ECS logs to
1578 /// an Amazon Web Services service or Amazon Web Services Partner. If you have a custom
1579 /// driver that isn't listed, you can fork the Amazon ECS container agent project that's
1580 /// available on GitHub and customize it to work with that driver. We encourage you to
1581 /// submit pull requests for changes that you would like to have included. However, we don't
1582 /// currently provide support for running modified copies of this software.
1583 pub log_driver: String,
1584
1585 /// The configuration options to send to the log driver. The options you can specify depend
1586 /// on the log driver. Some of the options you can specify when you use the awslogs log
1587 /// driver to route logs to Amazon CloudWatch include the following: awslogs-create-group
1588 /// Required: No Specify whether you want the log group to be created automatically. If this
1589 /// option isn't specified, it defaults to false. Your IAM policy must include the
1590 /// logs:CreateLogGroup permission before you attempt to use awslogs-create-group. awslogs-
1591 /// region Required: Yes Specify the Amazon Web Services Region that the awslogs log driver
1592 /// is to send your Docker logs to. You can choose to send all of your logs from clusters in
1593 /// different Regions to a single region in CloudWatch Logs. This is so that they're all
1594 /// visible in one location. Otherwise, you can separate them by Region for more
1595 /// granularity. Make sure that the specified log group exists in the Region that you
1596 /// specify with this option. awslogs-group Required: Yes Make sure to specify a log group
1597 /// that the awslogs log driver sends its log streams to. awslogs-stream-prefix Required:
1598 /// Yes, when using Fargate.Optional when using EC2. Use the awslogs-stream-prefix option to
1599 /// associate a log stream with the specified prefix, the container name, and the ID of the
1600 /// Amazon ECS task that the container belongs to. If you specify a prefix with this option,
1601 /// then the log stream takes the format prefix-name/container-name/ecs-task-id. If you
1602 /// don't specify a prefix with this option, then the log stream is named after the
1603 /// container ID that's assigned by the Docker daemon on the container instance. Because
1604 /// it's difficult to trace logs back to the container that sent them with just the Docker
1605 /// container ID (which is only available on the container instance), we recommend that you
1606 /// specify a prefix with this option. For Amazon ECS services, you can use the service name
1607 /// as the prefix. Doing so, you can trace log streams to the service that the container
1608 /// belongs to, the name of the container that sent them, and the ID of the task that the
1609 /// container belongs to. You must specify a stream-prefix for your logs to have your logs
1610 /// appear in the Log pane when using the Amazon ECS console. awslogs-datetime-format
1611 /// Required: No This option defines a multiline start pattern in Python strftime format. A
1612 /// log message consists of a line that matches the pattern and any following lines that
1613 /// don’t match the pattern. The matched line is the delimiter between log messages. One
1614 /// example of a use case for using this format is for parsing output such as a stack dump,
1615 /// which might otherwise be logged in multiple entries. The correct pattern allows it to be
1616 /// captured in a single entry. For more information, see awslogs-datetime-format. You
1617 /// cannot configure both the awslogs-datetime-format and awslogs-multiline-pattern options.
1618 /// Multiline logging performs regular expression parsing and matching of all log messages.
1619 /// This might have a negative impact on logging performance. awslogs-multiline-pattern
1620 /// Required: No This option defines a multiline start pattern that uses a regular
1621 /// expression. A log message consists of a line that matches the pattern and any following
1622 /// lines that don’t match the pattern. The matched line is the delimiter between log
1623 /// messages. For more information, see awslogs-multiline-pattern. This option is ignored if
1624 /// awslogs-datetime-format is also configured. You cannot configure both the awslogs-
1625 /// datetime-format and awslogs-multiline-pattern options. Multiline logging performs
1626 /// regular expression parsing and matching of all log messages. This might have a negative
1627 /// impact on logging performance. The following options apply to all supported log drivers.
1628 /// mode Required: No Valid values: non-blocking | blocking This option defines the delivery
1629 /// mode of log messages from the container to the log driver specified using logDriver. The
1630 /// delivery mode you choose affects application availability when the flow of logs from
1631 /// container is interrupted. If you use the blocking mode and the flow of logs is
1632 /// interrupted, calls from container code to write to the stdout and stderr streams will
1633 /// block. The logging thread of the application will block as a result. This may cause the
1634 /// application to become unresponsive and lead to container healthcheck failure. If you use
1635 /// the non-blocking mode, the container's logs are instead stored in an in-memory
1636 /// intermediate buffer configured with the max-buffer-size option. This prevents the
1637 /// application from becoming unresponsive when logs cannot be sent. We recommend using this
1638 /// mode if you want to ensure service availability and are okay with some log loss. For
1639 /// more information, see Preventing log loss with non-blocking mode in the awslogs
1640 /// container log driver. You can set a default mode for all containers in a specific Amazon
1641 /// Web Services Region by using the defaultLogDriverMode account setting. If you don't
1642 /// specify the mode option or configure the account setting, Amazon ECS will default to the
1643 /// non-blocking mode. For more information about the account setting, see Default log
1644 /// driver mode in the Amazon Elastic Container Service Developer Guide. On June 25, 2025,
1645 /// Amazon ECS changed the default log driver mode from blocking to non-blocking to
1646 /// prioritize task availability over logging. To continue using the blocking mode after
1647 /// this change, do one of the following: Set the mode option in your container definition's
1648 /// logConfiguration as blocking. Set the defaultLogDriverMode account setting to blocking.
1649 /// max-buffer-size Required: No Default value: 10m When non-blocking mode is used, the max-
1650 /// buffer-size log option controls the size of the buffer that's used for intermediate
1651 /// message storage. Make sure to specify an adequate buffer size based on your application.
1652 /// When the buffer fills up, further logs cannot be stored. Logs that cannot be stored are
1653 /// lost. To route logs using the splunk log router, you need to specify a splunk-token and
1654 /// a splunk-url. When you use the awsfirelens log router to route logs to an Amazon Web
1655 /// Services Service or Amazon Web Services Partner Network destination for log storage and
1656 /// analytics, you can set the log-driver-buffer-limit option to limit the number of events
1657 /// that are buffered in memory, before being sent to the log router container. It can help
1658 /// to resolve potential log loss issue because high throughput might result in memory
1659 /// running out for the buffer inside of Docker. Other options you can specify when using
1660 /// awsfirelens to route logs depend on the destination. When you export logs to Amazon Data
1661 /// Firehose, you can specify the Amazon Web Services Region with region and a name for the
1662 /// log stream with delivery_stream. When you export logs to Amazon Kinesis Data Streams,
1663 /// you can specify an Amazon Web Services Region with region and a data stream name with
1664 /// stream. When you export logs to Amazon OpenSearch Service, you can specify options like
1665 /// Name, Host (OpenSearch Service endpoint without protocol), Port, Index, Type, Aws_auth,
1666 /// Aws_region, Suppress_Type_Name, and tls. For more information, see Under the hood:
1667 /// FireLens for Amazon ECS Tasks. When you export logs to Amazon S3, you can specify the
1668 /// bucket using the bucket option. You can also specify region, total_file_size,
1669 /// upload_timeout, and use_put_object as options. This parameter requires version 1.19 of
1670 /// the Docker Remote API or greater on your container instance. To check the Docker Remote
1671 /// API version on your container instance, log in to your container instance and run the
1672 /// following command: sudo docker version --format '{{.Server.APIVersion}}'
1673 #[serde(default)]
1674 #[serde(skip_serializing_if = "HashMap::is_empty")]
1675 pub options: HashMap<String, String>,
1676}
1677
1678impl LogConfiguration {
1679 #[cfg(any(test, feature = "test-support"))]
1680 /// Create a fixture instance for testing.
1681 pub fn fixture() -> Self {
1682 Self {
1683 log_driver: "test-log_driver".into(),
1684 options: Default::default(),
1685 }
1686 }
1687}
1688
1689///
1690/// **AWS API**: `ecs.v1.UpdateServiceRequest`
1691/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//UpdateServiceRequest>
1692///
1693/// ## Coverage
1694/// 7 of 22 fields included.
1695/// Omitted fields:
1696/// - `capacityProviderStrategy` — not selected in manifest
1697/// - `deploymentConfiguration` — not selected in manifest
1698/// - `availabilityZoneRebalancing` — not selected in manifest
1699/// - `placementConstraints` — not selected in manifest
1700/// - `placementStrategy` — not selected in manifest
1701/// - `platformVersion` — not selected in manifest
1702/// - `deploymentController` — not selected in manifest
1703/// - `enableExecuteCommand` — not selected in manifest
1704/// - `enableECSManagedTags` — not selected in manifest
1705/// - `loadBalancers` — not selected in manifest
1706/// - `propagateTags` — not selected in manifest
1707/// - `serviceRegistries` — not selected in manifest
1708/// - `serviceConnectConfiguration` — not selected in manifest
1709/// - `volumeConfigurations` — not selected in manifest
1710/// - `vpcLatticeConfigurations` — not selected in manifest
1711#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1712#[serde(rename_all = "camelCase")]
1713pub struct UpdateServiceRequest {
1714 /// The short name or full Amazon Resource Name (ARN) of the cluster that your service runs
1715 /// on. If you do not specify a cluster, the default cluster is assumed. You can't change
1716 /// the cluster name.
1717 #[serde(skip_serializing_if = "Option::is_none")]
1718 pub cluster: Option<String>,
1719
1720 /// The name of the service to update.
1721 pub service: String,
1722
1723 /// The number of instantiations of the task to place and keep running in your service. This
1724 /// parameter doesn't trigger a new service deployment.
1725 #[serde(skip_serializing_if = "Option::is_none")]
1726 pub desired_count: Option<i32>,
1727
1728 /// The family and revision (family:revision) or full ARN of the task definition to run in
1729 /// your service. If a revision is not specified, the latest ACTIVE revision is used. If you
1730 /// modify the task definition with UpdateService, Amazon ECS spawns a task with the new
1731 /// version of the task definition and then stops an old task after the new version is
1732 /// running. This parameter triggers a new service deployment.
1733 #[serde(skip_serializing_if = "Option::is_none")]
1734 pub task_definition: Option<String>,
1735
1736 /// An object representing the network configuration for the service. This parameter
1737 /// triggers a new service deployment.
1738 #[serde(skip_serializing_if = "Option::is_none")]
1739 pub network_configuration: Option<NetworkConfiguration>,
1740
1741 /// Determines whether to force a new deployment of the service. By default, deployments
1742 /// aren't forced. You can use this option to start a new deployment with no service
1743 /// definition changes. For example, you can update a service's tasks to use a newer Docker
1744 /// image with the same image/tag combination (my_image:latest) or to roll Fargate tasks
1745 /// onto a newer platform version.
1746 #[serde(skip_serializing_if = "Option::is_none")]
1747 pub force_new_deployment: Option<bool>,
1748
1749 /// The period of time, in seconds, that the Amazon ECS service scheduler ignores unhealthy
1750 /// Elastic Load Balancing, VPC Lattice, and container health checks after a task has first
1751 /// started. If you don't specify a health check grace period value, the default value of 0
1752 /// is used. If you don't use any of the health checks, then healthCheckGracePeriodSeconds
1753 /// is unused. If your service's tasks take a while to start and respond to health checks,
1754 /// you can specify a health check grace period of up to 2,147,483,647 seconds (about 69
1755 /// years). During that time, the Amazon ECS service scheduler ignores health check status.
1756 /// This grace period can prevent the service scheduler from marking tasks as unhealthy and
1757 /// stopping them before they have time to come up. If your service has more running tasks
1758 /// than desired, unhealthy tasks in the grace period might be stopped to reach the desired
1759 /// count. This parameter doesn't trigger a new service deployment.
1760 #[serde(skip_serializing_if = "Option::is_none")]
1761 pub health_check_grace_period_seconds: Option<i32>,
1762}
1763
1764impl UpdateServiceRequest {
1765 #[cfg(any(test, feature = "test-support"))]
1766 /// Create a fixture instance for testing.
1767 pub fn fixture() -> Self {
1768 Self {
1769 cluster: Some("test-cluster".into()),
1770 service: "test-service".into(),
1771 desired_count: Some(100),
1772 task_definition: Some("test-task_definition".into()),
1773 network_configuration: Some(NetworkConfiguration::fixture()),
1774 force_new_deployment: Some(false),
1775 health_check_grace_period_seconds: Some(100),
1776 }
1777 }
1778}
1779
1780///
1781/// **AWS API**: `ecs.v1.UpdateServiceResponse`
1782/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//UpdateServiceResponse>
1783#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1784#[serde(rename_all = "camelCase")]
1785pub struct UpdateServiceResponse {
1786 /// The full description of your service following the update call.
1787 #[serde(skip_serializing_if = "Option::is_none")]
1788 pub service: Option<Service>,
1789}
1790
1791impl UpdateServiceResponse {
1792 #[cfg(any(test, feature = "test-support"))]
1793 /// Create a fixture instance for testing.
1794 pub fn fixture() -> Self {
1795 Self {
1796 service: Some(Service::fixture()),
1797 }
1798 }
1799}
1800
1801///
1802/// **AWS API**: `ecs.v1.DeregisterTaskDefinitionRequest`
1803/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//DeregisterTaskDefinitionRequest>
1804#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1805#[serde(rename_all = "camelCase")]
1806pub struct DeregisterTaskDefinitionRequest {
1807 /// The family and revision (family:revision) or full Amazon Resource Name (ARN) of the task
1808 /// definition to deregister. You must specify a revision.
1809 pub task_definition: String,
1810}
1811
1812impl DeregisterTaskDefinitionRequest {
1813 #[cfg(any(test, feature = "test-support"))]
1814 /// Create a fixture instance for testing.
1815 pub fn fixture() -> Self {
1816 Self {
1817 task_definition: "test-task_definition".into(),
1818 }
1819 }
1820}
1821
1822///
1823/// **AWS API**: `ecs.v1.DeregisterTaskDefinitionResponse`
1824/// **Reference**: <https://docs.aws.amazon.com/AmazonECS/latest/APIReference//DeregisterTaskDefinitionResponse>
1825#[derive(Debug, Clone, Default, Serialize, Deserialize)]
1826#[serde(rename_all = "camelCase")]
1827pub struct DeregisterTaskDefinitionResponse {
1828 /// The full description of the deregistered task.
1829 #[serde(skip_serializing_if = "Option::is_none")]
1830 pub task_definition: Option<TaskDefinition>,
1831}
1832
1833impl DeregisterTaskDefinitionResponse {
1834 #[cfg(any(test, feature = "test-support"))]
1835 /// Create a fixture instance for testing.
1836 pub fn fixture() -> Self {
1837 Self {
1838 task_definition: Some(TaskDefinition::fixture()),
1839 }
1840 }
1841}