PipelineJob.fromJson constructor

PipelineJob.fromJson(
  1. Object? j
)

Implementation

factory PipelineJob.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return PipelineJob(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($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),
    },
    pipelineSpec: switch (json['pipelineSpec']) {
      null => null,
      Object $1 => protobuf.Struct.fromJson($1),
    },
    state: switch (json['state']) {
      null => PipelineState.$default,
      Object $1 => PipelineState.fromJson($1),
    },
    jobDetail: switch (json['jobDetail']) {
      null => null,
      Object $1 => PipelineJobDetail.fromJson($1),
    },
    error: switch (json['error']) {
      null => null,
      Object $1 => Status.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'),
    },
    runtimeConfig: switch (json['runtimeConfig']) {
      null => null,
      Object $1 => PipelineJob_RuntimeConfig.fromJson($1),
    },
    encryptionSpec: switch (json['encryptionSpec']) {
      null => null,
      Object $1 => EncryptionSpec.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),
    },
    templateUri: switch (json['templateUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    templateMetadata: switch (json['templateMetadata']) {
      null => null,
      Object $1 => PipelineTemplateMetadata.fromJson($1),
    },
    scheduleName: switch (json['scheduleName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    preflightValidations: switch (json['preflightValidations']) {
      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),
    },
    originalPipelineJobId: switch (json['originalPipelineJobId']) {
      null => 0,
      Object $1 => decodeInt64($1),
    },
    pipelineTaskRerunConfigs: switch (json['pipelineTaskRerunConfigs']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) PipelineTaskRerunConfig.fromJson(i),
      ],
      _ => throw const FormatException(
        '"pipelineTaskRerunConfigs" is not a list',
      ),
    },
  );
}