Alarm.fromJson constructor

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

Implementation

factory Alarm.fromJson(Map<String, dynamic> json) {
  return Alarm(
    arn: json['arn'] as String?,
    comparisonOperator:
        (json['comparisonOperator'] as String?)?.toComparisonOperator(),
    contactProtocols: (json['contactProtocols'] as List?)
        ?.whereNotNull()
        .map((e) => (e as String).toContactProtocol())
        .toList(),
    createdAt: timeStampFromJson(json['createdAt']),
    datapointsToAlarm: json['datapointsToAlarm'] as int?,
    evaluationPeriods: json['evaluationPeriods'] as int?,
    location: json['location'] != null
        ? ResourceLocation.fromJson(json['location'] as Map<String, dynamic>)
        : null,
    metricName: (json['metricName'] as String?)?.toMetricName(),
    monitoredResourceInfo: json['monitoredResourceInfo'] != null
        ? MonitoredResourceInfo.fromJson(
            json['monitoredResourceInfo'] as Map<String, dynamic>)
        : null,
    name: json['name'] as String?,
    notificationEnabled: json['notificationEnabled'] as bool?,
    notificationTriggers: (json['notificationTriggers'] as List?)
        ?.whereNotNull()
        .map((e) => (e as String).toAlarmState())
        .toList(),
    period: json['period'] as int?,
    resourceType: (json['resourceType'] as String?)?.toResourceType(),
    state: (json['state'] as String?)?.toAlarmState(),
    statistic: (json['statistic'] as String?)?.toMetricStatistic(),
    supportCode: json['supportCode'] as String?,
    threshold: json['threshold'] as double?,
    treatMissingData:
        (json['treatMissingData'] as String?)?.toTreatMissingData(),
    unit: (json['unit'] as String?)?.toMetricUnit(),
  );
}