Skip to content

Commit

Permalink
feat: Change RewriteObjectRequest to specify bucket name, object name…
Browse files Browse the repository at this point in the history
… 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: googleapis/googleapis-gen@bc45618
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>
  • Loading branch information
3 people committed Jan 31, 2022
1 parent deb110b commit 8789e4f
Show file tree
Hide file tree
Showing 17 changed files with 2,390 additions and 1,818 deletions.
Expand Up @@ -375,9 +375,9 @@ public final UnaryCallable<GetBucketRequest, Bucket> getBucketCallable() {
* @param parent Required. The project to which this bucket will belong.
* @param bucket Required. Properties of the new bucket being inserted. The project and name of
* the bucket are specified in this request, not in the bucket resource.
* @param bucketId The ID to use for this bucket, which will become the final component of the
* bucket's resource name. For example, the value `foo` might result in a bucket with the name
* `projects/123456/buckets/foo`.
* @param bucketId Required. The ID to use for this bucket, which will become the final component
* of the bucket's resource name. For example, the value `foo` might result in a bucket with
* the name `projects/123456/buckets/foo`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Bucket createBucket(ProjectName parent, Bucket bucket, String bucketId) {
Expand Down Expand Up @@ -408,9 +408,9 @@ public final Bucket createBucket(ProjectName parent, Bucket bucket, String bucke
* @param parent Required. The project to which this bucket will belong.
* @param bucket Required. Properties of the new bucket being inserted. The project and name of
* the bucket are specified in this request, not in the bucket resource.
* @param bucketId The ID to use for this bucket, which will become the final component of the
* bucket's resource name. For example, the value `foo` might result in a bucket with the name
* `projects/123456/buckets/foo`.
* @param bucketId Required. The ID to use for this bucket, which will become the final component
* of the bucket's resource name. For example, the value `foo` might result in a bucket with
* the name `projects/123456/buckets/foo`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Bucket createBucket(String parent, Bucket bucket, String bucketId) {
Expand Down Expand Up @@ -2228,8 +2228,10 @@ public final UnaryCallable<ListObjectsRequest, ListObjectsResponse> listObjectsC
* try (StorageClient storageClient = StorageClient.create()) {
* RewriteObjectRequest request =
* RewriteObjectRequest.newBuilder()
* .setDestinationName("destinationName-1762755655")
* .setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString())
* .setDestinationCustomerEncryption(CustomerEncryption.newBuilder().build())
* .setDestination(Object.newBuilder().build())
* .setRewriteMask(FieldMask.newBuilder().build())
* .setSourceBucket("sourceBucket841604581")
* .setSourceObject("sourceObject1196439354")
* .setSourceGeneration(1232209852)
Expand Down Expand Up @@ -2271,8 +2273,10 @@ public final RewriteResponse rewriteObject(RewriteObjectRequest request) {
* try (StorageClient storageClient = StorageClient.create()) {
* RewriteObjectRequest request =
* RewriteObjectRequest.newBuilder()
* .setDestinationName("destinationName-1762755655")
* .setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString())
* .setDestinationCustomerEncryption(CustomerEncryption.newBuilder().build())
* .setDestination(Object.newBuilder().build())
* .setRewriteMask(FieldMask.newBuilder().build())
* .setSourceBucket("sourceBucket841604581")
* .setSourceObject("sourceObject1196439354")
* .setSourceGeneration(1232209852)
Expand Down
Expand Up @@ -1328,7 +1328,7 @@ public void composeObjectTest() throws Exception {
.putAllMetadata(new HashMap<String, String>())
.setEventBasedHold(true)
.setOwner(Owner.newBuilder().build())
.setCustomerEncryption(Object.CustomerEncryption.newBuilder().build())
.setCustomerEncryption(CustomerEncryption.newBuilder().build())
.setCustomTime(Timestamp.newBuilder().build())
.build();
mockStorage.addResponse(expectedResponse);
Expand Down Expand Up @@ -1504,7 +1504,7 @@ public void getObjectTest() throws Exception {
.putAllMetadata(new HashMap<String, String>())
.setEventBasedHold(true)
.setOwner(Owner.newBuilder().build())
.setCustomerEncryption(Object.CustomerEncryption.newBuilder().build())
.setCustomerEncryption(CustomerEncryption.newBuilder().build())
.setCustomTime(Timestamp.newBuilder().build())
.build();
mockStorage.addResponse(expectedResponse);
Expand Down Expand Up @@ -1572,7 +1572,7 @@ public void getObjectTest2() throws Exception {
.putAllMetadata(new HashMap<String, String>())
.setEventBasedHold(true)
.setOwner(Owner.newBuilder().build())
.setCustomerEncryption(Object.CustomerEncryption.newBuilder().build())
.setCustomerEncryption(CustomerEncryption.newBuilder().build())
.setCustomTime(Timestamp.newBuilder().build())
.build();
mockStorage.addResponse(expectedResponse);
Expand Down Expand Up @@ -1716,7 +1716,7 @@ public void updateObjectTest() throws Exception {
.putAllMetadata(new HashMap<String, String>())
.setEventBasedHold(true)
.setOwner(Owner.newBuilder().build())
.setCustomerEncryption(Object.CustomerEncryption.newBuilder().build())
.setCustomerEncryption(CustomerEncryption.newBuilder().build())
.setCustomTime(Timestamp.newBuilder().build())
.build();
mockStorage.addResponse(expectedResponse);
Expand Down Expand Up @@ -1916,8 +1916,10 @@ public void rewriteObjectTest() throws Exception {

RewriteObjectRequest request =
RewriteObjectRequest.newBuilder()
.setDestinationName("destinationName-1762755655")
.setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString())
.setDestinationCustomerEncryption(CustomerEncryption.newBuilder().build())
.setDestination(Object.newBuilder().build())
.setRewriteMask(FieldMask.newBuilder().build())
.setSourceBucket("sourceBucket841604581")
.setSourceObject("sourceObject1196439354")
.setSourceGeneration(1232209852)
Expand Down Expand Up @@ -1946,8 +1948,12 @@ public void rewriteObjectTest() throws Exception {
Assert.assertEquals(1, actualRequests.size());
RewriteObjectRequest actualRequest = ((RewriteObjectRequest) actualRequests.get(0));

Assert.assertEquals(request.getDestinationName(), actualRequest.getDestinationName());
Assert.assertEquals(request.getDestinationBucket(), actualRequest.getDestinationBucket());
Assert.assertEquals(
request.getDestinationCustomerEncryption(),
actualRequest.getDestinationCustomerEncryption());
Assert.assertEquals(request.getDestination(), actualRequest.getDestination());
Assert.assertEquals(request.getRewriteMask(), actualRequest.getRewriteMask());
Assert.assertEquals(request.getSourceBucket(), actualRequest.getSourceBucket());
Assert.assertEquals(request.getSourceObject(), actualRequest.getSourceObject());
Assert.assertEquals(request.getSourceGeneration(), actualRequest.getSourceGeneration());
Expand Down Expand Up @@ -1996,8 +2002,10 @@ public void rewriteObjectExceptionTest() throws Exception {
try {
RewriteObjectRequest request =
RewriteObjectRequest.newBuilder()
.setDestinationName("destinationName-1762755655")
.setDestinationBucket(BucketName.of("[PROJECT]", "[BUCKET]").toString())
.setDestinationCustomerEncryption(CustomerEncryption.newBuilder().build())
.setDestination(Object.newBuilder().build())
.setRewriteMask(FieldMask.newBuilder().build())
.setSourceBucket("sourceBucket841604581")
.setSourceObject("sourceObject1196439354")
.setSourceGeneration(1232209852)
Expand Down
26 changes: 26 additions & 0 deletions proto-google-cloud-storage-v2/clirr-ignored-differences.xml
Expand Up @@ -29,4 +29,30 @@
<method>* *ZoneAffinity*(*)</method>
</difference>


<!--
Customer Encryption has been pulled up out of Object to a top level message,
then the respective request messages include as necessary.
-->
<!-- Allow new class as a parameter type -->
<difference>
<differenceType>7005</differenceType>
<className>com/google/storage/v2/Object*</className>
<method>* *CustomerEncryption*(*)</method>
<to>*</to>
</difference>
<!-- Allow new class as a return type -->
<difference>
<differenceType>7006</differenceType>
<className>com/google/storage/v2/Object*</className>
<method>* *CustomerEncryption*(*)</method>
<to>*</to>
</difference>
<!-- Allow deletion of old inner class -->
<difference>
<differenceType>8001</differenceType>
<className>com/google/storage/v2/Object$CustomerEncryption*</className>
</difference>


</differences>
Expand Up @@ -5752,8 +5752,8 @@ public interface ActionOrBuilder
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand All @@ -5765,8 +5765,8 @@ public interface ActionOrBuilder
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand Down Expand Up @@ -5910,8 +5910,8 @@ public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand All @@ -5934,8 +5934,8 @@ public java.lang.String getType() {
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand Down Expand Up @@ -6352,8 +6352,8 @@ public Builder mergeFrom(
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand All @@ -6375,8 +6375,8 @@ public java.lang.String getType() {
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand All @@ -6398,8 +6398,8 @@ public com.google.protobuf.ByteString getTypeBytes() {
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand All @@ -6420,8 +6420,8 @@ public Builder setType(java.lang.String value) {
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand All @@ -6438,8 +6438,8 @@ public Builder clearType() {
*
*
* <pre>
* Type of the action. Currently, only `Delete` and
* `SetStorageClass` are supported.
* Type of the action. Currently, only `Delete`, `SetStorageClass`, and
* `AbortIncompleteMultipartUpload` are supported.
* </pre>
*
* <code>string type = 1;</code>
Expand Down
Expand Up @@ -206,11 +206,11 @@ public interface SourceObjectOrBuilder
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The name.
*/
Expand All @@ -219,11 +219,11 @@ public interface SourceObjectOrBuilder
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The bytes for name.
*/
Expand Down Expand Up @@ -1065,11 +1065,11 @@ public com.google.protobuf.Parser<ObjectPreconditions> getParserForType() {
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The name.
*/
Expand All @@ -1089,11 +1089,11 @@ public java.lang.String getName() {
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The bytes for name.
*/
Expand Down Expand Up @@ -1558,11 +1558,11 @@ public Builder mergeFrom(
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The name.
*/
Expand All @@ -1581,11 +1581,11 @@ public java.lang.String getName() {
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return The bytes for name.
*/
Expand All @@ -1604,11 +1604,11 @@ public com.google.protobuf.ByteString getNameBytes() {
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @param value The name to set.
* @return This builder for chaining.
Expand All @@ -1626,11 +1626,11 @@ public Builder setName(java.lang.String value) {
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @return This builder for chaining.
*/
Expand All @@ -1644,11 +1644,11 @@ public Builder clearName() {
*
*
* <pre>
* The source object's name. All source objects must reside in the same
* Required. The source object's name. All source objects must reside in the same
* bucket.
* </pre>
*
* <code>string name = 1;</code>
* <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code>
*
* @param value The bytes for name to set.
* @return This builder for chaining.
Expand Down

0 comments on commit 8789e4f

Please sign in to comment.