MachineImage.fromJson constructor

MachineImage.fromJson(
  1. Object? j
)

Implementation

factory MachineImage.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return MachineImage(
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    guestFlush: switch (json['guestFlush']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    instanceProperties: switch (json['instanceProperties']) {
      null => null,
      Object $1 => InstanceProperties.fromJson($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    labelFingerprint: switch (json['labelFingerprint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    machineImageEncryptionKey: switch (json['machineImageEncryptionKey']) {
      null => null,
      Object $1 => CustomerEncryptionKey.fromJson($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => MachineImageParams.fromJson($1),
    },
    satisfiesPzi: switch (json['satisfiesPzi']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    savedDisks: switch (json['savedDisks']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) SavedDisk.fromJson(i)],
      _ => throw const FormatException('"savedDisks" is not a list'),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceDiskEncryptionKeys: switch (json['sourceDiskEncryptionKeys']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) SourceDiskEncryptionKey.fromJson(i),
      ],
      _ => throw const FormatException(
        '"sourceDiskEncryptionKeys" is not a list',
      ),
    },
    sourceInstance: switch (json['sourceInstance']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceInstanceProperties: switch (json['sourceInstanceProperties']) {
      null => null,
      Object $1 => SourceInstanceProperties.fromJson($1),
    },
    status: switch (json['status']) {
      null => null,
      Object $1 => decodeString($1),
    },
    storageLocations: switch (json['storageLocations']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"storageLocations" is not a list'),
    },
    totalStorageBytes: switch (json['totalStorageBytes']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
  );
}