Snapshot.fromJson constructor

Snapshot.fromJson(
  1. Object? j
)

Implementation

factory Snapshot.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Snapshot(
    architecture: switch (json['architecture']) {
      null => null,
      Object $1 => decodeString($1),
    },
    autoCreated: switch (json['autoCreated']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    chainName: switch (json['chainName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    creationSizeBytes: switch (json['creationSizeBytes']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    diskSizeGb: switch (json['diskSizeGb']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    downloadBytes: switch (json['downloadBytes']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    enableConfidentialCompute: switch (json['enableConfidentialCompute']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    guestFlush: switch (json['guestFlush']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    guestOsFeatures: switch (json['guestOsFeatures']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) GuestOsFeature.fromJson(i)],
      _ => throw const FormatException('"guestOsFeatures" is not a list'),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($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'),
    },
    licenseCodes: switch (json['licenseCodes']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeInt64(i)],
      _ => throw const FormatException('"licenseCodes" is not a list'),
    },
    licenses: switch (json['licenses']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"licenses" is not a list'),
    },
    locationHint: switch (json['locationHint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => SnapshotParams.fromJson($1),
    },
    region: switch (json['region']) {
      null => null,
      Object $1 => decodeString($1),
    },
    satisfiesPzi: switch (json['satisfiesPzi']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    snapshotEncryptionKey: switch (json['snapshotEncryptionKey']) {
      null => null,
      Object $1 => CustomerEncryptionKey.fromJson($1),
    },
    snapshotGroupId: switch (json['snapshotGroupId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    snapshotGroupName: switch (json['snapshotGroupName']) {
      null => null,
      Object $1 => decodeString($1),
    },
    snapshotType: switch (json['snapshotType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceDisk: switch (json['sourceDisk']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceDiskEncryptionKey: switch (json['sourceDiskEncryptionKey']) {
      null => null,
      Object $1 => CustomerEncryptionKey.fromJson($1),
    },
    sourceDiskForRecoveryCheckpoint:
        switch (json['sourceDiskForRecoveryCheckpoint']) {
          null => null,
          Object $1 => decodeString($1),
        },
    sourceDiskId: switch (json['sourceDiskId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceInstantSnapshot: switch (json['sourceInstantSnapshot']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceInstantSnapshotEncryptionKey:
        switch (json['sourceInstantSnapshotEncryptionKey']) {
          null => null,
          Object $1 => CustomerEncryptionKey.fromJson($1),
        },
    sourceInstantSnapshotId: switch (json['sourceInstantSnapshotId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceSnapshotSchedulePolicy:
        switch (json['sourceSnapshotSchedulePolicy']) {
          null => null,
          Object $1 => decodeString($1),
        },
    sourceSnapshotSchedulePolicyId:
        switch (json['sourceSnapshotSchedulePolicyId']) {
          null => null,
          Object $1 => decodeString($1),
        },
    status: switch (json['status']) {
      null => null,
      Object $1 => decodeString($1),
    },
    storageBytes: switch (json['storageBytes']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    storageBytesStatus: switch (json['storageBytesStatus']) {
      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'),
    },
  );
}