Disk.fromJson constructor

Disk.fromJson(
  1. Object? j
)

Implementation

factory Disk.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Disk(
    accessMode: switch (json['accessMode']) {
      null => null,
      Object $1 => decodeString($1),
    },
    architecture: switch (json['architecture']) {
      null => null,
      Object $1 => decodeString($1),
    },
    asyncPrimaryDisk: switch (json['asyncPrimaryDisk']) {
      null => null,
      Object $1 => DiskAsyncReplication.fromJson($1),
    },
    asyncSecondaryDisks: switch (json['asyncSecondaryDisks']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): DiskAsyncReplicationList.fromJson(e.value),
      },
      _ => throw const FormatException(
        '"asyncSecondaryDisks" is not an object',
      ),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    diskEncryptionKey: switch (json['diskEncryptionKey']) {
      null => null,
      Object $1 => CustomerEncryptionKey.fromJson($1),
    },
    enableConfidentialCompute: switch (json['enableConfidentialCompute']) {
      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'),
    },
    lastAttachTimestamp: switch (json['lastAttachTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    lastDetachTimestamp: switch (json['lastDetachTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    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),
    },
    options: switch (json['options']) {
      null => null,
      Object $1 => decodeString($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => DiskParams.fromJson($1),
    },
    physicalBlockSizeBytes: switch (json['physicalBlockSizeBytes']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    provisionedIops: switch (json['provisionedIops']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    provisionedThroughput: switch (json['provisionedThroughput']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    region: switch (json['region']) {
      null => null,
      Object $1 => decodeString($1),
    },
    replicaZones: switch (json['replicaZones']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"replicaZones" is not a list'),
    },
    resourcePolicies: switch (json['resourcePolicies']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"resourcePolicies" is not a list'),
    },
    resourceStatus: switch (json['resourceStatus']) {
      null => null,
      Object $1 => DiskResourceStatus.fromJson($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),
    },
    sizeGb: switch (json['sizeGb']) {
      null => null,
      Object $1 => decodeInt64($1),
    },
    sourceConsistencyGroupPolicy:
        switch (json['sourceConsistencyGroupPolicy']) {
          null => null,
          Object $1 => decodeString($1),
        },
    sourceConsistencyGroupPolicyId:
        switch (json['sourceConsistencyGroupPolicyId']) {
          null => null,
          Object $1 => decodeString($1),
        },
    sourceDisk: switch (json['sourceDisk']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceDiskId: switch (json['sourceDiskId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceImage: switch (json['sourceImage']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceImageEncryptionKey: switch (json['sourceImageEncryptionKey']) {
      null => null,
      Object $1 => CustomerEncryptionKey.fromJson($1),
    },
    sourceImageId: switch (json['sourceImageId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceInstantSnapshot: switch (json['sourceInstantSnapshot']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceInstantSnapshotId: switch (json['sourceInstantSnapshotId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceSnapshot: switch (json['sourceSnapshot']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceSnapshotEncryptionKey:
        switch (json['sourceSnapshotEncryptionKey']) {
          null => null,
          Object $1 => CustomerEncryptionKey.fromJson($1),
        },
    sourceSnapshotId: switch (json['sourceSnapshotId']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceStorageObject: switch (json['sourceStorageObject']) {
      null => null,
      Object $1 => decodeString($1),
    },
    status: switch (json['status']) {
      null => null,
      Object $1 => decodeString($1),
    },
    storagePool: switch (json['storagePool']) {
      null => null,
      Object $1 => decodeString($1),
    },
    type: switch (json['type']) {
      null => null,
      Object $1 => decodeString($1),
    },
    users: switch (json['users']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"users" is not a list'),
    },
    zone: switch (json['zone']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}