StatefulPolicyPreservedState.fromJson constructor

StatefulPolicyPreservedState.fromJson(
  1. Object? j
)

Implementation

factory StatefulPolicyPreservedState.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return StatefulPolicyPreservedState(
    disks: switch (json['disks']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key):
              StatefulPolicyPreservedStateDiskDevice.fromJson(e.value),
      },
      _ => throw const FormatException('"disks" is not an object'),
    },
    externalIPs: switch (json['externalIPs']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): StatefulPolicyPreservedStateNetworkIp.fromJson(
            e.value,
          ),
      },
      _ => throw const FormatException('"externalIPs" is not an object'),
    },
    internalIPs: switch (json['internalIPs']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): StatefulPolicyPreservedStateNetworkIp.fromJson(
            e.value,
          ),
      },
      _ => throw const FormatException('"internalIPs" is not an object'),
    },
  );
}