feat(bigquery): Add support for reservation field in jobs. (#3768) · googleapis/java-bigquery@3e97f7c (original) (raw)

`@@ -47,6 +47,7 @@ public final class ExtractJobConfiguration extends JobConfiguration {

`

47

47

`private final Boolean useAvroLogicalTypes;

`

48

48

`private final Map<String, String> labels;

`

49

49

`private final Long jobTimeoutMs;

`

``

50

`+

private final String reservation;

`

50

51

``

51

52

`public static final class Builder

`

52

53

`extends JobConfiguration.Builder<ExtractJobConfiguration, Builder> {

`

`@@ -61,6 +62,7 @@ public static final class Builder

`

61

62

`private Boolean useAvroLogicalTypes;

`

62

63

`private Map<String, String> labels;

`

63

64

`private Long jobTimeoutMs;

`

``

65

`+

private String reservation;

`

64

66

``

65

67

`private Builder() {

`

66

68

`super(Type.EXTRACT);

`

`@@ -78,6 +80,7 @@ private Builder(ExtractJobConfiguration jobInfo) {

`

78

80

`this.useAvroLogicalTypes = jobInfo.useAvroLogicalTypes;

`

79

81

`this.labels = jobInfo.labels;

`

80

82

`this.jobTimeoutMs = jobInfo.jobTimeoutMs;

`

``

83

`+

this.reservation = jobInfo.reservation;

`

81

84

` }

`

82

85

``

83

86

`private Builder(com.google.api.services.bigquery.model.JobConfiguration configurationPb) {

`

`@@ -101,6 +104,9 @@ private Builder(com.google.api.services.bigquery.model.JobConfiguration configur

`

101

104

`if (configurationPb.getJobTimeoutMs() != null) {

`

102

105

`this.jobTimeoutMs = configurationPb.getJobTimeoutMs();

`

103

106

` }

`

``

107

`+

if (configurationPb.getReservation() != null) {

`

``

108

`+

this.reservation = configurationPb.getReservation();

`

``

109

`+

}

`

104

110

` }

`

105

111

``

106

112

`/** Sets the table to export. */

`

`@@ -198,6 +204,19 @@ public Builder setJobTimeoutMs(Long jobTimeoutMs) {

`

198

204

`return this;

`

199

205

` }

`

200

206

``

``

207

`+

/**

`

``

208

`+

`

``

209

`+

`

``

210

`+

`

``

211

`` +

``

``

212

`+

`

``

213

`+

`

``

214

`+

*/

`

``

215

`+

public Builder setReservation(String reservation) {

`

``

216

`+

this.reservation = reservation;

`

``

217

`+

return this;

`

``

218

`+

}

`

``

219

+

201

220

`public ExtractJobConfiguration build() {

`

202

221

`return new ExtractJobConfiguration(this);

`

203

222

` }

`

`@@ -215,6 +234,7 @@ private ExtractJobConfiguration(Builder builder) {

`

215

234

`this.useAvroLogicalTypes = builder.useAvroLogicalTypes;

`

216

235

`this.labels = builder.labels;

`

217

236

`this.jobTimeoutMs = builder.jobTimeoutMs;

`

``

237

`+

this.reservation = builder.reservation;

`

218

238

` }

`

219

239

``

220

240

`/** Returns the table to export. */

`

`@@ -274,6 +294,11 @@ public Long getJobTimeoutMs() {

`

274

294

`return jobTimeoutMs;

`

275

295

` }

`

276

296

``

``

297

`+

/** Returns the reservation associated with this job */

`

``

298

`+

public String getReservation() {

`

``

299

`+

return reservation;

`

``

300

`+

}

`

``

301

+

277

302

`@Override

`

278

303

`public Builder toBuilder() {

`

279

304

`return new Builder(this);

`

`@@ -291,7 +316,8 @@ ToStringHelper toStringHelper() {

`

291

316

` .add("compression", compression)

`

292

317

` .add("useAvroLogicalTypes", useAvroLogicalTypes)

`

293

318

` .add("labels", labels)

`

294

``

`-

.add("jobTimeoutMs", jobTimeoutMs);

`

``

319

`+

.add("jobTimeoutMs", jobTimeoutMs)

`

``

320

`+

.add("reservation", reservation);

`

295

321

` }

`

296

322

``

297

323

`@Override

`

`@@ -313,7 +339,8 @@ public int hashCode() {

`

313

339

`compression,

`

314

340

`useAvroLogicalTypes,

`

315

341

`labels,

`

316

``

`-

jobTimeoutMs);

`

``

342

`+

jobTimeoutMs,

`

``

343

`+

reservation);

`

317

344

` }

`

318

345

``

319

346

`@Override

`

`@@ -350,6 +377,9 @@ com.google.api.services.bigquery.model.JobConfiguration toPb() {

`

350

377

`if (jobTimeoutMs != null) {

`

351

378

`jobConfiguration.setJobTimeoutMs(jobTimeoutMs);

`

352

379

` }

`

``

380

`+

if (reservation != null) {

`

``

381

`+

jobConfiguration.setReservation(reservation);

`

``

382

`+

}

`

353

383

`jobConfiguration.setExtract(extractConfigurationPb);

`

354

384

`return jobConfiguration;

`

355

385

` }

`