Skip to content

Commit c35bd0b

Browse files
feat: [gke-backup] added new restore scope options (#9586)
- [ ] Regenerate this pull request now. feat: added transformation rules for restore feat: added BackupPlan and RestorePlan state information These features aim to do the following: 1. Improve flexibility of restore with new options to define new kinds of scope configurations. 2. Improve flexibility of restore by supporting Transformation Rules, which enable the removal and addition of spec fields of restored resources prior to their creation. 3. Improve observability by revealing the state information of BackupPlan and RestorePlan. PiperOrigin-RevId: 543605700 Source-Link: https://togithub.com/googleapis/googleapis/commit/d39c91b3ac0abec1490ef00010107355a4dae317 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/0cf7f93d4a60fae7fbd1a9ab03f7da4c62fb1bd2 Copy-Tag: eyJwIjoiamF2YS1na2UtYmFja3VwLy5Pd2xCb3QueWFtbCIsImgiOiIwY2Y3ZjkzZDRhNjBmYWU3ZmJkMWE5YWIwM2Y3ZGE0YzYyZmIxYmQyIn0=
1 parent ef39c21 commit c35bd0b

File tree

15 files changed

+11756
-2912
lines changed

15 files changed

+11756
-2912
lines changed

java-gke-backup/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
201201
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
202202
[stability-image]: https://img.shields.io/badge/stability-preview-yellow
203203
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-gke-backup.svg
204-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-gke-backup/0.18.0
204+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-gke-backup/0.19.0
205205
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
206206
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
207207
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

java-gke-backup/google-cloud-gke-backup/src/test/java/com/google/cloud/gkebackup/v1/BackupForGKEClientHttpJsonTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public void createBackupPlanTest() throws Exception {
119119
.setDeactivated(true)
120120
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
121121
.setProtectedPodCount(-1494678716)
122+
.setStateReason("stateReason1148834357")
122123
.build();
123124
Operation resultOperation =
124125
Operation.newBuilder()
@@ -185,6 +186,7 @@ public void createBackupPlanTest2() throws Exception {
185186
.setDeactivated(true)
186187
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
187188
.setProtectedPodCount(-1494678716)
189+
.setStateReason("stateReason1148834357")
188190
.build();
189191
Operation resultOperation =
190192
Operation.newBuilder()
@@ -351,6 +353,7 @@ public void getBackupPlanTest() throws Exception {
351353
.setDeactivated(true)
352354
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
353355
.setProtectedPodCount(-1494678716)
356+
.setStateReason("stateReason1148834357")
354357
.build();
355358
mockService.addResponse(expectedResponse);
356359

@@ -407,6 +410,7 @@ public void getBackupPlanTest2() throws Exception {
407410
.setDeactivated(true)
408411
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
409412
.setProtectedPodCount(-1494678716)
413+
.setStateReason("stateReason1148834357")
410414
.build();
411415
mockService.addResponse(expectedResponse);
412416

@@ -463,6 +467,7 @@ public void updateBackupPlanTest() throws Exception {
463467
.setDeactivated(true)
464468
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
465469
.setProtectedPodCount(-1494678716)
470+
.setStateReason("stateReason1148834357")
466471
.build();
467472
Operation resultOperation =
468473
Operation.newBuilder()
@@ -487,6 +492,7 @@ public void updateBackupPlanTest() throws Exception {
487492
.setDeactivated(true)
488493
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
489494
.setProtectedPodCount(-1494678716)
495+
.setStateReason("stateReason1148834357")
490496
.build();
491497
FieldMask updateMask = FieldMask.newBuilder().build();
492498

@@ -531,6 +537,7 @@ public void updateBackupPlanExceptionTest() throws Exception {
531537
.setDeactivated(true)
532538
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
533539
.setProtectedPodCount(-1494678716)
540+
.setStateReason("stateReason1148834357")
534541
.build();
535542
FieldMask updateMask = FieldMask.newBuilder().build();
536543
client.updateBackupPlanAsync(backupPlan, updateMask).get();
@@ -1471,6 +1478,7 @@ public void createRestorePlanTest() throws Exception {
14711478
.setRestoreConfig(RestoreConfig.newBuilder().build())
14721479
.putAllLabels(new HashMap<String, String>())
14731480
.setEtag("etag3123477")
1481+
.setStateReason("stateReason1148834357")
14741482
.build();
14751483
Operation resultOperation =
14761484
Operation.newBuilder()
@@ -1534,6 +1542,7 @@ public void createRestorePlanTest2() throws Exception {
15341542
.setRestoreConfig(RestoreConfig.newBuilder().build())
15351543
.putAllLabels(new HashMap<String, String>())
15361544
.setEtag("etag3123477")
1545+
.setStateReason("stateReason1148834357")
15371546
.build();
15381547
Operation resultOperation =
15391548
Operation.newBuilder()
@@ -1697,6 +1706,7 @@ public void getRestorePlanTest() throws Exception {
16971706
.setRestoreConfig(RestoreConfig.newBuilder().build())
16981707
.putAllLabels(new HashMap<String, String>())
16991708
.setEtag("etag3123477")
1709+
.setStateReason("stateReason1148834357")
17001710
.build();
17011711
mockService.addResponse(expectedResponse);
17021712

@@ -1750,6 +1760,7 @@ public void getRestorePlanTest2() throws Exception {
17501760
.setRestoreConfig(RestoreConfig.newBuilder().build())
17511761
.putAllLabels(new HashMap<String, String>())
17521762
.setEtag("etag3123477")
1763+
.setStateReason("stateReason1148834357")
17531764
.build();
17541765
mockService.addResponse(expectedResponse);
17551766

@@ -1803,6 +1814,7 @@ public void updateRestorePlanTest() throws Exception {
18031814
.setRestoreConfig(RestoreConfig.newBuilder().build())
18041815
.putAllLabels(new HashMap<String, String>())
18051816
.setEtag("etag3123477")
1817+
.setStateReason("stateReason1148834357")
18061818
.build();
18071819
Operation resultOperation =
18081820
Operation.newBuilder()
@@ -1824,6 +1836,7 @@ public void updateRestorePlanTest() throws Exception {
18241836
.setRestoreConfig(RestoreConfig.newBuilder().build())
18251837
.putAllLabels(new HashMap<String, String>())
18261838
.setEtag("etag3123477")
1839+
.setStateReason("stateReason1148834357")
18271840
.build();
18281841
FieldMask updateMask = FieldMask.newBuilder().build();
18291842

@@ -1866,6 +1879,7 @@ public void updateRestorePlanExceptionTest() throws Exception {
18661879
.setRestoreConfig(RestoreConfig.newBuilder().build())
18671880
.putAllLabels(new HashMap<String, String>())
18681881
.setEtag("etag3123477")
1882+
.setStateReason("stateReason1148834357")
18691883
.build();
18701884
FieldMask updateMask = FieldMask.newBuilder().build();
18711885
client.updateRestorePlanAsync(restorePlan, updateMask).get();

java-gke-backup/google-cloud-gke-backup/src/test/java/com/google/cloud/gkebackup/v1/BackupForGKEClientTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ public void createBackupPlanTest() throws Exception {
128128
.setDeactivated(true)
129129
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
130130
.setProtectedPodCount(-1494678716)
131+
.setStateReason("stateReason1148834357")
131132
.build();
132133
Operation resultOperation =
133134
Operation.newBuilder()
@@ -193,6 +194,7 @@ public void createBackupPlanTest2() throws Exception {
193194
.setDeactivated(true)
194195
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
195196
.setProtectedPodCount(-1494678716)
197+
.setStateReason("stateReason1148834357")
196198
.build();
197199
Operation resultOperation =
198200
Operation.newBuilder()
@@ -346,6 +348,7 @@ public void getBackupPlanTest() throws Exception {
346348
.setDeactivated(true)
347349
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
348350
.setProtectedPodCount(-1494678716)
351+
.setStateReason("stateReason1148834357")
349352
.build();
350353
mockBackupForGKE.addResponse(expectedResponse);
351354

@@ -396,6 +399,7 @@ public void getBackupPlanTest2() throws Exception {
396399
.setDeactivated(true)
397400
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
398401
.setProtectedPodCount(-1494678716)
402+
.setStateReason("stateReason1148834357")
399403
.build();
400404
mockBackupForGKE.addResponse(expectedResponse);
401405

@@ -446,6 +450,7 @@ public void updateBackupPlanTest() throws Exception {
446450
.setDeactivated(true)
447451
.setBackupConfig(BackupPlan.BackupConfig.newBuilder().build())
448452
.setProtectedPodCount(-1494678716)
453+
.setStateReason("stateReason1148834357")
449454
.build();
450455
Operation resultOperation =
451456
Operation.newBuilder()
@@ -1298,6 +1303,7 @@ public void createRestorePlanTest() throws Exception {
12981303
.setRestoreConfig(RestoreConfig.newBuilder().build())
12991304
.putAllLabels(new HashMap<String, String>())
13001305
.setEtag("etag3123477")
1306+
.setStateReason("stateReason1148834357")
13011307
.build();
13021308
Operation resultOperation =
13031309
Operation.newBuilder()
@@ -1360,6 +1366,7 @@ public void createRestorePlanTest2() throws Exception {
13601366
.setRestoreConfig(RestoreConfig.newBuilder().build())
13611367
.putAllLabels(new HashMap<String, String>())
13621368
.setEtag("etag3123477")
1369+
.setStateReason("stateReason1148834357")
13631370
.build();
13641371
Operation resultOperation =
13651372
Operation.newBuilder()
@@ -1510,6 +1517,7 @@ public void getRestorePlanTest() throws Exception {
15101517
.setRestoreConfig(RestoreConfig.newBuilder().build())
15111518
.putAllLabels(new HashMap<String, String>())
15121519
.setEtag("etag3123477")
1520+
.setStateReason("stateReason1148834357")
15131521
.build();
15141522
mockBackupForGKE.addResponse(expectedResponse);
15151523

@@ -1557,6 +1565,7 @@ public void getRestorePlanTest2() throws Exception {
15571565
.setRestoreConfig(RestoreConfig.newBuilder().build())
15581566
.putAllLabels(new HashMap<String, String>())
15591567
.setEtag("etag3123477")
1568+
.setStateReason("stateReason1148834357")
15601569
.build();
15611570
mockBackupForGKE.addResponse(expectedResponse);
15621571

@@ -1604,6 +1613,7 @@ public void updateRestorePlanTest() throws Exception {
16041613
.setRestoreConfig(RestoreConfig.newBuilder().build())
16051614
.putAllLabels(new HashMap<String, String>())
16061615
.setEtag("etag3123477")
1616+
.setStateReason("stateReason1148834357")
16071617
.build();
16081618
Operation resultOperation =
16091619
Operation.newBuilder()

0 commit comments

Comments
 (0)