Command.fromJson constructor

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

Implementation

factory Command.fromJson(Map<String, dynamic> json) {
  return Command(
    cloudWatchOutputConfig: json['CloudWatchOutputConfig'] != null
        ? CloudWatchOutputConfig.fromJson(
            json['CloudWatchOutputConfig'] as Map<String, dynamic>)
        : null,
    commandId: json['CommandId'] as String?,
    comment: json['Comment'] as String?,
    completedCount: json['CompletedCount'] as int?,
    deliveryTimedOutCount: json['DeliveryTimedOutCount'] as int?,
    documentName: json['DocumentName'] as String?,
    documentVersion: json['DocumentVersion'] as String?,
    errorCount: json['ErrorCount'] as int?,
    expiresAfter: timeStampFromJson(json['ExpiresAfter']),
    instanceIds: (json['InstanceIds'] as List?)
        ?.whereNotNull()
        .map((e) => e as String)
        .toList(),
    maxConcurrency: json['MaxConcurrency'] as String?,
    maxErrors: json['MaxErrors'] as String?,
    notificationConfig: json['NotificationConfig'] != null
        ? NotificationConfig.fromJson(
            json['NotificationConfig'] as Map<String, dynamic>)
        : null,
    outputS3BucketName: json['OutputS3BucketName'] as String?,
    outputS3KeyPrefix: json['OutputS3KeyPrefix'] as String?,
    outputS3Region: json['OutputS3Region'] as String?,
    parameters: (json['Parameters'] as Map<String, dynamic>?)?.map((k, e) =>
        MapEntry(
            k, (e as List).whereNotNull().map((e) => e as String).toList())),
    requestedDateTime: timeStampFromJson(json['RequestedDateTime']),
    serviceRole: json['ServiceRole'] as String?,
    status: (json['Status'] as String?)?.toCommandStatus(),
    statusDetails: json['StatusDetails'] as String?,
    targetCount: json['TargetCount'] as int?,
    targets: (json['Targets'] as List?)
        ?.whereNotNull()
        .map((e) => Target.fromJson(e as Map<String, dynamic>))
        .toList(),
    timeoutSeconds: json['TimeoutSeconds'] as int?,
  );
}