PolicyDetails.fromJson constructor

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

Implementation

factory PolicyDetails.fromJson(Map<String, dynamic> json) {
  return PolicyDetails(
    actions: (json['Actions'] as List?)
        ?.whereNotNull()
        .map((e) => Action.fromJson(e as Map<String, dynamic>))
        .toList(),
    eventSource: json['EventSource'] != null
        ? EventSource.fromJson(json['EventSource'] as Map<String, dynamic>)
        : null,
    parameters: json['Parameters'] != null
        ? Parameters.fromJson(json['Parameters'] as Map<String, dynamic>)
        : null,
    policyType: (json['PolicyType'] as String?)?.toPolicyTypeValues(),
    resourceTypes: (json['ResourceTypes'] as List?)
        ?.whereNotNull()
        .map((e) => (e as String).toResourceTypeValues())
        .toList(),
    schedules: (json['Schedules'] as List?)
        ?.whereNotNull()
        .map((e) => Schedule.fromJson(e as Map<String, dynamic>))
        .toList(),
    targetTags: (json['TargetTags'] as List?)
        ?.whereNotNull()
        .map((e) => Tag.fromJson(e as Map<String, dynamic>))
        .toList(),
  );
}