SourceInstanceProperties.fromJson constructor

SourceInstanceProperties.fromJson(
  1. Object? j
)

Implementation

factory SourceInstanceProperties.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return SourceInstanceProperties(
    canIpForward: switch (json['canIpForward']) {
      null => null,
      Object $1 => decodeBool($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) SavedAttachedDisk.fromJson(i)],
      _ => throw const FormatException('"disks" is not a list'),
    },
    guestAccelerators: switch (json['guestAccelerators']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) AcceleratorConfig.fromJson(i)],
      _ => throw const FormatException('"guestAccelerators" is not a list'),
    },
    keyRevocationActionType: switch (json['keyRevocationActionType']) {
      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'),
    },
    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),
    },
    networkInterfaces: switch (json['networkInterfaces']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) NetworkInterface.fromJson(i)],
      _ => throw const FormatException('"networkInterfaces" is not a list'),
    },
    postKeyRevocationActionType:
        switch (json['postKeyRevocationActionType']) {
          null => null,
          Object $1 => decodeString($1),
        },
    scheduling: switch (json['scheduling']) {
      null => null,
      Object $1 => Scheduling.fromJson($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'),
    },
    tags: switch (json['tags']) {
      null => null,
      Object $1 => Tags.fromJson($1),
    },
  );
}