Skip to content

Commit 8789e4f

Browse files
feat: Change RewriteObjectRequest to specify bucket name, object name and KMS key outside of Object resource (#1218)
* feat!: Change RewriteObjectRequest to specify bucket name, object name and KMS key outside of Object resource PiperOrigin-RevId: 424391425 Source-Link: googleapis/googleapis@8479561 Source-Link: https://github.com/googleapis/googleapis-gen/commit/bc45618aba526abd29f67a6b7476192daff11408 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYmM0NTYxOGFiYTUyNmFiZDI5ZjY3YTZiNzQ3NjE5MmRhZmYxMTQwOCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: update clirr rules to allow moving of CustomerEncryption message Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: BenWhitehead <BenWhitehead@users.noreply.github.com>
1 parent deb110b commit 8789e4f

17 files changed

Lines changed: 2390 additions & 1818 deletions

File tree

gapic-google-cloud-storage-v2/src/main/java/com/google/storage/v2/StorageClient.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -375,9 +375,9 @@ public final UnaryCallable<GetBucketRequest, Bucket> getBucketCallable() {
375375
* @param parent Required. The project to which this bucket will belong.
376376
* @param bucket Required. Properties of the new bucket being inserted. The project and name of
377377
* the bucket are specified in this request, not in the bucket resource.
378-
* @param bucketId The ID to use for this bucket, which will become the final component of the
379-
* bucket's resource name. For example, the value `foo` might result in a bucket with the name
380-
* `projects/123456/buckets/foo`.
378+
* @param bucketId Required. The ID to use for this bucket, which will become the final component
379+
* of the bucket's resource name. For example, the value `foo` might result in a bucket with
380+
* the name `projects/123456/buckets/foo`.
381381
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
382382
*/
383383
public final Bucket createBucket(ProjectName parent, Bucket bucket, String bucketId) {
@@ -408,9 +408,9 @@ public final Bucket createBucket(ProjectName parent, Bucket bucket, String bucke
408408
* @param parent Required. The project to which this bucket will belong.
409409
* @param bucket Required. Properties of the new bucket being inserted. The project and name of
410410
* the bucket are specified in this request, not in the bucket resource.
411-
* @param bucketId The ID to use for this bucket, which will become the final component of the
412-
* bucket's resource name. For example, the value `foo` might result in a bucket with the name
413-
* `projects/123456/buckets/foo`.
411+
* @param bucketId Required. The ID to use for this bucket, which will become the final component
412+
* of the bucket's resource name. For example, the value `foo` might result in a bucket with
413+
* the name `projects/123456/buckets/foo`.
414414
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
415415
*/
416416
public final Bucket createBucket(String parent, Bucket bucket, String bucketId) {
@@ -2228,8 +2228,10 @@ public final UnaryCallable<ListObjectsRequest, ListObjectsResponse> listObjectsC
22282228
* try (StorageClient storageClient = StorageClient.create()) {
22292229
* RewriteObjectRequest request =
22302230
* RewriteObjectRequest.newBuilder()
2231+
* .setDestinationName("destinationName-1762755655")
2232+
* .setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString())
2233+
* .setDestinationCustomerEncryption(CustomerEncryption.newBuilder().build())
22312234
* .setDestination(Object.newBuilder().build())
2232-
* .setRewriteMask(FieldMask.newBuilder().build())
22332235
* .setSourceBucket("sourceBucket841604581")
22342236
* .setSourceObject("sourceObject1196439354")
22352237
* .setSourceGeneration(1232209852)
@@ -2271,8 +2273,10 @@ public final RewriteResponse rewriteObject(RewriteObjectRequest request) {
22712273
* try (StorageClient storageClient = StorageClient.create()) {
22722274
* RewriteObjectRequest request =
22732275
* RewriteObjectRequest.newBuilder()
2276+
* .setDestinationName("destinationName-1762755655")
2277+
* .setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString())
2278+
* .setDestinationCustomerEncryption(CustomerEncryption.newBuilder().build())
22742279
* .setDestination(Object.newBuilder().build())
2275-
* .setRewriteMask(FieldMask.newBuilder().build())
22762280
* .setSourceBucket("sourceBucket841604581")
22772281
* .setSourceObject("sourceObject1196439354")
22782282
* .setSourceGeneration(1232209852)

gapic-google-cloud-storage-v2/src/test/java/com/google/storage/v2/StorageClientTest.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ public void composeObjectTest() throws Exception {
13281328
.putAllMetadata(new HashMap<String, String>())
13291329
.setEventBasedHold(true)
13301330
.setOwner(Owner.newBuilder().build())
1331-
.setCustomerEncryption(Object.CustomerEncryption.newBuilder().build())
1331+
.setCustomerEncryption(CustomerEncryption.newBuilder().build())
13321332
.setCustomTime(Timestamp.newBuilder().build())
13331333
.build();
13341334
mockStorage.addResponse(expectedResponse);
@@ -1504,7 +1504,7 @@ public void getObjectTest() throws Exception {
15041504
.putAllMetadata(new HashMap<String, String>())
15051505
.setEventBasedHold(true)
15061506
.setOwner(Owner.newBuilder().build())
1507-
.setCustomerEncryption(Object.CustomerEncryption.newBuilder().build())
1507+
.setCustomerEncryption(CustomerEncryption.newBuilder().build())
15081508
.setCustomTime(Timestamp.newBuilder().build())
15091509
.build();
15101510
mockStorage.addResponse(expectedResponse);
@@ -1572,7 +1572,7 @@ public void getObjectTest2() throws Exception {
15721572
.putAllMetadata(new HashMap<String, String>())
15731573
.setEventBasedHold(true)
15741574
.setOwner(Owner.newBuilder().build())
1575-
.setCustomerEncryption(Object.CustomerEncryption.newBuilder().build())
1575+
.setCustomerEncryption(CustomerEncryption.newBuilder().build())
15761576
.setCustomTime(Timestamp.newBuilder().build())
15771577
.build();
15781578
mockStorage.addResponse(expectedResponse);
@@ -1716,7 +1716,7 @@ public void updateObjectTest() throws Exception {
17161716
.putAllMetadata(new HashMap<String, String>())
17171717
.setEventBasedHold(true)
17181718
.setOwner(Owner.newBuilder().build())
1719-
.setCustomerEncryption(Object.CustomerEncryption.newBuilder().build())
1719+
.setCustomerEncryption(CustomerEncryption.newBuilder().build())
17201720
.setCustomTime(Timestamp.newBuilder().build())
17211721
.build();
17221722
mockStorage.addResponse(expectedResponse);
@@ -1916,8 +1916,10 @@ public void rewriteObjectTest() throws Exception {
19161916

19171917
RewriteObjectRequest request =
19181918
RewriteObjectRequest.newBuilder()
1919+
.setDestinationName("destinationName-1762755655")
1920+
.setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString())
1921+
.setDestinationCustomerEncryption(CustomerEncryption.newBuilder().build())
19191922
.setDestination(Object.newBuilder().build())
1920-
.setRewriteMask(FieldMask.newBuilder().build())
19211923
.setSourceBucket("sourceBucket841604581")
19221924
.setSourceObject("sourceObject1196439354")
19231925
.setSourceGeneration(1232209852)
@@ -1946,8 +1948,12 @@ public void rewriteObjectTest() throws Exception {
19461948
Assert.assertEquals(1, actualRequests.size());
19471949
RewriteObjectRequest actualRequest = ((RewriteObjectRequest) actualRequests.get(0));
19481950

1951+
Assert.assertEquals(request.getDestinationName(), actualRequest.getDestinationName());
1952+
Assert.assertEquals(request.getDestinationBucket(), actualRequest.getDestinationBucket());
1953+
Assert.assertEquals(
1954+
request.getDestinationCustomerEncryption(),
1955+
actualRequest.getDestinationCustomerEncryption());
19491956
Assert.assertEquals(request.getDestination(), actualRequest.getDestination());
1950-
Assert.assertEquals(request.getRewriteMask(), actualRequest.getRewriteMask());
19511957
Assert.assertEquals(request.getSourceBucket(), actualRequest.getSourceBucket());
19521958
Assert.assertEquals(request.getSourceObject(), actualRequest.getSourceObject());
19531959
Assert.assertEquals(request.getSourceGeneration(), actualRequest.getSourceGeneration());
@@ -1996,8 +2002,10 @@ public void rewriteObjectExceptionTest() throws Exception {
19962002
try {
19972003
RewriteObjectRequest request =
19982004
RewriteObjectRequest.newBuilder()
2005+
.setDestinationName("destinationName-1762755655")
2006+
.setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString())
2007+
.setDestinationCustomerEncryption(CustomerEncryption.newBuilder().build())
19992008
.setDestination(Object.newBuilder().build())
2000-
.setRewriteMask(FieldMask.newBuilder().build())
20012009
.setSourceBucket("sourceBucket841604581")
20022010
.setSourceObject("sourceObject1196439354")
20032011
.setSourceGeneration(1232209852)

proto-google-cloud-storage-v2/clirr-ignored-differences.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,30 @@
2929
<method>* *ZoneAffinity*(*)</method>
3030
</difference>
3131

32+
33+
<!--
34+
Customer Encryption has been pulled up out of Object to a top level message,
35+
then the respective request messages include as necessary.
36+
-->
37+
<!-- Allow new class as a parameter type -->
38+
<difference>
39+
<differenceType>7005</differenceType>
40+
<className>com/google/storage/v2/Object*</className>
41+
<method>* *CustomerEncryption*(*)</method>
42+
<to>*</to>
43+
</difference>
44+
<!-- Allow new class as a return type -->
45+
<difference>
46+
<differenceType>7006</differenceType>
47+
<className>com/google/storage/v2/Object*</className>
48+
<method>* *CustomerEncryption*(*)</method>
49+
<to>*</to>
50+
</difference>
51+
<!-- Allow deletion of old inner class -->
52+
<difference>
53+
<differenceType>8001</differenceType>
54+
<className>com/google/storage/v2/Object$CustomerEncryption*</className>
55+
</difference>
56+
57+
3258
</differences>

proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/Bucket.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5752,8 +5752,8 @@ public interface ActionOrBuilder
57525752
*
57535753
*
57545754
* <pre>
5755-
* Type of the action. Currently, only `Delete` and
5756-
* `SetStorageClass` are supported.
5755+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
5756+
* `AbortIncompleteMultipartUpload` are supported.
57575757
* </pre>
57585758
*
57595759
* <code>string type = 1;</code>
@@ -5765,8 +5765,8 @@ public interface ActionOrBuilder
57655765
*
57665766
*
57675767
* <pre>
5768-
* Type of the action. Currently, only `Delete` and
5769-
* `SetStorageClass` are supported.
5768+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
5769+
* `AbortIncompleteMultipartUpload` are supported.
57705770
* </pre>
57715771
*
57725772
* <code>string type = 1;</code>
@@ -5910,8 +5910,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
59105910
*
59115911
*
59125912
* <pre>
5913-
* Type of the action. Currently, only `Delete` and
5914-
* `SetStorageClass` are supported.
5913+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
5914+
* `AbortIncompleteMultipartUpload` are supported.
59155915
* </pre>
59165916
*
59175917
* <code>string type = 1;</code>
@@ -5934,8 +5934,8 @@ public java.lang.String getType() {
59345934
*
59355935
*
59365936
* <pre>
5937-
* Type of the action. Currently, only `Delete` and
5938-
* `SetStorageClass` are supported.
5937+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
5938+
* `AbortIncompleteMultipartUpload` are supported.
59395939
* </pre>
59405940
*
59415941
* <code>string type = 1;</code>
@@ -6352,8 +6352,8 @@ public Builder mergeFrom(
63526352
*
63536353
*
63546354
* <pre>
6355-
* Type of the action. Currently, only `Delete` and
6356-
* `SetStorageClass` are supported.
6355+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
6356+
* `AbortIncompleteMultipartUpload` are supported.
63576357
* </pre>
63586358
*
63596359
* <code>string type = 1;</code>
@@ -6375,8 +6375,8 @@ public java.lang.String getType() {
63756375
*
63766376
*
63776377
* <pre>
6378-
* Type of the action. Currently, only `Delete` and
6379-
* `SetStorageClass` are supported.
6378+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
6379+
* `AbortIncompleteMultipartUpload` are supported.
63806380
* </pre>
63816381
*
63826382
* <code>string type = 1;</code>
@@ -6398,8 +6398,8 @@ public com.google.protobuf.ByteString getTypeBytes() {
63986398
*
63996399
*
64006400
* <pre>
6401-
* Type of the action. Currently, only `Delete` and
6402-
* `SetStorageClass` are supported.
6401+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
6402+
* `AbortIncompleteMultipartUpload` are supported.
64036403
* </pre>
64046404
*
64056405
* <code>string type = 1;</code>
@@ -6420,8 +6420,8 @@ public Builder setType(java.lang.String value) {
64206420
*
64216421
*
64226422
* <pre>
6423-
* Type of the action. Currently, only `Delete` and
6424-
* `SetStorageClass` are supported.
6423+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
6424+
* `AbortIncompleteMultipartUpload` are supported.
64256425
* </pre>
64266426
*
64276427
* <code>string type = 1;</code>
@@ -6438,8 +6438,8 @@ public Builder clearType() {
64386438
*
64396439
*
64406440
* <pre>
6441-
* Type of the action. Currently, only `Delete` and
6442-
* `SetStorageClass` are supported.
6441+
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
6442+
* `AbortIncompleteMultipartUpload` are supported.
64436443
* </pre>
64446444
*
64456445
* <code>string type = 1;</code>

proto-google-cloud-storage-v2/src/main/java/com/google/storage/v2/ComposeObjectRequest.java

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ public interface SourceObjectOrBuilder
206206
*
207207
*
208208
* <pre>
209-
* The source object's name. All source objects must reside in the same
209+
* Required. The source object's name. All source objects must reside in the same
210210
* bucket.
211211
* </pre>
212212
*
213-
* <code>string name = 1;</code>
213+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
214214
*
215215
* @return The name.
216216
*/
@@ -219,11 +219,11 @@ public interface SourceObjectOrBuilder
219219
*
220220
*
221221
* <pre>
222-
* The source object's name. All source objects must reside in the same
222+
* Required. The source object's name. All source objects must reside in the same
223223
* bucket.
224224
* </pre>
225225
*
226-
* <code>string name = 1;</code>
226+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
227227
*
228228
* @return The bytes for name.
229229
*/
@@ -1065,11 +1065,11 @@ public com.google.protobuf.Parser<ObjectPreconditions> getParserForType() {
10651065
*
10661066
*
10671067
* <pre>
1068-
* The source object's name. All source objects must reside in the same
1068+
* Required. The source object's name. All source objects must reside in the same
10691069
* bucket.
10701070
* </pre>
10711071
*
1072-
* <code>string name = 1;</code>
1072+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
10731073
*
10741074
* @return The name.
10751075
*/
@@ -1089,11 +1089,11 @@ public java.lang.String getName() {
10891089
*
10901090
*
10911091
* <pre>
1092-
* The source object's name. All source objects must reside in the same
1092+
* Required. The source object's name. All source objects must reside in the same
10931093
* bucket.
10941094
* </pre>
10951095
*
1096-
* <code>string name = 1;</code>
1096+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
10971097
*
10981098
* @return The bytes for name.
10991099
*/
@@ -1558,11 +1558,11 @@ public Builder mergeFrom(
15581558
*
15591559
*
15601560
* <pre>
1561-
* The source object's name. All source objects must reside in the same
1561+
* Required. The source object's name. All source objects must reside in the same
15621562
* bucket.
15631563
* </pre>
15641564
*
1565-
* <code>string name = 1;</code>
1565+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
15661566
*
15671567
* @return The name.
15681568
*/
@@ -1581,11 +1581,11 @@ public java.lang.String getName() {
15811581
*
15821582
*
15831583
* <pre>
1584-
* The source object's name. All source objects must reside in the same
1584+
* Required. The source object's name. All source objects must reside in the same
15851585
* bucket.
15861586
* </pre>
15871587
*
1588-
* <code>string name = 1;</code>
1588+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
15891589
*
15901590
* @return The bytes for name.
15911591
*/
@@ -1604,11 +1604,11 @@ public com.google.protobuf.ByteString getNameBytes() {
16041604
*
16051605
*
16061606
* <pre>
1607-
* The source object's name. All source objects must reside in the same
1607+
* Required. The source object's name. All source objects must reside in the same
16081608
* bucket.
16091609
* </pre>
16101610
*
1611-
* <code>string name = 1;</code>
1611+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
16121612
*
16131613
* @param value The name to set.
16141614
* @return This builder for chaining.
@@ -1626,11 +1626,11 @@ public Builder setName(java.lang.String value) {
16261626
*
16271627
*
16281628
* <pre>
1629-
* The source object's name. All source objects must reside in the same
1629+
* Required. The source object's name. All source objects must reside in the same
16301630
* bucket.
16311631
* </pre>
16321632
*
1633-
* <code>string name = 1;</code>
1633+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
16341634
*
16351635
* @return This builder for chaining.
16361636
*/
@@ -1644,11 +1644,11 @@ public Builder clearName() {
16441644
*
16451645
*
16461646
* <pre>
1647-
* The source object's name. All source objects must reside in the same
1647+
* Required. The source object's name. All source objects must reside in the same
16481648
* bucket.
16491649
* </pre>
16501650
*
1651-
* <code>string name = 1;</code>
1651+
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
16521652
*
16531653
* @param value The bytes for name to set.
16541654
* @return This builder for chaining.

0 commit comments

Comments
 (0)