Instance.fromJson constructor

Instance.fromJson(
  1. Object? j
)

Implementation

factory Instance.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Instance(
    advancedMachineFeatures: switch (json['advancedMachineFeatures']) {
      null => null,
      Object $1 => AdvancedMachineFeatures.fromJson($1),
    },
    canIpForward: switch (json['canIpForward']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    confidentialInstanceConfig: switch (json['confidentialInstanceConfig']) {
      null => null,
      Object $1 => ConfidentialInstanceConfig.fromJson($1),
    },
    cpuPlatform: switch (json['cpuPlatform']) {
      null => null,
      Object $1 => decodeString($1),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    deletionProtection: switch (json['deletionProtection']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    disks: switch (json['disks']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) AttachedDisk.fromJson(i)],
      _ => throw const FormatException('"disks" is not a list'),
    },
    displayDevice: switch (json['displayDevice']) {
      null => null,
      Object $1 => DisplayDevice.fromJson($1),
    },
    fingerprint: switch (json['fingerprint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    guestAccelerators: switch (json['guestAccelerators']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) AcceleratorConfig.fromJson(i)],
      _ => throw const FormatException('"guestAccelerators" is not a list'),
    },
    hostname: switch (json['hostname']) {
      null => null,
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    instanceEncryptionKey: switch (json['instanceEncryptionKey']) {
      null => null,
      Object $1 => CustomerEncryptionKey.fromJson($1),
    },
    keyRevocationActionType: switch (json['keyRevocationActionType']) {
      null => null,
      Object $1 => decodeString($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'),
    },
    lastStartTimestamp: switch (json['lastStartTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    lastStopTimestamp: switch (json['lastStopTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    lastSuspendedTimestamp: switch (json['lastSuspendedTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    localSsdEncryptionMode: switch (json['localSsdEncryptionMode']) {
      null => null,
      Object $1 => decodeString($1),
    },
    machineType: switch (json['machineType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    metadata: switch (json['metadata']) {
      null => null,
      Object $1 => Metadata.fromJson($1),
    },
    minCpuPlatform: switch (json['minCpuPlatform']) {
      null => null,
      Object $1 => decodeString($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    networkInterfaces: switch (json['networkInterfaces']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) NetworkInterface.fromJson(i)],
      _ => throw const FormatException('"networkInterfaces" is not a list'),
    },
    networkPerformanceConfig: switch (json['networkPerformanceConfig']) {
      null => null,
      Object $1 => NetworkPerformanceConfig.fromJson($1),
    },
    params: switch (json['params']) {
      null => null,
      Object $1 => InstanceParams.fromJson($1),
    },
    privateIpv6GoogleAccess: switch (json['privateIpv6GoogleAccess']) {
      null => null,
      Object $1 => decodeString($1),
    },
    reservationAffinity: switch (json['reservationAffinity']) {
      null => null,
      Object $1 => ReservationAffinity.fromJson($1),
    },
    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 => ResourceStatus.fromJson($1),
    },
    satisfiesPzi: switch (json['satisfiesPzi']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    scheduling: switch (json['scheduling']) {
      null => null,
      Object $1 => Scheduling.fromJson($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    serviceAccounts: switch (json['serviceAccounts']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) ServiceAccount.fromJson(i)],
      _ => throw const FormatException('"serviceAccounts" is not a list'),
    },
    shieldedInstanceConfig: switch (json['shieldedInstanceConfig']) {
      null => null,
      Object $1 => ShieldedInstanceConfig.fromJson($1),
    },
    shieldedInstanceIntegrityPolicy:
        switch (json['shieldedInstanceIntegrityPolicy']) {
          null => null,
          Object $1 => ShieldedInstanceIntegrityPolicy.fromJson($1),
        },
    sourceMachineImage: switch (json['sourceMachineImage']) {
      null => null,
      Object $1 => decodeString($1),
    },
    sourceMachineImageEncryptionKey:
        switch (json['sourceMachineImageEncryptionKey']) {
          null => null,
          Object $1 => CustomerEncryptionKey.fromJson($1),
        },
    startRestricted: switch (json['startRestricted']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    status: switch (json['status']) {
      null => null,
      Object $1 => decodeString($1),
    },
    statusMessage: switch (json['statusMessage']) {
      null => null,
      Object $1 => decodeString($1),
    },
    tags: switch (json['tags']) {
      null => null,
      Object $1 => Tags.fromJson($1),
    },
    workloadIdentityConfig: switch (json['workloadIdentityConfig']) {
      null => null,
      Object $1 => WorkloadIdentityConfig.fromJson($1),
    },
    zone: switch (json['zone']) {
      null => null,
      Object $1 => decodeString($1),
    },
  );
}