TaskDefinition.fromJson constructor

TaskDefinition.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory TaskDefinition.fromJson(Map<String, dynamic> json) {
  return TaskDefinition(
    compatibilities: (json['compatibilities'] as List?)
        ?.whereNotNull()
        .map((e) => (e as String).toCompatibility())
        .toList(),
    containerDefinitions: (json['containerDefinitions'] as List?)
        ?.whereNotNull()
        .map((e) => ContainerDefinition.fromJson(e as Map<String, dynamic>))
        .toList(),
    cpu: json['cpu'] as String?,
    executionRoleArn: json['executionRoleArn'] as String?,
    family: json['family'] as String?,
    inferenceAccelerators: (json['inferenceAccelerators'] as List?)
        ?.whereNotNull()
        .map((e) => InferenceAccelerator.fromJson(e as Map<String, dynamic>))
        .toList(),
    ipcMode: (json['ipcMode'] as String?)?.toIpcMode(),
    memory: json['memory'] as String?,
    networkMode: (json['networkMode'] as String?)?.toNetworkMode(),
    pidMode: (json['pidMode'] as String?)?.toPidMode(),
    placementConstraints: (json['placementConstraints'] as List?)
        ?.whereNotNull()
        .map((e) => TaskDefinitionPlacementConstraint.fromJson(
            e as Map<String, dynamic>))
        .toList(),
    proxyConfiguration: json['proxyConfiguration'] != null
        ? ProxyConfiguration.fromJson(
            json['proxyConfiguration'] as Map<String, dynamic>)
        : null,
    requiresAttributes: (json['requiresAttributes'] as List?)
        ?.whereNotNull()
        .map((e) => Attribute.fromJson(e as Map<String, dynamic>))
        .toList(),
    requiresCompatibilities: (json['requiresCompatibilities'] as List?)
        ?.whereNotNull()
        .map((e) => (e as String).toCompatibility())
        .toList(),
    revision: json['revision'] as int?,
    status: (json['status'] as String?)?.toTaskDefinitionStatus(),
    taskDefinitionArn: json['taskDefinitionArn'] as String?,
    taskRoleArn: json['taskRoleArn'] as String?,
    volumes: (json['volumes'] as List?)
        ?.whereNotNull()
        .map((e) => Volume.fromJson(e as Map<String, dynamic>))
        .toList(),
  );
}