registerDaemonTaskDefinition method
Registers a new daemon task definition from the supplied
family and containerDefinitions. Optionally, you
can add data volumes to your containers with the volumes
parameter. For more information, see Daemon
task definitions in the Amazon Elastic Container Service Developer
Guide.
A daemon task definition is a template that describes the containers that form a daemon. Daemons deploy cross-cutting software agents such as security monitoring, telemetry, and logging across your Amazon ECS infrastructure.
Each time you call RegisterDaemonTaskDefinition, a new
revision of the daemon task definition is created. You can't modify a
revision after you register it.
May throw AccessDeniedException.
May throw ClientException.
May throw InvalidParameterException.
May throw LimitExceededException.
May throw ServerException.
Parameter containerDefinitions :
A list of container definitions in JSON format that describe the
containers that make up your daemon task.
Parameter family :
You must specify a family for a daemon task definition. This
family is used as a name for your daemon task definition. Up to 255
letters (uppercase and lowercase), numbers, underscores, and hyphens are
allowed.
Parameter cpu :
The number of CPU units used by the daemon task. It can be expressed as an
integer using CPU units (for example, 1024).
Parameter executionRoleArn :
The Amazon Resource Name (ARN) of the task execution role that grants the
Amazon ECS container agent permission to make Amazon Web Services API
calls on your behalf. The task execution role is required for daemon tasks
that pull container images from Amazon ECR or send container logs to
CloudWatch.
Parameter memory :
The amount of memory (in MiB) used by the daemon task. It can be expressed
as an integer using MiB (for example, 1024).
Parameter tags :
The metadata that you apply to the daemon task definition to help you
categorize and organize them. Each tag consists of a key and an optional
value. You define both of them.
The following basic restrictions apply to tags:
- Maximum number of tags per resource - 50
- For each resource, each tag key must be unique, and each tag key can have only one value.
- Maximum key length - 128 Unicode characters in UTF-8
- Maximum value length - 256 Unicode characters in UTF-8
- If your tagging schema is used across multiple services and resources, remember that other services may have restrictions on allowed characters. Generally allowed characters are: letters, numbers, and spaces representable in UTF-8, and the following characters: + - = . _ : / @.
- Tag keys and values are case-sensitive.
-
Do not use
aws:,AWS:, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.
Parameter taskRoleArn :
The short name or full Amazon Resource Name (ARN) of the IAM role that
containers in this daemon task can assume. All containers in this daemon
task are granted the permissions that are specified in this role.
Parameter volumes :
A list of volume definitions in JSON format that containers in your daemon
task can use.
Implementation
Future<RegisterDaemonTaskDefinitionResponse> registerDaemonTaskDefinition({
required List<DaemonContainerDefinition> containerDefinitions,
required String family,
String? cpu,
String? executionRoleArn,
String? memory,
List<Tag>? tags,
String? taskRoleArn,
List<DaemonVolume>? volumes,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target':
'AmazonEC2ContainerServiceV20141113.RegisterDaemonTaskDefinition'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'containerDefinitions': containerDefinitions,
'family': family,
if (cpu != null) 'cpu': cpu,
if (executionRoleArn != null) 'executionRoleArn': executionRoleArn,
if (memory != null) 'memory': memory,
if (tags != null) 'tags': tags,
if (taskRoleArn != null) 'taskRoleArn': taskRoleArn,
if (volumes != null) 'volumes': volumes,
},
);
return RegisterDaemonTaskDefinitionResponse.fromJson(jsonResponse.body);
}