CustomJobSpec.fromJson constructor

CustomJobSpec.fromJson(
  1. Object? j
)

Implementation

factory CustomJobSpec.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return CustomJobSpec(
    persistentResourceId: switch (json['persistentResourceId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    workerPoolSpecs: switch (json['workerPoolSpecs']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) WorkerPoolSpec.fromJson(i)],
      _ => throw const FormatException('"workerPoolSpecs" is not a list'),
    },
    scheduling: switch (json['scheduling']) {
      null => null,
      Object $1 => Scheduling.fromJson($1),
    },
    serviceAccount: switch (json['serviceAccount']) {
      null => '',
      Object $1 => decodeString($1),
    },
    network: switch (json['network']) {
      null => '',
      Object $1 => decodeString($1),
    },
    reservedIpRanges: switch (json['reservedIpRanges']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"reservedIpRanges" is not a list'),
    },
    pscInterfaceConfig: switch (json['pscInterfaceConfig']) {
      null => null,
      Object $1 => PscInterfaceConfig.fromJson($1),
    },
    baseOutputDirectory: switch (json['baseOutputDirectory']) {
      null => null,
      Object $1 => GcsDestination.fromJson($1),
    },
    protectedArtifactLocationId:
        switch (json['protectedArtifactLocationId']) {
          null => '',
          Object $1 => decodeString($1),
        },
    tensorboard: switch (json['tensorboard']) {
      null => '',
      Object $1 => decodeString($1),
    },
    enableWebAccess: switch (json['enableWebAccess']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    enableDashboardAccess: switch (json['enableDashboardAccess']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    experiment: switch (json['experiment']) {
      null => '',
      Object $1 => decodeString($1),
    },
    experimentRun: switch (json['experimentRun']) {
      null => '',
      Object $1 => decodeString($1),
    },
    models: switch (json['models']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"models" is not a list'),
    },
  );
}