BatchPredictionJob.fromJson constructor

BatchPredictionJob.fromJson(
  1. Object? j
)

Implementation

factory BatchPredictionJob.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return BatchPredictionJob(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    model: switch (json['model']) {
      null => '',
      Object $1 => decodeString($1),
    },
    modelVersionId: switch (json['modelVersionId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    unmanagedContainerModel: switch (json['unmanagedContainerModel']) {
      null => null,
      Object $1 => UnmanagedContainerModel.fromJson($1),
    },
    inputConfig: switch (json['inputConfig']) {
      null => null,
      Object $1 => BatchPredictionJob_InputConfig.fromJson($1),
    },
    instanceConfig: switch (json['instanceConfig']) {
      null => null,
      Object $1 => BatchPredictionJob_InstanceConfig.fromJson($1),
    },
    modelParameters: switch (json['modelParameters']) {
      null => null,
      Object $1 => protobuf.Value.fromJson($1),
    },
    outputConfig: switch (json['outputConfig']) {
      null => null,
      Object $1 => BatchPredictionJob_OutputConfig.fromJson($1),
    },
    dedicatedResources: switch (json['dedicatedResources']) {
      null => null,
      Object $1 => BatchDedicatedResources.fromJson($1),
    },
    serviceAccount: switch (json['serviceAccount']) {
      null => '',
      Object $1 => decodeString($1),
    },
    manualBatchTuningParameters:
        switch (json['manualBatchTuningParameters']) {
          null => null,
          Object $1 => ManualBatchTuningParameters.fromJson($1),
        },
    generateExplanation: switch (json['generateExplanation']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    explanationSpec: switch (json['explanationSpec']) {
      null => null,
      Object $1 => ExplanationSpec.fromJson($1),
    },
    outputInfo: switch (json['outputInfo']) {
      null => null,
      Object $1 => BatchPredictionJob_OutputInfo.fromJson($1),
    },
    state: switch (json['state']) {
      null => JobState.$default,
      Object $1 => JobState.fromJson($1),
    },
    error: switch (json['error']) {
      null => null,
      Object $1 => Status.fromJson($1),
    },
    partialFailures: switch (json['partialFailures']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Status.fromJson(i)],
      _ => throw const FormatException('"partialFailures" is not a list'),
    },
    resourcesConsumed: switch (json['resourcesConsumed']) {
      null => null,
      Object $1 => ResourcesConsumed.fromJson($1),
    },
    completionStats: switch (json['completionStats']) {
      null => null,
      Object $1 => CompletionStats.fromJson($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    startTime: switch (json['startTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    endTime: switch (json['endTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($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'),
    },
    encryptionSpec: switch (json['encryptionSpec']) {
      null => null,
      Object $1 => EncryptionSpec.fromJson($1),
    },
    modelMonitoringConfig: switch (json['modelMonitoringConfig']) {
      null => null,
      Object $1 => ModelMonitoringConfig.fromJson($1),
    },
    modelMonitoringStatsAnomalies:
        switch (json['modelMonitoringStatsAnomalies']) {
          null => [],
          List<Object?> $1 => [
            for (final i in $1) ModelMonitoringStatsAnomalies.fromJson(i),
          ],
          _ => throw const FormatException(
            '"modelMonitoringStatsAnomalies" is not a list',
          ),
        },
    modelMonitoringStatus: switch (json['modelMonitoringStatus']) {
      null => null,
      Object $1 => Status.fromJson($1),
    },
    disableContainerLogging: switch (json['disableContainerLogging']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    satisfiesPzs: switch (json['satisfiesPzs']) {
      null => false,
      Object $1 => decodeBool($1),
    },
    satisfiesPzi: switch (json['satisfiesPzi']) {
      null => false,
      Object $1 => decodeBool($1),
    },
  );
}