diff --git a/.github/workflows/hermetic_library_generation.yaml b/.github/workflows/hermetic_library_generation.yaml index 44c2b4abb1..01d885fae3 100644 --- a/.github/workflows/hermetic_library_generation.yaml +++ b/.github/workflows/hermetic_library_generation.yaml @@ -43,7 +43,7 @@ jobs: with: fetch-depth: 0 token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }} - - uses: googleapis/sdk-platform-java/.github/scripts@v2.62.1 + - uses: googleapis/sdk-platform-java/.github/scripts@v2.62.2 if: env.SHOULD_RUN == 'true' with: base_ref: ${{ github.base_ref }} diff --git a/.github/workflows/unmanaged_dependency_check.yaml b/.github/workflows/unmanaged_dependency_check.yaml index fe151dfff2..cf2460525e 100644 --- a/.github/workflows/unmanaged_dependency_check.yaml +++ b/.github/workflows/unmanaged_dependency_check.yaml @@ -17,6 +17,6 @@ jobs: # repository .kokoro/build.sh - name: Unmanaged dependency check - uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.52.1 + uses: googleapis/sdk-platform-java/java-shared-dependencies/unmanaged-dependency-check@google-cloud-shared-dependencies/v3.52.2 with: bom-path: google-cloud-storage-bom/pom.xml diff --git a/.kokoro/presubmit/graalvm-native-a.cfg b/.kokoro/presubmit/graalvm-native-a.cfg index a562a6398b..5554627daa 100644 --- a/.kokoro/presubmit/graalvm-native-a.cfg +++ b/.kokoro/presubmit/graalvm-native-a.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.52.1" # {x-version-update:google-cloud-shared-dependencies:current} + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_a:3.52.2" # {x-version-update:google-cloud-shared-dependencies:current} } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native-b.cfg b/.kokoro/presubmit/graalvm-native-b.cfg index 2257ccce67..1089437409 100644 --- a/.kokoro/presubmit/graalvm-native-b.cfg +++ b/.kokoro/presubmit/graalvm-native-b.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.52.1" # {x-version-update:google-cloud-shared-dependencies:current} + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_b:3.52.2" # {x-version-update:google-cloud-shared-dependencies:current} } env_vars: { diff --git a/.kokoro/presubmit/graalvm-native-c.cfg b/.kokoro/presubmit/graalvm-native-c.cfg index a9294de35a..5465e51923 100644 --- a/.kokoro/presubmit/graalvm-native-c.cfg +++ b/.kokoro/presubmit/graalvm-native-c.cfg @@ -3,7 +3,7 @@ # Configure the docker image for kokoro-trampoline. env_vars: { key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.52.1" # {x-version-update:google-cloud-shared-dependencies:current} + value: "gcr.io/cloud-devrel-public-resources/graalvm_sdk_platform_c:3.52.2" # {x-version-update:google-cloud-shared-dependencies:current} } env_vars: { diff --git a/.readme-partials.yaml b/.readme-partials.yaml index 9f52b0512d..78d4134690 100644 --- a/.readme-partials.yaml +++ b/.readme-partials.yaml @@ -1,54 +1,4 @@ -custom_content: | - ## About Storage Control - - The [Storage Control API](https://cloud.google.com/storage/docs/reference/rpc/) lets you perform metadata-specific, control plane, and long-running operations. - - The Storage Control API creates one space to perform metadata-specific, control plane, and long-running operations apart from the Storage API. Separating these operations from the Storage API improves API standardization and lets you run faster releases. - - If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: - ```xml - - - - com.google.cloud - libraries-bom - 26.44.0 - pom - import - - - - - - - com.google.cloud - google-cloud-storage-control - - - ``` - - If you are using Maven without the BOM, add this to your dependencies: - - - ```xml - - com.google.cloud - google-cloud-storage-control - 2.41.0 - - ``` - - If you are using Gradle 5.x or later, add this to your dependencies: - ```Groovy - implementation platform('com.google.cloud:libraries-bom:26.44.0') - implementation 'com.google.cloud:google-cloud-storage-control' - ``` - If you are using Gradle without BOM, add this to your dependencies: - - ```Groovy - implementation 'com.google.cloud:google-cloud-storage-control:2.41.0' - ``` - +custom_content: | #### Creating an authorized service object To make authenticated requests to Google Cloud Storage, you must create a service object with credentials. You can diff --git a/CHANGELOG.md b/CHANGELOG.md index a5eaba8078..40b1ce9f18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Changelog +## [2.58.0](https://github.com/googleapis/java-storage/compare/v2.57.0...v2.58.0) (2025-09-23) + + +### Features + +* **storagecontrol:** Add GetIamPolicy, SetIamPolicy, and TestIamPermissions RPCs ([c884551](https://github.com/googleapis/java-storage/commit/c884551048a323f2a3fd7aaf4fce469d4d4f543e)) + + +### Bug Fixes + +* **deps:** Update the Java code generator (gapic-generator-java) to 2.62.2 ([984f8ca](https://github.com/googleapis/java-storage/commit/984f8ca23a38c7a892a2256a694b72431e44aa27)) +* Fix appendable upload finalization race condition ([#3295](https://github.com/googleapis/java-storage/issues/3295)) ([485be18](https://github.com/googleapis/java-storage/commit/485be184c08c7b857d8c9a9443f32903df879b23)) +* Fix IllegalMonitorStateException thrown from BlobAppendableUpload.isOpen() ([#3302](https://github.com/googleapis/java-storage/issues/3302)) ([aa90468](https://github.com/googleapis/java-storage/commit/aa904688b784d7427454318196ef88628e415246)) +* Update object context diff logic to be shallow rather than deep ([#3287](https://github.com/googleapis/java-storage/issues/3287)) ([2fd15f6](https://github.com/googleapis/java-storage/commit/2fd15f69e93a3df2b8dbbd4f08edd07c087e957c)) + + +### Dependencies + +* Update dependency com.google.cloud:sdk-platform-java-config to v3.52.2 ([#3298](https://github.com/googleapis/java-storage/issues/3298)) ([1489f3a](https://github.com/googleapis/java-storage/commit/1489f3a74c8a27f0888c40600c83adedcfd9a9ec)) +* Update googleapis/sdk-platform-java action to v2.62.2 ([#3299](https://github.com/googleapis/java-storage/issues/3299)) ([c3b05ac](https://github.com/googleapis/java-storage/commit/c3b05ac8798140f9ddcab098948a3a2f3638dc6b)) + ## [2.57.0](https://github.com/googleapis/java-storage/compare/v2.56.0...v2.57.0) (2025-09-09) diff --git a/README.md b/README.md index cfde826cd8..3dd16fc128 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: com.google.cloud libraries-bom - 26.67.0 + 26.68.0 pom import @@ -46,12 +46,12 @@ If you are using Maven without the BOM, add this to your dependencies: com.google.cloud google-cloud-storage - 2.56.0 + 2.57.0 com.google.cloud google-cloud-storage-control - 2.56.0 + 2.57.0 ``` @@ -59,20 +59,20 @@ If you are using Maven without the BOM, add this to your dependencies: If you are using Gradle 5.x or later, add this to your dependencies: ```Groovy -implementation platform('com.google.cloud:libraries-bom:26.67.0') +implementation platform('com.google.cloud:libraries-bom:26.68.0') implementation 'com.google.cloud:google-cloud-storage' ``` If you are using Gradle without BOM, add this to your dependencies: ```Groovy -implementation 'com.google.cloud:google-cloud-storage:2.57.0' +implementation 'com.google.cloud:google-cloud-storage:2.58.0' ``` If you are using SBT, add this to your dependencies: ```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.57.0" +libraryDependencies += "com.google.cloud" % "google-cloud-storage" % "2.58.0" ``` ## Authentication @@ -107,56 +107,6 @@ See the [Cloud Storage client library docs][javadocs] to learn how to use this Cloud Storage Client Library. -## About Storage Control - -The [Storage Control API](https://cloud.google.com/storage/docs/reference/rpc/) lets you perform metadata-specific, control plane, and long-running operations. - -The Storage Control API creates one space to perform metadata-specific, control plane, and long-running operations apart from the Storage API. Separating these operations from the Storage API improves API standardization and lets you run faster releases. - -If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: -```xml - - - - com.google.cloud - libraries-bom - 26.44.0 - pom - import - - - - - - - com.google.cloud - google-cloud-storage-control - - -``` - -If you are using Maven without the BOM, add this to your dependencies: - - -```xml - - com.google.cloud - google-cloud-storage-control - 2.41.0 - -``` - -If you are using Gradle 5.x or later, add this to your dependencies: -```Groovy -implementation platform('com.google.cloud:libraries-bom:26.44.0') -implementation 'com.google.cloud:google-cloud-storage-control' -``` -If you are using Gradle without BOM, add this to your dependencies: - -```Groovy -implementation 'com.google.cloud:google-cloud-storage-control:2.41.0' -``` - #### Creating an authorized service object To make authenticated requests to Google Cloud Storage, you must create a service object with credentials. You can @@ -371,6 +321,9 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-storage/tree/ | Get Managed Folder | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/managedfolders/GetManagedFolder.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/managedfolders/GetManagedFolder.java) | | List Managed Folders | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/managedfolders/ListManagedFolders.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/managedfolders/ListManagedFolders.java) | | Add Blob Owner | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/AddBlobOwner.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/AddBlobOwner.java) | +| Appendable Object Multiple Ranged Read | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectMultipleRangedRead.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/AppendableObjectMultipleRangedRead.java) | +| Appendable Object Read Full Object | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectReadFullObject.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/AppendableObjectReadFullObject.java) | +| Appendable Object Single Ranged Read | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectSingleRangedRead.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/AppendableObjectSingleRangedRead.java) | | Atomic Move Object | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/AtomicMoveObject.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/AtomicMoveObject.java) | | Batch Set Object Metadata | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/BatchSetObjectMetadata.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/BatchSetObjectMetadata.java) | | Change Object Csek To Kms | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/ChangeObjectCsekToKms.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/ChangeObjectCsekToKms.java) | @@ -387,6 +340,7 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-storage/tree/ | Download Object Into Memory | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/DownloadObjectIntoMemory.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/DownloadObjectIntoMemory.java) | | Download Public Object | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/DownloadPublicObject.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/DownloadPublicObject.java) | | Download Requester Pays Object | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/DownloadRequesterPaysObject.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/DownloadRequesterPaysObject.java) | +| Finalize Appendable Object Upload | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/FinalizeAppendableObjectUpload.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/FinalizeAppendableObjectUpload.java) | | Generate Encryption Key | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/GenerateEncryptionKey.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/GenerateEncryptionKey.java) | | Generate V4 Get Object Signed Url | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/GenerateV4GetObjectSignedUrl.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/GenerateV4GetObjectSignedUrl.java) | | Generate V4 Put Object Signed Url | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/GenerateV4PutObjectSignedUrl.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/GenerateV4PutObjectSignedUrl.java) | @@ -403,11 +357,13 @@ Samples are in the [`samples/`](https://github.com/googleapis/java-storage/tree/ | Release Temporary Hold | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/ReleaseTemporaryHold.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/ReleaseTemporaryHold.java) | | Remove Blob Owner | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/RemoveBlobOwner.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/RemoveBlobOwner.java) | | Restore Soft Deleted Object | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/RestoreSoftDeletedObject.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/RestoreSoftDeletedObject.java) | +| Resume Appendable Object Upload | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/ResumeAppendableObjectUpload.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/ResumeAppendableObjectUpload.java) | | Rotate Object Encryption Key | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/RotateObjectEncryptionKey.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/RotateObjectEncryptionKey.java) | | Set Event Based Hold | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/SetEventBasedHold.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/SetEventBasedHold.java) | | Set Object Metadata | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/SetObjectMetadata.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/SetObjectMetadata.java) | | Set Object Retention Policy | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/SetObjectRetentionPolicy.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/SetObjectRetentionPolicy.java) | | Set Temporary Hold | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/SetTemporaryHold.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/SetTemporaryHold.java) | +| Start Appendable Object Upload | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/StartAppendableObjectUpload.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/StartAppendableObjectUpload.java) | | Stream Object Download | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/StreamObjectDownload.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/StreamObjectDownload.java) | | Stream Object Upload | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/StreamObjectUpload.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/StreamObjectUpload.java) | | Upload Encrypted Object | [source code](https://github.com/googleapis/java-storage/blob/main/samples/snippets/src/main/java/com/example/storage/object/UploadEncryptedObject.java) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/java-storage&page=editor&open_in_editor=samples/snippets/src/main/java/com/example/storage/object/UploadEncryptedObject.java) | @@ -523,7 +479,7 @@ Java is a registered trademark of Oracle and/or its affiliates. [kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-storage/java11.html [stability-image]: https://img.shields.io/badge/stability-stable-green [maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-storage.svg -[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-storage/2.57.0 +[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-storage/2.58.0 [authentication]: https://github.com/googleapis/google-cloud-java#authentication [auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes [predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles diff --git a/gapic-google-cloud-storage-v2/pom.xml b/gapic-google-cloud-storage-v2/pom.xml index 9a881a7fbd..8f51bf0aae 100644 --- a/gapic-google-cloud-storage-v2/pom.xml +++ b/gapic-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc gapic-google-cloud-storage-v2 - 2.57.0 + 2.58.0 gapic-google-cloud-storage-v2 GRPC library for gapic-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.57.0 + 2.58.0 diff --git a/generation_config.yaml b/generation_config.yaml index 3041d3700e..10d104bfe0 100644 --- a/generation_config.yaml +++ b/generation_config.yaml @@ -1,6 +1,6 @@ -gapic_generator_version: 2.62.1 -googleapis_commitish: 46403a9acec0719c130b33eb38b2ee62a45f9f6c -libraries_bom_version: 26.67.0 +gapic_generator_version: 2.62.2 +googleapis_commitish: d89b4d093fa1526255dbc724495c3bdb0e5dd384 +libraries_bom_version: 26.68.0 libraries: - api_shortname: storage name_pretty: Cloud Storage diff --git a/google-cloud-storage-bom/pom.xml b/google-cloud-storage-bom/pom.xml index e174978239..ca3ddcbf37 100644 --- a/google-cloud-storage-bom/pom.xml +++ b/google-cloud-storage-bom/pom.xml @@ -19,12 +19,12 @@ 4.0.0 com.google.cloud google-cloud-storage-bom - 2.57.0 + 2.58.0 pom com.google.cloud sdk-platform-java-config - 3.52.1 + 3.52.2 @@ -69,37 +69,37 @@ com.google.cloud google-cloud-storage - 2.57.0 + 2.58.0 com.google.api.grpc gapic-google-cloud-storage-v2 - 2.57.0 + 2.58.0 com.google.api.grpc grpc-google-cloud-storage-v2 - 2.57.0 + 2.58.0 com.google.api.grpc proto-google-cloud-storage-v2 - 2.57.0 + 2.58.0 com.google.cloud google-cloud-storage-control - 2.57.0 + 2.58.0 com.google.api.grpc grpc-google-cloud-storage-control-v2 - 2.57.0 + 2.58.0 com.google.api.grpc proto-google-cloud-storage-control-v2 - 2.57.0 + 2.58.0 diff --git a/google-cloud-storage-control/pom.xml b/google-cloud-storage-control/pom.xml index 09906e59eb..7e85834bd0 100644 --- a/google-cloud-storage-control/pom.xml +++ b/google-cloud-storage-control/pom.xml @@ -5,13 +5,13 @@ 4.0.0 com.google.cloud google-cloud-storage-control - 2.57.0 + 2.58.0 google-cloud-storage-control GRPC library for google-cloud-storage-control com.google.cloud google-cloud-storage-parent - 2.57.0 + 2.58.0 @@ -39,6 +39,10 @@ com.google.api.grpc proto-google-common-protos + + com.google.api.grpc + proto-google-iam-v1 + com.google.api api-common diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlClient.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlClient.java index ac92b59071..485abea93f 100644 --- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlClient.java +++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlClient.java @@ -28,7 +28,13 @@ import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.PageContext; import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.resourcenames.ResourceName; import com.google.common.util.concurrent.MoreExecutors; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; @@ -509,6 +515,63 @@ * * * + * + *

GetIamPolicy + *

Gets the IAM policy for a specified bucket. The `resource` field in the request should be `projects/_/buckets/{bucket}` for a bucket, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ * + *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ * + * + * + * + *

SetIamPolicy + *

Updates an IAM policy for the specified bucket. The `resource` field in the request should be `projects/_/buckets/{bucket}` for a bucket, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ * + *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ * + * + * + * + *

TestIamPermissions + *

Tests a set of permissions on the given bucket, object, or managed folder to see which, if any, are held by the caller. The `resource` field in the request should be `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ * + *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ * + * + * * * *

See the individual methods for example code. @@ -3656,6 +3719,420 @@ public final IntelligenceConfig updateOrganizationIntelligenceConfig( return stub.updateOrganizationIntelligenceConfigCallable(); } + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the IAM policy for a specified bucket. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, or + * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+   *   Policy response = storageControlClient.getIamPolicy(resource);
+   * }
+   * }
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. See the + * operation documentation for the appropriate value for this field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(ResourceName resource) { + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the IAM policy for a specified bucket. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, or + * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   String resource =
+   *       AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString();
+   *   Policy response = storageControlClient.getIamPolicy(resource);
+   * }
+   * }
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. See the + * operation documentation for the appropriate value for this field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(String resource) { + GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the IAM policy for a specified bucket. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, or + * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(
+   *               AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   Policy response = storageControlClient.getIamPolicy(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the IAM policy for a specified bucket. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, or + * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   GetIamPolicyRequest request =
+   *       GetIamPolicyRequest.newBuilder()
+   *           .setResource(
+   *               AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+   *           .setOptions(GetPolicyOptions.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = storageControlClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getIamPolicyCallable() { + return stub.getIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an IAM policy for the specified bucket. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, or + * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = storageControlClient.setIamPolicy(resource, policy);
+   * }
+   * }
+ * + * @param resource REQUIRED: The resource for which the policy is being specified. See the + * operation documentation for the appropriate value for this field. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(ResourceName resource, Policy policy) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setPolicy(policy) + .build(); + return setIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an IAM policy for the specified bucket. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, or + * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   String resource =
+   *       AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString();
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = storageControlClient.setIamPolicy(resource, policy);
+   * }
+   * }
+ * + * @param resource REQUIRED: The resource for which the policy is being specified. See the + * operation documentation for the appropriate value for this field. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(String resource, Policy policy) { + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); + return setIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an IAM policy for the specified bucket. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, or + * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(
+   *               AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Policy response = storageControlClient.setIamPolicy(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates an IAM policy for the specified bucket. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, or + * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   SetIamPolicyRequest request =
+   *       SetIamPolicyRequest.newBuilder()
+   *           .setResource(
+   *               AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+   *           .setPolicy(Policy.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = storageControlClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something.
+   *   Policy response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable setIamPolicyCallable() { + return stub.setIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any, + * are held by the caller. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for + * an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed + * folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]");
+   *   List permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response =
+   *       storageControlClient.testIamPermissions(resource, permissions);
+   * }
+   * }
+ * + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the + * operation documentation for the appropriate value for this field. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions( + ResourceName resource, List permissions) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any, + * are held by the caller. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for + * an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed + * folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   String resource =
+   *       AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString();
+   *   List permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response =
+   *       storageControlClient.testIamPermissions(resource, permissions);
+   * }
+   * }
+ * + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the + * operation documentation for the appropriate value for this field. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions( + String resource, List permissions) { + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any, + * are held by the caller. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for + * an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed + * folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(
+   *               AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   TestIamPermissionsResponse response = storageControlClient.testIamPermissions(request);
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Tests a set of permissions on the given bucket, object, or managed folder to see which, if any, + * are held by the caller. The `resource` field in the request should be + * `projects/_/buckets/{bucket}` for a bucket, `projects/_/buckets/{bucket}/objects/{object}` for + * an object, or `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` for a managed + * folder. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (StorageControlClient storageControlClient = StorageControlClient.create()) {
+   *   TestIamPermissionsRequest request =
+   *       TestIamPermissionsRequest.newBuilder()
+   *           .setResource(
+   *               AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]").toString())
+   *           .addAllPermissions(new ArrayList())
+   *           .build();
+   *   ApiFuture future =
+   *       storageControlClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something.
+   *   TestIamPermissionsResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable + testIamPermissionsCallable() { + return stub.testIamPermissionsCallable(); + } + @Override public final void close() { stub.close(); diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlSettings.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlSettings.java index 286869bcc9..191f0f6526 100644 --- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlSettings.java +++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/StorageControlSettings.java @@ -33,6 +33,11 @@ import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.TransportChannelProvider; import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.storage.control.v2.stub.StorageControlStubSettings; @@ -274,6 +279,22 @@ public UnaryCallSettings getAnywhereCach .updateOrganizationIntelligenceConfigSettings(); } + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return ((StorageControlStubSettings) getStubSettings()).getIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return ((StorageControlStubSettings) getStubSettings()).setIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return ((StorageControlStubSettings) getStubSettings()).testIamPermissionsSettings(); + } + public static final StorageControlSettings create(StorageControlStubSettings stub) throws IOException { return new StorageControlSettings.Builder(stub.toBuilder()).build(); @@ -546,6 +567,22 @@ public UnaryCallSettings.Builder renameFolderSet return getStubSettingsBuilder().updateOrganizationIntelligenceConfigSettings(); } + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getStubSettingsBuilder().getIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return getStubSettingsBuilder().setIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return getStubSettingsBuilder().testIamPermissionsSettings(); + } + @Override public StorageControlSettings build() throws IOException { return new StorageControlSettings(this); diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/gapic_metadata.json b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/gapic_metadata.json index 308c596131..f86f4c1c4b 100644 --- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/gapic_metadata.json +++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/gapic_metadata.json @@ -37,6 +37,9 @@ "GetFolderIntelligenceConfig": { "methods": ["getFolderIntelligenceConfig", "getFolderIntelligenceConfig", "getFolderIntelligenceConfig", "getFolderIntelligenceConfigCallable"] }, + "GetIamPolicy": { + "methods": ["getIamPolicy", "getIamPolicy", "getIamPolicy", "getIamPolicyCallable"] + }, "GetManagedFolder": { "methods": ["getManagedFolder", "getManagedFolder", "getManagedFolder", "getManagedFolderCallable"] }, @@ -67,6 +70,12 @@ "ResumeAnywhereCache": { "methods": ["resumeAnywhereCache", "resumeAnywhereCache", "resumeAnywhereCache", "resumeAnywhereCacheCallable"] }, + "SetIamPolicy": { + "methods": ["setIamPolicy", "setIamPolicy", "setIamPolicy", "setIamPolicyCallable"] + }, + "TestIamPermissions": { + "methods": ["testIamPermissions", "testIamPermissions", "testIamPermissions", "testIamPermissionsCallable"] + }, "UpdateAnywhereCache": { "methods": ["updateAnywhereCacheAsync", "updateAnywhereCacheAsync", "updateAnywhereCacheOperationCallable", "updateAnywhereCacheCallable"] }, diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/GrpcStorageControlStub.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/GrpcStorageControlStub.java index 19f8d1916a..5778eaffc5 100644 --- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/GrpcStorageControlStub.java +++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/GrpcStorageControlStub.java @@ -30,6 +30,11 @@ import com.google.api.gax.rpc.UnaryCallable; import com.google.api.pathtemplate.PathTemplate; import com.google.common.base.Strings; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; import com.google.longrunning.stub.GrpcOperationsStub; import com.google.protobuf.Empty; @@ -343,6 +348,36 @@ public class GrpcStorageControlStub extends StorageControlStub { .setSampledToLocalTracing(true) .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.storage.control.v2.StorageControl/GetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + + private static final MethodDescriptor setIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.storage.control.v2.StorageControl/SetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + + private static final MethodDescriptor + testIamPermissionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.storage.control.v2.StorageControl/TestIamPermissions") + .setRequestMarshaller( + ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .setSampledToLocalTracing(true) + .build(); + private final UnaryCallable createFolderCallable; private final UnaryCallable deleteFolderCallable; private final UnaryCallable getFolderCallable; @@ -391,6 +426,10 @@ public class GrpcStorageControlStub extends StorageControlStub { getOrganizationIntelligenceConfigCallable; private final UnaryCallable updateOrganizationIntelligenceConfigCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; @@ -430,6 +469,20 @@ public class GrpcStorageControlStub extends StorageControlStub { PathTemplate.create("{bucket=projects/*/buckets/*}/**"); private static final PathTemplate LIST_ANYWHERE_CACHES_0_PATH_TEMPLATE = PathTemplate.create("{bucket=**}"); + private static final PathTemplate GET_IAM_POLICY_0_PATH_TEMPLATE = + PathTemplate.create("{bucket=**}"); + private static final PathTemplate GET_IAM_POLICY_1_PATH_TEMPLATE = + PathTemplate.create("{bucket=projects/*/buckets/*}/**"); + private static final PathTemplate SET_IAM_POLICY_0_PATH_TEMPLATE = + PathTemplate.create("{bucket=**}"); + private static final PathTemplate SET_IAM_POLICY_1_PATH_TEMPLATE = + PathTemplate.create("{bucket=projects/*/buckets/*}/**"); + private static final PathTemplate TEST_IAM_PERMISSIONS_0_PATH_TEMPLATE = + PathTemplate.create("{bucket=**}"); + private static final PathTemplate TEST_IAM_PERMISSIONS_1_PATH_TEMPLATE = + PathTemplate.create("{bucket=projects/*/buckets/*}/objects/**"); + private static final PathTemplate TEST_IAM_PERMISSIONS_2_PATH_TEMPLATE = + PathTemplate.create("{bucket=projects/*/buckets/*}/managedFolders/**"); public static final GrpcStorageControlStub create(StorageControlStubSettings settings) throws IOException { @@ -859,6 +912,44 @@ protected GrpcStorageControlStub( return builder.build(); }) .build(); + GrpcCallSettings getIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add(request.getResource(), "bucket", GET_IAM_POLICY_0_PATH_TEMPLATE); + builder.add(request.getResource(), "bucket", GET_IAM_POLICY_1_PATH_TEMPLATE); + return builder.build(); + }) + .build(); + GrpcCallSettings setIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add(request.getResource(), "bucket", SET_IAM_POLICY_0_PATH_TEMPLATE); + builder.add(request.getResource(), "bucket", SET_IAM_POLICY_1_PATH_TEMPLATE); + return builder.build(); + }) + .build(); + GrpcCallSettings + testIamPermissionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setParamsExtractor( + request -> { + RequestParamsBuilder builder = RequestParamsBuilder.create(); + builder.add( + request.getResource(), "bucket", TEST_IAM_PERMISSIONS_0_PATH_TEMPLATE); + builder.add( + request.getResource(), "bucket", TEST_IAM_PERMISSIONS_1_PATH_TEMPLATE); + builder.add( + request.getResource(), "bucket", TEST_IAM_PERMISSIONS_2_PATH_TEMPLATE); + return builder.build(); + }) + .build(); this.createFolderCallable = callableFactory.createUnaryCallable( @@ -990,6 +1081,17 @@ protected GrpcStorageControlStub( updateOrganizationIntelligenceConfigTransportSettings, settings.updateOrganizationIntelligenceConfigSettings(), clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); @@ -1157,6 +1259,22 @@ public UnaryCallable getAnywhereCacheCal return updateOrganizationIntelligenceConfigCallable; } + @Override + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + @Override + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + @Override public final void close() { try { diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/HttpJsonStorageControlStub.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/HttpJsonStorageControlStub.java index 9aed10cfce..a878e2155b 100644 --- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/HttpJsonStorageControlStub.java +++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/HttpJsonStorageControlStub.java @@ -29,6 +29,11 @@ import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.RequestParamsBuilder; import com.google.api.gax.rpc.UnaryCallable; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.protobuf.TypeRegistry; @@ -689,6 +694,28 @@ public UnaryCallable getAnywhereCacheCal + " method yet."); } + @Override + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException( + "Not implemented: getIamPolicyCallable(). REST transport is not implemented for this method" + + " yet."); + } + + @Override + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException( + "Not implemented: setIamPolicyCallable(). REST transport is not implemented for this method" + + " yet."); + } + + @Override + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException( + "Not implemented: testIamPermissionsCallable(). REST transport is not implemented for this" + + " method yet."); + } + @Override public final void close() { try { diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStub.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStub.java index 5bab8877f0..8a44f5c389 100644 --- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStub.java +++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStub.java @@ -23,6 +23,11 @@ import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.rpc.OperationCallable; import com.google.api.gax.rpc.UnaryCallable; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; import com.google.longrunning.stub.OperationsStub; import com.google.protobuf.Empty; @@ -216,6 +221,19 @@ public UnaryCallable getAnywhereCacheCal "Not implemented: updateOrganizationIntelligenceConfigCallable()"); } + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); + } + + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); + } + + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); + } + @Override public abstract void close(); } diff --git a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStubSettings.java b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStubSettings.java index d0191ad465..b72c48f76f 100644 --- a/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStubSettings.java +++ b/google-cloud-storage-control/src/main/java/com/google/storage/control/v2/stub/StorageControlStubSettings.java @@ -54,6 +54,11 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; import com.google.protobuf.Empty; import com.google.storage.control.v2.AnywhereCache; @@ -231,6 +236,10 @@ public class StorageControlStubSettings extends StubSettings updateOrganizationIntelligenceConfigSettings; + private final UnaryCallSettings getIamPolicySettings; + private final UnaryCallSettings setIamPolicySettings; + private final UnaryCallSettings + testIamPermissionsSettings; private static final PagedListDescriptor LIST_FOLDERS_PAGE_STR_DESC = @@ -552,6 +561,22 @@ public UnaryCallSettings getAnywhereCach return updateOrganizationIntelligenceConfigSettings; } + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + public StorageControlStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() @@ -697,6 +722,9 @@ protected StorageControlStubSettings(Builder settingsBuilder) throws IOException settingsBuilder.getOrganizationIntelligenceConfigSettings().build(); updateOrganizationIntelligenceConfigSettings = settingsBuilder.updateOrganizationIntelligenceConfigSettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); } /** Builder for StorageControlStubSettings. */ @@ -759,6 +787,10 @@ public static class Builder extends StubSettings.Builder updateOrganizationIntelligenceConfigSettings; + private final UnaryCallSettings.Builder getIamPolicySettings; + private final UnaryCallSettings.Builder setIamPolicySettings; + private final UnaryCallSettings.Builder + testIamPermissionsSettings; private static final ImmutableMap> RETRYABLE_CODE_DEFINITIONS; @@ -840,6 +872,9 @@ protected Builder(ClientContext clientContext) { getOrganizationIntelligenceConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); updateOrganizationIntelligenceConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -865,7 +900,10 @@ protected Builder(ClientContext clientContext) { getFolderIntelligenceConfigSettings, updateFolderIntelligenceConfigSettings, getOrganizationIntelligenceConfigSettings, - updateOrganizationIntelligenceConfigSettings); + updateOrganizationIntelligenceConfigSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); initDefaults(this); } @@ -906,6 +944,9 @@ protected Builder(StorageControlStubSettings settings) { settings.getOrganizationIntelligenceConfigSettings.toBuilder(); updateOrganizationIntelligenceConfigSettings = settings.updateOrganizationIntelligenceConfigSettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.>of( @@ -931,7 +972,10 @@ protected Builder(StorageControlStubSettings settings) { getFolderIntelligenceConfigSettings, updateFolderIntelligenceConfigSettings, getOrganizationIntelligenceConfigSettings, - updateOrganizationIntelligenceConfigSettings); + updateOrganizationIntelligenceConfigSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); } private static Builder createDefault() { @@ -1074,6 +1118,21 @@ private static Builder initDefaults(Builder builder) { .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + builder + .getIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .setIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .testIamPermissionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + builder .renameFolderOperationSettings() .setInitialCallSettings( @@ -1326,6 +1385,22 @@ public UnaryCallSettings.Builder renameFolderSet return updateOrganizationIntelligenceConfigSettings; } + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + @Override public StorageControlStubSettings build() throws IOException { return new StorageControlStubSettings(this); diff --git a/google-cloud-storage-control/src/main/resources/META-INF/native-image/com.google.storage.control.v2/reflect-config.json b/google-cloud-storage-control/src/main/resources/META-INF/native-image/com.google.storage.control.v2/reflect-config.json index fddda0a6dd..5353fcc369 100644 --- a/google-cloud-storage-control/src/main/resources/META-INF/native-image/com.google.storage.control.v2/reflect-config.json +++ b/google-cloud-storage-control/src/main/resources/META-INF/native-image/com.google.storage.control.v2/reflect-config.json @@ -494,6 +494,249 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.iam.v1.AuditConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta$Action", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditConfigDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.AuditLogConfig$LogType", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Binding", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Binding$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta$Action", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.BindingDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.GetIamPolicyRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.GetIamPolicyRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.GetPolicyOptions", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.GetPolicyOptions$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Policy", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.Policy$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.PolicyDelta", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.PolicyDelta$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.SetIamPolicyRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.SetIamPolicyRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.TestIamPermissionsRequest", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.TestIamPermissionsRequest$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.TestIamPermissionsResponse", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.iam.v1.TestIamPermissionsResponse$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.longrunning.CancelOperationRequest", "queryAllDeclaredConstructors": true, @@ -2266,5 +2509,23 @@ "allPublicMethods": true, "allDeclaredClasses": true, "allPublicClasses": true + }, + { + "name": "com.google.type.Expr", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.type.Expr$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true } ] \ No newline at end of file diff --git a/google-cloud-storage-control/src/main/resources/com/google/storage/control/v2/gapic_metadata.json b/google-cloud-storage-control/src/main/resources/com/google/storage/control/v2/gapic_metadata.json index 308c596131..f86f4c1c4b 100644 --- a/google-cloud-storage-control/src/main/resources/com/google/storage/control/v2/gapic_metadata.json +++ b/google-cloud-storage-control/src/main/resources/com/google/storage/control/v2/gapic_metadata.json @@ -37,6 +37,9 @@ "GetFolderIntelligenceConfig": { "methods": ["getFolderIntelligenceConfig", "getFolderIntelligenceConfig", "getFolderIntelligenceConfig", "getFolderIntelligenceConfigCallable"] }, + "GetIamPolicy": { + "methods": ["getIamPolicy", "getIamPolicy", "getIamPolicy", "getIamPolicyCallable"] + }, "GetManagedFolder": { "methods": ["getManagedFolder", "getManagedFolder", "getManagedFolder", "getManagedFolderCallable"] }, @@ -67,6 +70,12 @@ "ResumeAnywhereCache": { "methods": ["resumeAnywhereCache", "resumeAnywhereCache", "resumeAnywhereCache", "resumeAnywhereCacheCallable"] }, + "SetIamPolicy": { + "methods": ["setIamPolicy", "setIamPolicy", "setIamPolicy", "setIamPolicyCallable"] + }, + "TestIamPermissions": { + "methods": ["testIamPermissions", "testIamPermissions", "testIamPermissions", "testIamPermissionsCallable"] + }, "UpdateAnywhereCache": { "methods": ["updateAnywhereCacheAsync", "updateAnywhereCacheAsync", "updateAnywhereCacheOperationCallable", "updateAnywhereCacheCallable"] }, diff --git a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/MockStorageControlImpl.java b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/MockStorageControlImpl.java index e98b47a499..069a922359 100644 --- a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/MockStorageControlImpl.java +++ b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/MockStorageControlImpl.java @@ -17,6 +17,11 @@ package com.google.storage.control.v2; import com.google.api.core.BetaApi; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Empty; @@ -554,4 +559,66 @@ public void updateOrganizationIntelligenceConfig( Exception.class.getName()))); } } + + @Override + public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext(((Policy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetIamPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext(((Policy) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method SetIamPolicy, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Policy.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void testIamPermissions( + TestIamPermissionsRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof TestIamPermissionsResponse) { + requests.add(request); + responseObserver.onNext(((TestIamPermissionsResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method TestIamPermissions, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + TestIamPermissionsResponse.class.getName(), + Exception.class.getName()))); + } + } } diff --git a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientHttpJsonTest.java b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientHttpJsonTest.java index e2769bba9c..10eda32485 100644 --- a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientHttpJsonTest.java +++ b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientHttpJsonTest.java @@ -687,4 +687,22 @@ public void updateOrganizationIntelligenceConfigExceptionTest() throws Exception // Expected exception. } } + + @Test + public void getIamPolicyUnsupportedMethodTest() throws Exception { + // The getIamPolicy() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } + + @Test + public void setIamPolicyUnsupportedMethodTest() throws Exception { + // The setIamPolicy() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } + + @Test + public void testIamPermissionsUnsupportedMethodTest() throws Exception { + // The testIamPermissions() method is not supported in REST transport. + // This empty test is generated for technical reasons. + } } diff --git a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientTest.java b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientTest.java index a0ab3fe3dd..ea1e9bc7dc 100644 --- a/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientTest.java +++ b/google-cloud-storage-control/src/test/java/com/google/storage/control/v2/StorageControlClientTest.java @@ -28,16 +28,26 @@ import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.StatusCode; +import com.google.api.resourcenames.ResourceName; import com.google.common.collect.Lists; +import com.google.iam.v1.AuditConfig; +import com.google.iam.v1.Binding; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.Operation; import com.google.protobuf.AbstractMessage; import com.google.protobuf.Any; +import com.google.protobuf.ByteString; import com.google.protobuf.Duration; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import com.google.protobuf.Timestamp; import io.grpc.StatusRuntimeException; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.UUID; @@ -1983,4 +1993,252 @@ public void updateOrganizationIntelligenceConfigExceptionTest() throws Exception // Expected exception. } } + + @Test + public void getIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockStorageControl.addResponse(expectedResponse); + + ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]"); + + Policy actualResponse = client.getIamPolicy(resource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockStorageControl.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource.toString(), actualRequest.getResource()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockStorageControl.addException(exception); + + try { + ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]"); + client.getIamPolicy(resource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockStorageControl.addResponse(expectedResponse); + + String resource = "resource-341064690"; + + Policy actualResponse = client.getIamPolicy(resource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockStorageControl.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockStorageControl.addException(exception); + + try { + String resource = "resource-341064690"; + client.getIamPolicy(resource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockStorageControl.addResponse(expectedResponse); + + ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]"); + Policy policy = Policy.newBuilder().build(); + + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockStorageControl.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource.toString(), actualRequest.getResource()); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockStorageControl.addException(exception); + + try { + ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]"); + Policy policy = Policy.newBuilder().build(); + client.setIamPolicy(resource, policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void setIamPolicyTest2() throws Exception { + Policy expectedResponse = + Policy.newBuilder() + .setVersion(351608024) + .addAllBindings(new ArrayList()) + .addAllAuditConfigs(new ArrayList()) + .setEtag(ByteString.EMPTY) + .build(); + mockStorageControl.addResponse(expectedResponse); + + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); + + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockStorageControl.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void setIamPolicyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockStorageControl.addException(exception); + + try { + String resource = "resource-341064690"; + Policy policy = Policy.newBuilder().build(); + client.setIamPolicy(resource, policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockStorageControl.addResponse(expectedResponse); + + ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]"); + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockStorageControl.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(resource.toString(), actualRequest.getResource()); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockStorageControl.addException(exception); + + try { + ResourceName resource = AnywhereCacheName.of("[PROJECT]", "[BUCKET]", "[ANYWHERE_CACHE]"); + List permissions = new ArrayList<>(); + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void testIamPermissionsTest2() throws Exception { + TestIamPermissionsResponse expectedResponse = + TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); + mockStorageControl.addResponse(expectedResponse); + + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockStorageControl.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); + + Assert.assertEquals(resource, actualRequest.getResource()); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void testIamPermissionsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockStorageControl.addException(exception); + + try { + String resource = "resource-341064690"; + List permissions = new ArrayList<>(); + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } } diff --git a/google-cloud-storage/pom.xml b/google-cloud-storage/pom.xml index 3589bbf9f8..989a49db4a 100644 --- a/google-cloud-storage/pom.xml +++ b/google-cloud-storage/pom.xml @@ -2,7 +2,7 @@ 4.0.0 google-cloud-storage - 2.57.0 + 2.58.0 jar Google Cloud Storage https://github.com/googleapis/java-storage @@ -12,11 +12,11 @@ com.google.cloud google-cloud-storage-parent - 2.57.0 + 2.58.0 google-cloud-storage - 1.123.3 + 1.123.4 @@ -239,14 +239,14 @@ com.google.api.grpc proto-google-cloud-kms-v1 - 0.167.0 + 0.168.0 test com.google.cloud google-cloud-kms - 2.76.0 + 2.77.0 test diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiAppendableUnbufferedWritableByteChannel.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiAppendableUnbufferedWritableByteChannel.java index 3910a672b2..8c45da06df 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiAppendableUnbufferedWritableByteChannel.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiAppendableUnbufferedWritableByteChannel.java @@ -145,6 +145,7 @@ private long internalWrite(ByteBuffer[] srcs, int srcsOffset, int srcsLength) th // those bytes to implicitly flag as dirty. rewindableContent.flagDirty(); + long remainingAfterPacking = Buffers.totalRemaining(srcs, srcsOffset, srcsLength); long bytesConsumed = 0; for (int i = 0, len = data.length, lastIdx = len - 1; i < len; i++) { ChunkSegment datum = data[i]; @@ -153,7 +154,7 @@ private long internalWrite(ByteBuffer[] srcs, int srcsOffset, int srcsLength) th boolean appended; if (i < lastIdx && !shouldFlush) { appended = stream.append(datum); - } else if (i == lastIdx && nextWriteShouldFinalize) { + } else if (i == lastIdx && remainingAfterPacking == 0 && nextWriteShouldFinalize) { appended = stream.appendAndFinalize(datum); } else { appended = stream.appendAndFlush(datum); diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiUploadState.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiUploadState.java index 6d64c8b5e0..7894e35f99 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiUploadState.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiUploadState.java @@ -416,10 +416,10 @@ final boolean offer(ChunkSegmenter.@NonNull ChunkSegment datum) { try { requireNonNull(datum, "data must be non null"); validateCurrentStateIsOneOf(State.allNonTerminal); - checkNotFinalizing(); ByteString b = datum.getB(); - long availableCapacity = availableCapacity(); int size = b.size(); + checkNotFinalizing(size); + long availableCapacity = availableCapacity(); if (size <= availableCapacity) { Crc32cLengthKnown crc32c = datum.getCrc32c(); ChecksummedData.Builder checksummedData = ChecksummedData.newBuilder().setContent(b); @@ -449,7 +449,7 @@ public boolean finalFlush(long totalLength) { lock.lock(); try { validateCurrentStateIsOneOf(State.allNonTerminal); - checkNotFinalizing(); + checkNotFinalizing(0); checkArgument( totalLength == totalSentBytes, "(totalLength == totalSentBytes) (%s == %s)", @@ -490,7 +490,7 @@ final boolean offer(@NonNull BidiWriteObjectRequest e) { requireNonNull(e, "e must be non null"); validateCurrentStateIsOneOf(State.allNonTerminal); if (e.hasChecksummedData()) { - checkNotFinalizing(); + checkNotFinalizing(e.getChecksummedData().getContent().size()); } int size = e.getChecksummedData().getContent().size(); long availableCapacity = availableCapacity(); @@ -827,10 +827,15 @@ protected final void validateCurrentStateIsOneOf(State... allowed) { state); } - private void checkNotFinalizing() { + private void checkNotFinalizing(int size) { checkState( finishWriteOffset == -1, - "Attempting to append bytes even though finalization has previously been signaled."); + "Attempting to append bytes even though finalization has previously been signaled." + + " (finishWriteOffset: %s, totalSentBytes: %s, confirmedBytes: %s, size: %s)", + finishWriteOffset, + totalSentBytes, + confirmedBytes, + size); } protected final boolean internalOffer(BidiWriteObjectRequest e) { diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobAppendableUploadImpl.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobAppendableUploadImpl.java index cc3bac3f1a..5445473e6a 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobAppendableUploadImpl.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobAppendableUploadImpl.java @@ -111,6 +111,7 @@ public int write(ByteBuffer src) throws IOException { @Override public boolean isOpen() { + lock.lock(); try { return buffered.isOpen(); } finally { diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java index aa78fa7276..a083338e74 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java @@ -33,7 +33,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Maps; import com.google.common.io.BaseEncoding; import java.io.Serializable; import java.nio.ByteBuffer; @@ -1273,18 +1272,15 @@ public Builder setContexts(ObjectContexts contexts) { // about the timestamps when determining if a value needs to be patched. Create a new map // where we remove the timestamps so equals is usable. Map left = - this.contexts == null - ? null - : ignoreCustomContextPayloadTimestamps(this.contexts.getCustom()); + this.contexts == null ? null : this.contexts.getCustom(); Map right = - contexts == null ? null : ignoreCustomContextPayloadTimestamps(contexts.getCustom()); + contexts == null ? null : contexts.getCustom(); if (!Objects.equals(left, right)) { if (right != null) { diffMaps( NamedField.nested(BlobField.OBJECT_CONTEXTS, NamedField.literal("custom")), left, right, - f -> NamedField.nested(f, NAMED_FIELD_LITERAL_VALUE), modifiedFields::add); this.contexts = contexts; } else { @@ -1295,20 +1291,6 @@ public Builder setContexts(ObjectContexts contexts) { return this; } - private static @Nullable Map<@NonNull String, @Nullable ObjectCustomContextPayload> - ignoreCustomContextPayloadTimestamps( - @Nullable Map<@NonNull String, @Nullable ObjectCustomContextPayload> orig) { - if (orig == null) { - return null; - } - return Maps.transformValues( - orig, - v -> - v == null - ? null - : ObjectCustomContextPayload.newBuilder().setValue(v.getValue()).build()); - } - @Override public BlobInfo build() { checkNotNull(blobId); diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/JsonUtils.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/JsonUtils.java index 50427a8cf4..f5297ee837 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/JsonUtils.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/JsonUtils.java @@ -22,9 +22,6 @@ import com.google.cloud.storage.UnifiedOpts.NamedField; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.MapDifference; -import com.google.common.collect.MapDifference.ValueDifference; -import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonArray; @@ -41,7 +38,6 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.stream.Stream; import org.checkerframework.checker.nullness.qual.NonNull; final class JsonUtils { @@ -70,7 +66,7 @@ static T getOutputJsonWithSelectedFields( .map(NamedField::getApiaryName) .collect(ImmutableSet.toImmutableSet()); try { - // The datamodel of the apiairy json representation doesn't have a common parent for all + // The datamodel of the apiary json representation doesn't have a common parent for all // field types, rather than writing a significant amount of code to handle all of these types // leverage Gson. // 1. serialize the object to it's json string @@ -104,24 +100,25 @@ static T getOutputJsonWithSelectedFields( static @NonNull JsonObject getOutputJson(JsonObject inputJson, Set fieldsInOutput) { Map l = flatten(inputJson); - Map r = Utils.setToMap(fieldsInOutput, k -> null); - - MapDifference diff = Maps.difference(l, r); // use hashmap so we can have null values HashMap flat = new HashMap<>(); - Stream.of( - diff.entriesInCommon().entrySet().stream(), - diff.entriesOnlyOnRight().entrySet().stream(), - // if the key is present in both maps, but has a differing value select the value from - // the left side, as that is the value from inputJson - Maps.transformValues(diff.entriesDiffering(), ValueDifference::leftValue) - .entrySet() - .stream()) - // flatten - .flatMap(x -> x) - .forEach(e -> flat.put(e.getKey(), e.getValue())); - + for (String fieldToRetain : fieldsInOutput) { + boolean keyFound = false; + // Check for exact match or prefix match in the flattened source map (l) + for (Map.Entry sourceEntry : l.entrySet()) { + String sourceKey = sourceEntry.getKey(); + if (sourceKey.equals(fieldToRetain) || sourceKey.startsWith(fieldToRetain + ".")) { + flat.put(sourceKey, sourceEntry.getValue()); + keyFound = true; + } + } + // If the field to retain wasn't found in the source, it means we need to add it + // to the output with a null value, signaling a deletion. + if (!keyFound) { + flat.put(fieldToRetain, null); + } + } return treeify(flat); } diff --git a/google-cloud-storage/src/main/java/com/google/cloud/storage/Utils.java b/google-cloud-storage/src/main/java/com/google/cloud/storage/Utils.java index d6f96b8ad4..eece2fe79d 100644 --- a/google-cloud-storage/src/main/java/com/google/cloud/storage/Utils.java +++ b/google-cloud-storage/src/main/java/com/google/cloud/storage/Utils.java @@ -29,7 +29,6 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.MapDifference; -import com.google.common.collect.MapDifference.ValueDifference; import com.google.common.collect.Maps; import com.google.common.io.BaseEncoding; import com.google.common.primitives.Ints; @@ -282,57 +281,28 @@ static T firstNonNull(Supplier<@Nullable T>... ss) { */ static void diffMaps( NamedField parent, Map left, Map right, Consumer sink) { - diffMaps(parent, left, right, Function.identity(), sink); - } - - /** - * Diff two maps, and append each differing key to {@code sink} with the parent of {{@code - * parent}. Conditionally apply {@code dec} if deeper qualification is necessary. - */ - static void diffMaps( - NamedField parent, - Map left, - Map right, - Function dec, - Consumer sink) { - final Stream keys; + final Stream keys; if (left != null && right == null) { - keys = left.keySet().stream().map(NamedField::literal); + keys = left.keySet().stream(); } else if (left == null && right != null) { - keys = right.keySet().stream().map(NamedField::literal).map(dec); + keys = right.keySet().stream(); } else if (left != null && right != null) { MapDifference difference = Maps.difference(left, right); keys = Stream.of( // keys with modified values - difference.entriesDiffering().entrySet().stream() - .map( - e -> { - String key = e.getKey(); - NamedField literal = NamedField.literal(key); - ValueDifference diff = e.getValue(); - - if (diff.leftValue() != null && diff.rightValue() == null) { - return literal; - } else if (diff.leftValue() == null && diff.rightValue() != null) { - return literal; - } else { - return dec.apply(literal); - } - }), + difference.entriesDiffering().keySet().stream(), // Only include keys to remove if ALL keys were removed right.isEmpty() - ? difference.entriesOnlyOnLeft().keySet().stream().map(NamedField::literal) - : Stream.empty(), + ? difference.entriesOnlyOnLeft().keySet().stream() + : Stream.empty(), // new keys - difference.entriesOnlyOnRight().keySet().stream() - .map(NamedField::literal) - .map(dec)) + difference.entriesOnlyOnRight().keySet().stream()) .flatMap(x -> x); } else { keys = Stream.empty(); } - keys.map(k -> NamedField.nested(parent, k)).forEach(sink); + keys.map(NamedField::literal).map(k -> NamedField.nested(parent, k)).forEach(sink); } static T[] subArray(T[] ts, int offset, int length) { diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiAppendableUnbufferedWritableByteChannelTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiAppendableUnbufferedWritableByteChannelTest.java new file mode 100644 index 0000000000..0364ddaf18 --- /dev/null +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiAppendableUnbufferedWritableByteChannelTest.java @@ -0,0 +1,121 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.storage; + +import static com.google.common.truth.Truth.assertThat; + +import com.google.api.core.SettableApiFuture; +import com.google.api.gax.grpc.GrpcCallContext; +import com.google.cloud.storage.BidiUploadState.AppendableUploadState; +import com.google.cloud.storage.ITAppendableUploadFakeTest.FakeStorage; +import com.google.cloud.storage.it.ChecksummedTestContent; +import com.google.common.collect.ImmutableList; +import com.google.storage.v2.BidiWriteObjectResponse; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.time.OffsetDateTime; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.atomic.AtomicLong; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public final class BidiAppendableUnbufferedWritableByteChannelTest { + @Rule public final TestName testName = new TestName(); + + @Test + public void appendAndFinalizeOnlyPerformedIfAllBytesConsumed() throws IOException { + ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); + ChecksummedTestContent ctc = ChecksummedTestContent.gen(27); + AppendableUploadState state = + BidiUploadState.appendableNew( + BidiUploadTest.appendRequestNew, + GrpcCallContext::createDefault, + 16, + SettableApiFuture.create(), + Crc32cValue.zero()); + AtomicLong finishWriteOffset = new AtomicLong(-1); + BidiUploadStreamingStream stream = + new BidiUploadStreamingStream( + state, + executor, + BidiUploadTestUtils.adaptOnlySend( + respond -> + request -> { + if (request.getFinishWrite()) { + finishWriteOffset.set( + request.getWriteOffset() + + request.getChecksummedData().getContent().size()); + } + executor.submit( + () -> { + switch ((int) request.getWriteOffset()) { + case 0: + respond.onResponse(BidiUploadTest.resourceWithSize(0)); + break; + case 4: + case 8: + // do not ack any bytes until we receive 16, this simulates + // latency on the bytes being ack'd. + break; + case 12: + respond.onResponse(BidiUploadTestUtils.incremental(8)); + break; + case 16: + respond.onResponse(BidiUploadTestUtils.incremental(12)); + break; + case 20: + respond.onResponse(BidiUploadTestUtils.incremental(16)); + break; + case 24: + BidiWriteObjectResponse.Builder b = + BidiUploadTest.resourceFor(ctc).toBuilder(); + b.getResourceBuilder() + .setFinalizeTime( + Conversions.grpc() + .timestampCodec + .encode(OffsetDateTime.now())); + respond.onResponse(b.build()); + break; + default: + respond.onError( + FakeStorage.unexpectedRequest(request, ImmutableList.of())); + break; + } + }); + }), + 3, + RetryContext.neverRetry()); + ChunkSegmenter chunkSegmenter = + new ChunkSegmenter(Hasher.enabled(), ByteStringStrategy.copy(), 4, 2); + BidiAppendableUnbufferedWritableByteChannel channel = + new BidiAppendableUnbufferedWritableByteChannel(stream, chunkSegmenter, 4, 0); + + ByteBuffer buf = ctc.asByteBuffer(); + int written1 = channel.write(buf); + // fill up the outbound queue + assertThat(written1).isEqualTo(16); + + // asynchronously bytes will be ack'd 4 at a time, eventually there will be enough space in the + // outbound queue to allow writeAndClose to start consuming bytes. + channel.nextWriteShouldFinalize(); + int written2 = channel.writeAndClose(buf); + assertThat(written2).isEqualTo(11); + assertThat(finishWriteOffset.get()).isEqualTo(ctc.length()); + } +} diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiUploadTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiUploadTest.java index 52b6ebb5fe..7e00427fb4 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiUploadTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiUploadTest.java @@ -17,6 +17,8 @@ package com.google.cloud.storage; import static com.google.cloud.storage.BidiUploadState.appendableNew; +import static com.google.cloud.storage.BidiUploadTestUtils.adaptOnlySend; +import static com.google.cloud.storage.BidiUploadTestUtils.alwaysErrorBidiStreamingCallable; import static com.google.cloud.storage.BidiUploadTestUtils.createSegment; import static com.google.cloud.storage.BidiUploadTestUtils.finishAt; import static com.google.cloud.storage.BidiUploadTestUtils.incremental; @@ -39,11 +41,7 @@ import com.google.api.gax.grpc.GrpcCallContext; import com.google.api.gax.grpc.GrpcStatusCode; import com.google.api.gax.rpc.AbortedException; -import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiExceptionFactory; -import com.google.api.gax.rpc.BidiStreamingCallable; -import com.google.api.gax.rpc.ClientStream; -import com.google.api.gax.rpc.ClientStreamReadyObserver; import com.google.api.gax.rpc.ErrorDetails; import com.google.api.gax.rpc.ResponseObserver; import com.google.api.gax.rpc.StreamController; @@ -64,7 +62,6 @@ import com.google.common.collect.Range; import com.google.protobuf.Any; import com.google.protobuf.ByteString; -import com.google.protobuf.Message; import com.google.protobuf.TextFormat; import com.google.rpc.Code; import com.google.storage.v2.AppendObjectSpec; @@ -1840,59 +1837,6 @@ public void recordError( exec1.shutdownNow(); } } - - private static BidiStreamingCallable - alwaysErrorBidiStreamingCallable(Status status) { - return adaptOnlySend(respond -> request -> respond.onError(status.asRuntimeException())); - } - - private static BidiStreamingCallable adaptOnlySend( - Function, OnlySendClientStream> func) { - return adapt(func::apply); - } - - private static BidiStreamingCallable adapt( - Function, ClientStream> func) { - return adapt( - (respond, onReady, context) -> { - ClientStream clientStream = func.apply(respond); - StreamController controller = TestUtils.nullStreamController(); - respond.onStart(controller); - return clientStream; - }); - } - - /** - * BidiStreamingCallable isn't functional even though it's a single abstract method. - * - *

Define a method that can adapt a TriFunc as the required implementation of {@link - * BidiStreamingCallable#internalCall(ResponseObserver, ClientStreamReadyObserver, - * ApiCallContext)}. - * - *

Saves several lines of boilerplate in each test. - */ - private static BidiStreamingCallable adapt( - StreamingStreamTest.TriFunc< - ResponseObserver, - ClientStreamReadyObserver, - ApiCallContext, - ClientStream> - func) { - return new BidiStreamingCallable() { - @Override - public ClientStream internalCall( - ResponseObserver respond, - ClientStreamReadyObserver onReady, - ApiCallContext context) { - return func.apply(respond, onReady, context); - } - }; - } - - @FunctionalInterface - interface TriFunc { - R apply(A a, B b, C c); - } } public static final class BidiUploadStreamingStreamResponseObserverTest { @@ -2289,18 +2233,4 @@ static BidiWriteObjectRequest flushOffset(long offset) { } return BidiWriteObjectResponse.newBuilder().setResource(f.apply(b)).build(); } - - @FunctionalInterface - private interface OnlySendClientStream extends ClientStream { - @Override - default void closeSendWithError(Throwable t) {} - - @Override - default void closeSend() {} - - @Override - default boolean isSendReady() { - return true; - } - } } diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiUploadTestUtils.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiUploadTestUtils.java index 827f1320d3..110fdd4510 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiUploadTestUtils.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/BidiUploadTestUtils.java @@ -21,12 +21,19 @@ import com.google.api.gax.grpc.GrpcStatusCode; import com.google.api.gax.rpc.AbortedException; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientStream; +import com.google.api.gax.rpc.ClientStreamReadyObserver; import com.google.api.gax.rpc.ErrorDetails; +import com.google.api.gax.rpc.ResponseObserver; +import com.google.api.gax.rpc.StreamController; import com.google.cloud.storage.ChunkSegmenter.ChunkSegment; import com.google.cloud.storage.it.ChecksummedTestContent; import com.google.common.collect.ImmutableList; import com.google.protobuf.Any; import com.google.protobuf.ByteString; +import com.google.protobuf.Message; import com.google.protobuf.Timestamp; import com.google.rpc.Code; import com.google.storage.v2.BidiWriteObjectRedirectedError; @@ -39,6 +46,7 @@ import java.nio.ByteBuffer; import java.time.OffsetDateTime; import java.util.List; +import java.util.function.Function; import org.checkerframework.checker.nullness.qual.NonNull; final class BidiUploadTestUtils { @@ -122,4 +130,71 @@ static BidiWriteObjectRequest withFlushAndStateLookup(BidiWriteObjectRequest ori static Timestamp timestampNow() { return Conversions.grpc().timestampCodec.encode(OffsetDateTime.now()); } + + static BidiStreamingCallable + alwaysErrorBidiStreamingCallable(Status status) { + return adaptOnlySend(respond -> request -> respond.onError(status.asRuntimeException())); + } + + static BidiStreamingCallable adaptOnlySend( + Function, OnlySendClientStream> func) { + return adapt(func::apply); + } + + static BidiStreamingCallable adapt( + Function, ClientStream> func) { + return adapt( + (respond, onReady, context) -> { + ClientStream clientStream = func.apply(respond); + StreamController controller = TestUtils.nullStreamController(); + respond.onStart(controller); + return clientStream; + }); + } + + /** + * BidiStreamingCallable isn't functional even though it's a single abstract method. + * + *

Define a method that can adapt a TriFunc as the required implementation of {@link + * BidiStreamingCallable#internalCall(ResponseObserver, ClientStreamReadyObserver, + * ApiCallContext)}. + * + *

Saves several lines of boilerplate in each test. + */ + static BidiStreamingCallable adapt( + TriFunc< + ResponseObserver, + ClientStreamReadyObserver, + ApiCallContext, + ClientStream> + func) { + return new BidiStreamingCallable() { + @Override + public ClientStream internalCall( + ResponseObserver respond, + ClientStreamReadyObserver onReady, + ApiCallContext context) { + return func.apply(respond, onReady, context); + } + }; + } + + @FunctionalInterface + interface TriFunc { + R apply(A a, B b, C c); + } + + @FunctionalInterface + interface OnlySendClientStream extends ClientStream { + @Override + default void closeSendWithError(Throwable t) {} + + @Override + default void closeSend() {} + + @Override + default boolean isSendReady() { + return true; + } + } } diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/BlobInfoTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/BlobInfoTest.java index 862709a5ae..6ecb483918 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/BlobInfoTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/BlobInfoTest.java @@ -19,6 +19,8 @@ import static com.google.cloud.storage.Acl.Project.ProjectRole.VIEWERS; import static com.google.cloud.storage.Acl.Role.READER; import static com.google.cloud.storage.Acl.Role.WRITER; +import static com.google.cloud.storage.TestUtils.hashMapOf; +import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; @@ -30,12 +32,16 @@ import com.google.cloud.storage.BlobInfo.CustomerEncryption; import com.google.cloud.storage.BlobInfo.ObjectContexts; import com.google.cloud.storage.BlobInfo.ObjectCustomContextPayload; +import com.google.cloud.storage.UnifiedOpts.NamedField; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import java.math.BigInteger; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import org.junit.Test; public class BlobInfoTest { @@ -352,4 +358,49 @@ public void testToPbAndFromPb() { public void testBlobId() { assertEquals(BlobId.of("b", "n", GENERATION), BLOB_INFO.getBlobId()); } + + @Test + public void deepFieldDiffDetectionWorksCorrectly_mutateRetrievedObject() { + BlobInfo info = + BlobInfo.newBuilder("bucket", "object") + .setContexts( + ObjectContexts.newBuilder() + .setCustom( + hashMapOf( + "c1", ObjectCustomContextPayload.newBuilder().setValue("C1").build(), + "c2", ObjectCustomContextPayload.newBuilder().setValue("C2").build())) + .build()) + .setMetadata( + hashMapOf( + "m1", "M1", + "m2", "M2")) + .build(); + + BlobInfo modified = + info.toBuilder() + .setMetadata(hashMapOf("m2", null)) + .setContexts(ObjectContexts.newBuilder().setCustom(hashMapOf("k2", null)).build()) + .build(); + Set modifiedFields = + modified.getModifiedFields().stream() + .map(NamedField::getGrpcName) + .collect(Collectors.toSet()); + + assertThat(modifiedFields).isEqualTo(ImmutableSet.of("contexts.custom.k2", "metadata.m2")); + } + + @Test + public void deepFieldDiffDetectionWorksCorrectly_declaredDiff() { + BlobInfo modified = + BlobInfo.newBuilder("bucket", "object") + .setMetadata(hashMapOf("m2", null)) + .setContexts(ObjectContexts.newBuilder().setCustom(hashMapOf("k2", null)).build()) + .build(); + Set modifiedFields = + modified.getModifiedFields().stream() + .map(UnifiedOpts.NamedField::getGrpcName) + .collect(Collectors.toSet()); + + assertThat(modifiedFields).isEqualTo(ImmutableSet.of("contexts.custom.k2", "metadata.m2")); + } } diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/ITAppendableUploadTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITAppendableUploadTest.java index 2e2b7da788..9e3ae209fb 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/ITAppendableUploadTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/ITAppendableUploadTest.java @@ -15,7 +15,6 @@ */ package com.google.cloud.storage; -import static com.google.cloud.storage.ByteSizeConstants._1MiB; import static com.google.cloud.storage.TestUtils.assertAll; import static com.google.cloud.storage.TestUtils.xxd; import static com.google.common.truth.Truth.assertThat; @@ -44,6 +43,7 @@ import com.google.cloud.storage.it.runner.registry.Generator; import com.google.common.base.MoreObjects; import com.google.common.collect.ImmutableList; +import com.google.common.io.ByteStreams; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.SeekableByteChannel; @@ -222,7 +222,7 @@ public void testUploadFileUsingAppendable() throws Exception { storage.blobAppendableUpload(BlobInfo.newBuilder(bid).build(), p.uploadConfig); try (SeekableByteChannel r = tmpFile.reader(); AppendableUploadWriteableByteChannel w = appendable.open()) { - long copied = Buffers.copyUsingBuffer(Buffers.allocate(8 * _1MiB), r, w); + long copied = ByteStreams.copy(r, w); assertThat(copied).isEqualTo(fileSize); } BlobInfo bi = appendable.getResult().get(5, TimeUnit.SECONDS); diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/TestUtils.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/TestUtils.java index f493570acc..5231b8fe00 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/TestUtils.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/TestUtils.java @@ -279,20 +279,19 @@ public static void assertAll(ThrowingRunnable... trs) throws Exception { } /** ImmutableMap does not allow null values, this method does */ - public static Map<@NonNull String, @Nullable String> hashMapOf( - @NonNull String k1, @Nullable String v1) { + public static Map<@NonNull K, @Nullable V> hashMapOf(@NonNull K k1, @Nullable V v1) { requireNonNull(k1, "k1 must be non null"); - HashMap map = new HashMap<>(); + HashMap map = new HashMap<>(); map.put(k1, v1); return Collections.unmodifiableMap(map); } /** ImmutableMap does not allow null values, this method does */ - public static Map<@NonNull String, @Nullable String> hashMapOf( - @NonNull String k1, @Nullable String v1, @NonNull String k2, @Nullable String v2) { + public static Map<@NonNull K, @Nullable V> hashMapOf( + @NonNull K k1, @Nullable V v1, @NonNull K k2, @Nullable V v2) { requireNonNull(k1, "k1 must be non null"); requireNonNull(k2, "k2 must be non null"); - HashMap map = new HashMap<>(); + HashMap map = new HashMap<>(); map.put(k1, v1); map.put(k2, v2); return Collections.unmodifiableMap(map); diff --git a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITNestedUpdateMaskTest.java b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITNestedUpdateMaskTest.java index e8e3a25728..e84ccf5a5e 100644 --- a/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITNestedUpdateMaskTest.java +++ b/google-cloud-storage/src/test/java/com/google/cloud/storage/it/ITNestedUpdateMaskTest.java @@ -78,6 +78,7 @@ public static final class NestedUpdateMaskParametersProvider implements Paramete private static final Map k1a_k2null = hashMapOf("k1", "a", "k2", null); private static final Map k1null = hashMapOf("k1", null); private static final Map k2null = hashMapOf("k2", null); + private static final Map k1null_k2null = hashMapOf("k1", null, "k2", null); /** * @@ -95,7 +96,7 @@ public static final class NestedUpdateMaskParametersProvider implements Paramete * | {"k1":"a","k2":"b"} | {"k2":null} | {"k1":"a"} | * | {"k1":"a"} | {} | null | * | {"k1":"a"} | {"k1":null} | null | - * | {"k1":"a","k2":"b"} | null | null | + * | {"k1":"a","k2":"b"} | {"k1:null,"k2":null} | null | * */ @Override @@ -111,7 +112,7 @@ public ImmutableList parameters() { new Param("2 keys, modify 1 null (fine)", k1a_k2b, k2null, k1a), new Param("1 key, set empty", k1a, empty, null), new Param("1 key, null key", k1a, k1null, null), - new Param("2 keys, set null", k1a_k2b, null, null)); + new Param("2 keys, set null", k1a_k2b, k1null_k2null, null)); } } diff --git a/grpc-google-cloud-storage-control-v2/pom.xml b/grpc-google-cloud-storage-control-v2/pom.xml index 2e3db3d7af..c594fe4bd8 100644 --- a/grpc-google-cloud-storage-control-v2/pom.xml +++ b/grpc-google-cloud-storage-control-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-storage-control-v2 - 2.57.0 + 2.58.0 grpc-google-cloud-storage-control-v2 GRPC library for google-cloud-storage com.google.cloud google-cloud-storage-parent - 2.57.0 + 2.58.0 @@ -41,6 +41,10 @@ com.google.guava guava + + com.google.api.grpc + proto-google-iam-v1 + diff --git a/grpc-google-cloud-storage-control-v2/src/main/java/com/google/storage/control/v2/StorageControlGrpc.java b/grpc-google-cloud-storage-control-v2/src/main/java/com/google/storage/control/v2/StorageControlGrpc.java index 9903e7e136..a96d0106b1 100644 --- a/grpc-google-cloud-storage-control-v2/src/main/java/com/google/storage/control/v2/StorageControlGrpc.java +++ b/grpc-google-cloud-storage-control-v2/src/main/java/com/google/storage/control/v2/StorageControlGrpc.java @@ -1138,6 +1138,128 @@ private StorageControlGrpc() {} return getUpdateOrganizationIntelligenceConfigMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> + getGetIamPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetIamPolicy", + requestType = com.google.iam.v1.GetIamPolicyRequest.class, + responseType = com.google.iam.v1.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> + getGetIamPolicyMethod() { + io.grpc.MethodDescriptor + getGetIamPolicyMethod; + if ((getGetIamPolicyMethod = StorageControlGrpc.getGetIamPolicyMethod) == null) { + synchronized (StorageControlGrpc.class) { + if ((getGetIamPolicyMethod = StorageControlGrpc.getGetIamPolicyMethod) == null) { + StorageControlGrpc.getGetIamPolicyMethod = + getGetIamPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetIamPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.Policy.getDefaultInstance())) + .setSchemaDescriptor( + new StorageControlMethodDescriptorSupplier("GetIamPolicy")) + .build(); + } + } + } + return getGetIamPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> + getSetIamPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SetIamPolicy", + requestType = com.google.iam.v1.SetIamPolicyRequest.class, + responseType = com.google.iam.v1.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> + getSetIamPolicyMethod() { + io.grpc.MethodDescriptor + getSetIamPolicyMethod; + if ((getSetIamPolicyMethod = StorageControlGrpc.getSetIamPolicyMethod) == null) { + synchronized (StorageControlGrpc.class) { + if ((getSetIamPolicyMethod = StorageControlGrpc.getSetIamPolicyMethod) == null) { + StorageControlGrpc.getSetIamPolicyMethod = + getSetIamPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetIamPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.Policy.getDefaultInstance())) + .setSchemaDescriptor( + new StorageControlMethodDescriptorSupplier("SetIamPolicy")) + .build(); + } + } + } + return getSetIamPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "TestIamPermissions", + requestType = com.google.iam.v1.TestIamPermissionsRequest.class, + responseType = com.google.iam.v1.TestIamPermissionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, + com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod; + if ((getTestIamPermissionsMethod = StorageControlGrpc.getTestIamPermissionsMethod) == null) { + synchronized (StorageControlGrpc.class) { + if ((getTestIamPermissionsMethod = StorageControlGrpc.getTestIamPermissionsMethod) + == null) { + StorageControlGrpc.getTestIamPermissionsMethod = + getTestIamPermissionsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "TestIamPermissions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.TestIamPermissionsResponse.getDefaultInstance())) + .setSchemaDescriptor( + new StorageControlMethodDescriptorSupplier("TestIamPermissions")) + .build(); + } + } + } + return getTestIamPermissionsMethod; + } + /** Creates a new async stub that supports all call types for the service */ public static StorageControlStub newStub(io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory factory = @@ -1541,6 +1663,63 @@ default void updateOrganizationIntelligenceConfig( io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( getUpdateOrganizationIntelligenceConfigMethod(), responseObserver); } + + /** + * + * + *

+     * Gets the IAM policy for a specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + default void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetIamPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates an IAM policy for the specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + default void setIamPolicy( + com.google.iam.v1.SetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getSetIamPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Tests a set of permissions on the given bucket, object, or managed folder
+     * to see which, if any, are held by the caller.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket,
+     * `projects/_/buckets/{bucket}/objects/{object}` for an object, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + default void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getTestIamPermissionsMethod(), responseObserver); + } } /** @@ -1962,6 +2141,69 @@ public void updateOrganizationIntelligenceConfig( request, responseObserver); } + + /** + * + * + *
+     * Gets the IAM policy for a specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates an IAM policy for the specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public void setIamPolicy( + com.google.iam.v1.SetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Tests a set of permissions on the given bucket, object, or managed folder
+     * to see which, if any, are held by the caller.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket,
+     * `projects/_/buckets/{bucket}/objects/{object}` for an object, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), + request, + responseObserver); + } } /** @@ -2292,6 +2534,57 @@ public com.google.storage.control.v2.IntelligenceConfig updateOrganizationIntell return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getUpdateOrganizationIntelligenceConfigMethod(), getCallOptions(), request); } + + /** + * + * + *
+     * Gets the IAM policy for a specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates an IAM policy for the specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Tests a set of permissions on the given bucket, object, or managed folder
+     * to see which, if any, are held by the caller.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket,
+     * `projects/_/buckets/{bucket}/objects/{object}` for an object, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getTestIamPermissionsMethod(), getCallOptions(), request); + } } /** @@ -2622,6 +2915,57 @@ public com.google.storage.control.v2.IntelligenceConfig updateOrganizationIntell return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getUpdateOrganizationIntelligenceConfigMethod(), getCallOptions(), request); } + + /** + * + * + *
+     * Gets the IAM policy for a specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates an IAM policy for the specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Tests a set of permissions on the given bucket, object, or managed folder
+     * to see which, if any, are held by the caller.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket,
+     * `projects/_/buckets/{bucket}/objects/{object}` for an object, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getTestIamPermissionsMethod(), getCallOptions(), request); + } } /** @@ -2978,6 +3322,60 @@ protected StorageControlFutureStub build( getChannel().newCall(getUpdateOrganizationIntelligenceConfigMethod(), getCallOptions()), request); } + + /** + * + * + *
+     * Gets the IAM policy for a specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates an IAM policy for the specified bucket.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Tests a set of permissions on the given bucket, object, or managed folder
+     * to see which, if any, are held by the caller.
+     * The `resource` field in the request should be
+     * `projects/_/buckets/{bucket}` for a bucket,
+     * `projects/_/buckets/{bucket}/objects/{object}` for an object, or
+     * `projects/_/buckets/{bucket}/managedFolders/{managedFolder}`
+     * for a managed folder.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.iam.v1.TestIamPermissionsResponse> + testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), request); + } } private static final int METHODID_CREATE_FOLDER = 0; @@ -3003,6 +3401,9 @@ protected StorageControlFutureStub build( private static final int METHODID_UPDATE_FOLDER_INTELLIGENCE_CONFIG = 20; private static final int METHODID_GET_ORGANIZATION_INTELLIGENCE_CONFIG = 21; private static final int METHODID_UPDATE_ORGANIZATION_INTELLIGENCE_CONFIG = 22; + private static final int METHODID_GET_IAM_POLICY = 23; + private static final int METHODID_SET_IAM_POLICY = 24; + private static final int METHODID_TEST_IAM_PERMISSIONS = 25; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -3154,6 +3555,22 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_GET_IAM_POLICY: + serviceImpl.getIamPolicy( + (com.google.iam.v1.GetIamPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SET_IAM_POLICY: + serviceImpl.setIamPolicy( + (com.google.iam.v1.SetIamPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_TEST_IAM_PERMISSIONS: + serviceImpl.testIamPermissions( + (com.google.iam.v1.TestIamPermissionsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; default: throw new AssertionError(); } @@ -3326,6 +3743,23 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser com.google.storage.control.v2.UpdateOrganizationIntelligenceConfigRequest, com.google.storage.control.v2.IntelligenceConfig>( service, METHODID_UPDATE_ORGANIZATION_INTELLIGENCE_CONFIG))) + .addMethod( + getGetIamPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + service, METHODID_GET_IAM_POLICY))) + .addMethod( + getSetIamPolicyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers( + service, METHODID_SET_IAM_POLICY))) + .addMethod( + getTestIamPermissionsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.TestIamPermissionsRequest, + com.google.iam.v1.TestIamPermissionsResponse>( + service, METHODID_TEST_IAM_PERMISSIONS))) .build(); } @@ -3400,6 +3834,9 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getUpdateFolderIntelligenceConfigMethod()) .addMethod(getGetOrganizationIntelligenceConfigMethod()) .addMethod(getUpdateOrganizationIntelligenceConfigMethod()) + .addMethod(getGetIamPolicyMethod()) + .addMethod(getSetIamPolicyMethod()) + .addMethod(getTestIamPermissionsMethod()) .build(); } } diff --git a/grpc-google-cloud-storage-v2/pom.xml b/grpc-google-cloud-storage-v2/pom.xml index cdcb8e6b11..b1729bff6a 100644 --- a/grpc-google-cloud-storage-v2/pom.xml +++ b/grpc-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc grpc-google-cloud-storage-v2 - 2.57.0 + 2.58.0 grpc-google-cloud-storage-v2 GRPC library for grpc-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.57.0 + 2.58.0 diff --git a/pom.xml b/pom.xml index 5f901d6d55..b14e256786 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.google.cloud google-cloud-storage-parent pom - 2.57.0 + 2.58.0 Storage Parent https://github.com/googleapis/java-storage @@ -14,7 +14,7 @@ com.google.cloud sdk-platform-java-config - 3.52.1 + 3.52.2 @@ -82,7 +82,7 @@ com.google.cloud google-cloud-storage - 2.57.0 + 2.58.0 com.google.apis @@ -92,7 +92,7 @@ com.google.cloud google-cloud-pubsub - 1.141.3 + 1.141.4 test @@ -104,32 +104,32 @@ com.google.api.grpc proto-google-cloud-storage-v2 - 2.57.0 + 2.58.0 com.google.api.grpc grpc-google-cloud-storage-v2 - 2.57.0 + 2.58.0 com.google.api.grpc gapic-google-cloud-storage-v2 - 2.57.0 + 2.58.0 com.google.api.grpc grpc-google-cloud-storage-control-v2 - 2.57.0 + 2.58.0 com.google.api.grpc proto-google-cloud-storage-control-v2 - 2.57.0 + 2.58.0 com.google.cloud google-cloud-storage-control - 2.57.0 + 2.58.0 com.google.cloud @@ -172,7 +172,7 @@ com.google.truth truth - 1.4.4 + 1.4.5 test diff --git a/proto-google-cloud-storage-control-v2/pom.xml b/proto-google-cloud-storage-control-v2/pom.xml index 21d6bbecce..d75d4c367c 100644 --- a/proto-google-cloud-storage-control-v2/pom.xml +++ b/proto-google-cloud-storage-control-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-storage-control-v2 - 2.57.0 + 2.58.0 proto-google-cloud-storage-control-v2 Proto library for proto-google-cloud-storage-control-v2 com.google.cloud google-cloud-storage-parent - 2.57.0 + 2.58.0 @@ -21,6 +21,10 @@ com.google.api.grpc proto-google-common-protos + + com.google.api.grpc + proto-google-iam-v1 + com.google.api api-common diff --git a/proto-google-cloud-storage-control-v2/src/main/java/com/google/storage/control/v2/StorageControlProto.java b/proto-google-cloud-storage-control-v2/src/main/java/com/google/storage/control/v2/StorageControlProto.java index e97e366047..483b2e529a 100644 --- a/proto-google-cloud-storage-control-v2/src/main/java/com/google/storage/control/v2/StorageControlProto.java +++ b/proto-google-cloud-storage-control-v2/src/main/java/com/google/storage/control/v2/StorageControlProto.java @@ -216,8 +216,10 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "lient.proto\032\037google/api/field_behavior.p" + "roto\032\033google/api/field_info.proto\032\031googl" + "e/api/resource.proto\032\030google/api/routing" - + ".proto\032#google/longrunning/operations.pr" - + "oto\032\036google/protobuf/duration.proto\032\033google/protobuf/empty.proto\032" + + ".proto\032\036google/iam/v1/iam_policy.proto\032\032" + + "google/iam/v1/policy.proto\032#google/longr" + + "unning/operations.proto\032\036google/protobuf" + + "/duration.proto\032\033google/protobuf/empty.proto\032" + " google/protobuf/field_mask.proto\032\037google/protobuf/timestamp.proto\"+\n" + "\021PendingRenameInfo\022\026\n" + "\toperation\030\001 \001(\tB\003\340A\003\"\342\002\n" @@ -226,10 +228,10 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\016metageneration\030\003 \001(\003B\003\340A\003\0224\n" + "\013create_time\030\004 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\0224\n" + "\013update_time\030\005 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022N\n" - + "\023pending_rename_info\030\007" - + " \001(\0132,.google.storage.control.v2.PendingRenameInfoB\003\340A\003:l\352Ai\n" - + "\035storage.googleapis.com/Folder\0227projects/{project}/" - + "buckets/{bucket}/folders/{folder=**}*\007folders2\006folder\"\364\001\n" + + "\023pending_rename_info\030\007 \001(\0132,.googl" + + "e.storage.control.v2.PendingRenameInfoB\003\340A\003:l\352Ai\n" + + "\035storage.googleapis.com/Folder\022" + + "7projects/{project}/buckets/{bucket}/folders/{folder=**}*\007folders2\006folder\"\364\001\n" + "\020GetFolderRequest\0223\n" + "\004name\030\006 \001(\tB%\340A\002\372A\037\n" + "\035storage.googleapis.com/Folder\022$\n" @@ -239,8 +241,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\030_if_metageneration_matchB\036\n" + "\034_if_metageneration_not_match\"\325\001\n" + "\023CreateFolderRequest\0225\n" - + "\006parent\030\001 \001(" - + "\tB%\340A\002\372A\037\022\035storage.googleapis.com/Folder\0226\n" + + "\006parent\030\001 \001(\t" + + "B%\340A\002\372A\037\022\035storage.googleapis.com/Folder\0226\n" + "\006folder\030\002" + " \001(\0132!.google.storage.control.v2.FolderB\003\340A\002\022\026\n" + "\tfolder_id\030\003 \001(\tB\003\340A\002\022\026\n" @@ -285,24 +287,24 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\026requested_cancellation\030\005 \001(\010B\003\340A\003\022\035\n" + "\020progress_percent\030\006 \001(\005B\003\340A\003\"\247\001\n" + "\024RenameFolderMetadata\022V\n" - + "\017common_metadata\030\001 \001(\0132=" - + ".google.storage.control.v2.CommonLongRunningOperationMetadata\022\030\n" + + "\017common_metadata\030\001 \001(\0132=.google.storage.cont" + + "rol.v2.CommonLongRunningOperationMetadata\022\030\n" + "\020source_folder_id\030\002 \001(\t\022\035\n" + "\025destination_folder_id\030\003 \001(\t\"\370\003\n\r" + "StorageLayout\022\021\n" + "\004name\030\001 \001(\tB\003\340A\003\022\025\n" + "\010location\030\002 \001(\tB\003\340A\003\022\032\n\r" + "location_type\030\003 \001(\tB\003\340A\003\022d\n" - + "\027custom_placement_config\030\004 \001(\0132" - + ">.google.storage.control.v2.StorageLayout.CustomPlacementConfigB\003\340A\003\022c\n" - + "\026hierarchical_namespace\030\005 \001(\0132>.google.storage.co" - + "ntrol.v2.StorageLayout.HierarchicalNamespaceB\003\340A\003\032/\n" + + "\027custom_placement_config\030\004 \001(\0132>.google.storage.con" + + "trol.v2.StorageLayout.CustomPlacementConfigB\003\340A\003\022c\n" + + "\026hierarchical_namespace\030\005 \001(\013" + + "2>.google.storage.control.v2.StorageLayout.HierarchicalNamespaceB\003\340A\003\032/\n" + "\025CustomPlacementConfig\022\026\n" + "\016data_locations\030\001 \003(\t\032(\n" + "\025HierarchicalNamespace\022\017\n" + "\007enabled\030\001 \001(\010:{\352Ax\n" - + "$storage.googleapis.com/StorageLayout\0221projects/{proje" - + "ct}/buckets/{bucket}/storageLayout*\016storageLayouts2\r" + + "$storage.googleapis.com/StorageLay" + + "out\0221projects/{project}/buckets/{bucket}/storageLayout*\016storageLayouts2\r" + "storageLayout\"\206\001\n" + "\027GetStorageLayoutRequest\022:\n" + "\004name\030\001 \001(\tB,\340A\002\372A&\n" @@ -313,10 +315,10 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\004name\030\001 \001(\tB\003\340A\010\022\033\n" + "\016metageneration\030\003 \001(\003B\003\340A\003\0224\n" + "\013create_time\030\004 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\0224\n" - + "\013update_time\030\005" - + " \001(\0132\032.google.protobuf.TimestampB\003\340A\003:\221\001\352A\215\001\n" - + "$storage.googleapis.com/ManagedFolder\022Fprojects/{project" - + "}/buckets/{bucket}/managedFolders/{managed_folder=**}*\016managedFolders2\r" + + "\013update_time\030\005 " + + "\001(\0132\032.google.protobuf.TimestampB\003\340A\003:\221\001\352A\215\001\n" + + "$storage.googleapis.com/ManagedFolder\022Fprojects/{project}/buckets/{bucket}/m" + + "anagedFolders/{managed_folder=**}*\016managedFolders2\r" + "managedFolder\"\202\002\n" + "\027GetManagedFolderRequest\022:\n" + "\004name\030\006 \001(\tB,\340A\002\372A&\n" @@ -327,10 +329,10 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\030_if_metageneration_matchB\036\n" + "\034_if_metageneration_not_match\"\342\001\n" + "\032CreateManagedFolderRequest\022<\n" - + "\006parent\030\001 \001(\tB,\340A\002\372A&" - + "\022$storage.googleapis.com/ManagedFolder\022E\n" - + "\016managed_folder\030\002" - + " \001(\0132(.google.storage.control.v2.ManagedFolderB\003\340A\002\022\036\n" + + "\006parent\030\001 \001(" + + "\tB,\340A\002\372A&\022$storage.googleapis.com/ManagedFolder\022E\n" + + "\016managed_folder\030\002 \001" + + "(\0132(.google.storage.control.v2.ManagedFolderB\003\340A\002\022\036\n" + "\021managed_folder_id\030\003 \001(\tB\003\340A\002\022\037\n\n" + "request_id\030\004 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"\236\002\n" + "\032DeleteManagedFolderRequest\022:\n" @@ -354,8 +356,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + " \003(\0132(.google.storage.control.v2.ManagedFolder\022\027\n" + "\017next_page_token\030\002 \001(\t\"\260\002\n" + "\033CreateAnywhereCacheMetadata\022V\n" - + "\017common_metadata\030\001 \001(\0132=." - + "google.storage.control.v2.CommonLongRunningOperationMetadata\022\036\n" + + "\017common_metadata\030\001 \001(\0132=.google.storage.contr" + + "ol.v2.CommonLongRunningOperationMetadata\022\036\n" + "\021anywhere_cache_id\030\002 \001(\tH\000\210\001\001\022\021\n" + "\004zone\030\006 \001(\tH\001\210\001\001\022+\n" + "\003ttl\030\003 \001(\0132\031.google.protobuf.DurationH\002\210\001\001\022\035\n" @@ -365,8 +367,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\004_ttlB\023\n" + "\021_admission_policy\"\260\002\n" + "\033UpdateAnywhereCacheMetadata\022V\n" - + "\017common_metadata\030\001 \001(\0132=.google.storag" - + "e.control.v2.CommonLongRunningOperationMetadata\022\036\n" + + "\017common_metadata\030\001" + + " \001(\0132=.google.storage.control.v2.CommonLongRunningOperationMetadata\022\036\n" + "\021anywhere_cache_id\030\002 \001(\tH\000\210\001\001\022\021\n" + "\004zone\030\005 \001(\tH\001\210\001\001\022+\n" + "\003ttl\030\003 \001(\0132\031.google.protobuf.DurationH\002\210\001\001\022\035\n" @@ -386,14 +388,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\013update_time\030\007" + " \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022\033\n" + "\016pending_update\030\010 \001(\010B\003\340A\003:\216\001\352A\212\001\n" - + "$storage.googleapis.com/AnywhereCache\022Cprojects/{project}/buckets/{bucket}/anyw" - + "hereCaches/{anywhere_cache}*\016anywhereCaches2\r" + + "$storage.googleapis.com/AnywhereCache\022Cprojects/{project}/b" + + "uckets/{bucket}/anywhereCaches/{anywhere_cache}*\016anywhereCaches2\r" + "anywhereCache\"\302\001\n" + "\032CreateAnywhereCacheRequest\022<\n" + "\006parent\030\001 \001(" + "\tB,\340A\002\372A&\022$storage.googleapis.com/AnywhereCache\022E\n" - + "\016anywhere_cache\030\003" - + " \001(\0132(.google.storage.control.v2.AnywhereCacheB\003\340A\002\022\037\n\n" + + "\016anywhere_cache\030\003 \001(\0132(.go" + + "ogle.storage.control.v2.AnywhereCacheB\003\340A\002\022\037\n\n" + "request_id\030\004 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"\272\001\n" + "\032UpdateAnywhereCacheRequest\022E\n" + "\016anywhere_cache\030\001" @@ -407,7 +409,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "request_id\030\002 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"x\n" + "\031PauseAnywhereCacheRequest\022:\n" + "\004name\030\001 \001(\tB,\340A\002\372A&\n" - + "$storage.googleapis.com/AnywhereCache\022\037\n\n" + + "$storage.googleapis.com/AnywhereCache\022\037\n" + + "\n" + "request_id\030\002 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"y\n" + "\032ResumeAnywhereCacheRequest\022:\n" + "\004name\030\001 \001(\tB,\340A\002\372A&\n" @@ -418,8 +421,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "$storage.googleapis.com/AnywhereCache\022\037\n\n" + "request_id\030\002 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"\241\001\n" + "\031ListAnywhereCachesRequest\022<\n" - + "\006parent\030\001 \001(" - + "\tB,\340A\002\372A&\022$storage.googleapis.com/AnywhereCache\022\021\n" + + "\006parent\030\001 \001(\tB" + + ",\340A\002\372A&\022$storage.googleapis.com/AnywhereCache\022\021\n" + "\tpage_size\030\002 \001(\005\022\022\n\n" + "page_token\030\003 \001(\t\022\037\n\n" + "request_id\030\004 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"x\n" @@ -429,25 +432,24 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\017next_page_token\030\002 \001(\t\"\216\016\n" + "\022IntelligenceConfig\022\021\n" + "\004name\030\001 \001(\tB\003\340A\010\022X\n" - + "\016edition_config\030\002" - + " \001(\0162;.google.storage.control.v2.IntelligenceConfig.EditionConfigB\003\340A\001\0224\n" + + "\016edition_config\030\002 \001(\0162;.google.stora" + + "ge.control.v2.IntelligenceConfig.EditionConfigB\003\340A\001\0224\n" + "\013update_time\030\003 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\022I\n" - + "\006filter\030\004 \001(\01324.google.storage.c" - + "ontrol.v2.IntelligenceConfig.FilterB\003\340A\001\022u\n" - + "\035effective_intelligence_config\030\005 \001(\0132" - + "I.google.storage.control.v2.Intelligence" - + "Config.EffectiveIntelligenceConfigB\003\340A\003\022O\n" - + "\014trial_config\030\007 \001(\01329.google.storage.c" - + "ontrol.v2.IntelligenceConfig.TrialConfig\032\374\004\n" + + "\006filter\030\004 \001(" + + "\01324.google.storage.control.v2.IntelligenceConfig.FilterB\003\340A\001\022u\n" + + "\035effective_intelligence_config\030\005 \001(\0132I.google.storage.con" + + "trol.v2.IntelligenceConfig.EffectiveIntelligenceConfigB\003\340A\003\022O\n" + + "\014trial_config\030\007 \001(" + + "\01329.google.storage.control.v2.IntelligenceConfig.TrialConfig\032\374\004\n" + "\006Filter\022v\n" - + " included_cloud_storage_locations\030\001 \001(\0132J.google.storage.control.v" - + "2.IntelligenceConfig.Filter.CloudStorageLocationsH\000\022v\n" - + " excluded_cloud_storage_locations\030\002 \001(\0132J.google.storage.control.v" - + "2.IntelligenceConfig.Filter.CloudStorageLocationsH\000\022r\n" - + "\036included_cloud_storage_buckets\030\003 \001(\0132H.google.storage.control.v2." - + "IntelligenceConfig.Filter.CloudStorageBucketsH\001\022r\n" - + "\036excluded_cloud_storage_buckets\030\004 \001(\0132H.google.storage.control.v2.Inte" - + "lligenceConfig.Filter.CloudStorageBucketsH\001\032/\n" + + " included_cloud_storage_locations\030\001 \001(\0132J.goog" + + "le.storage.control.v2.IntelligenceConfig.Filter.CloudStorageLocationsH\000\022v\n" + + " excluded_cloud_storage_locations\030\002 \001(\0132J.goog" + + "le.storage.control.v2.IntelligenceConfig.Filter.CloudStorageLocationsH\000\022r\n" + + "\036included_cloud_storage_buckets\030\003 \001(\0132H.google" + + ".storage.control.v2.IntelligenceConfig.Filter.CloudStorageBucketsH\001\022r\n" + + "\036excluded_cloud_storage_buckets\030\004 \001(\0132H.google.sto" + + "rage.control.v2.IntelligenceConfig.Filter.CloudStorageBucketsH\001\032/\n" + "\025CloudStorageLocations\022\026\n" + "\tlocations\030\001 \003(\tB\003\340A\001\0325\n" + "\023CloudStorageBuckets\022\036\n" @@ -455,26 +457,26 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\027cloud_storage_locationsB\027\n" + "\025cloud_storage_buckets\032\212\002\n" + "\033EffectiveIntelligenceConfig\022z\n" - + "\021effective_edition\030\001 \001(\0162Z.google.storage.cont" - + "rol.v2.IntelligenceConfig.EffectiveIntelligenceConfig.EffectiveEditionB\003\340A\003\022" - + " \n" + + "\021effective_edition\030\001 \001(\0162Z.google.storage.control.v2.IntelligenceC" + + "onfig.EffectiveIntelligenceConfig.EffectiveEditionB\003\340A\003\022 \n" + "\023intelligence_config\030\002 \001(\tB\003\340A\003\"M\n" + "\020EffectiveEdition\022!\n" + "\035EFFECTIVE_EDITION_UNSPECIFIED\020\000\022\010\n" + "\004NONE\020\001\022\014\n" + "\010STANDARD\020\002\032C\n" + "\013TrialConfig\0224\n" - + "\013expire_time\030\003 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\"c\n\r" + + "\013expire_time\030\003 \001(\0132\032.google.protobuf.TimestampB\003\340A\003\"c\n" + + "\r" + "EditionConfig\022\036\n" + "\032EDITION_CONFIG_UNSPECIFIED\020\000\022\013\n" + "\007INHERIT\020\001\022\014\n" + "\010DISABLED\020\002\022\014\n" + "\010STANDARD\020\003\022\t\n" + "\005TRIAL\020\005:\213\002\352A\207\002\n" - + ")storage.googleapis.com/IntelligenceConfig\0228folders/{folder}/locations/{lo" - + "cation}/intelligenceConfig\022;organizations/{org}/locations/{location}/intelligenc" - + "eConfig\022:projects/{project}/locations/{l" - + "ocation}/intelligenceConfig*\023intelligenceConfigs2\022intelligenceConfig\"\325\001\n" + + ")storage.googleapis.com/IntelligenceConfig\0228folders/{f" + + "older}/locations/{location}/intelligenceConfig\022;organizations/{org}/locations/{l" + + "ocation}/intelligenceConfig\022:projects/{project}/locations/{location}/intelligenc" + + "eConfig*\023intelligenceConfigs2\022intelligenceConfig\"\325\001\n" + "+UpdateOrganizationIntelligenceConfigRequest\022O\n" + "\023intelligence_config\030\001" + " \001(\0132-.google.storage.control.v2.IntelligenceConfigB\003\340A\002\0224\n" @@ -482,14 +484,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + " \001(\0132\032.google.protobuf.FieldMaskB\003\340A\002\022\037\n\n" + "request_id\030\003 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"\317\001\n" + "%UpdateFolderIntelligenceConfigRequest\022O\n" - + "\023intelligence_config\030\001 \001(\0132-.go" - + "ogle.storage.control.v2.IntelligenceConfigB\003\340A\002\0224\n" + + "\023intelligence_config\030\001" + + " \001(\0132-.google.storage.control.v2.IntelligenceConfigB\003\340A\002\0224\n" + "\013update_mask\030\002" + " \001(\0132\032.google.protobuf.FieldMaskB\003\340A\002\022\037\n\n" + "request_id\030\003 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"\320\001\n" + "&UpdateProjectIntelligenceConfigRequest\022O\n" - + "\023intelligence_config\030\001" - + " \001(\0132-.google.storage.control.v2.IntelligenceConfigB\003\340A\002\0224\n" + + "\023intelligence_config\030\001 \001(\0132-.google.stor" + + "age.control.v2.IntelligenceConfigB\003\340A\002\0224\n" + "\013update_mask\030\002" + " \001(\0132\032.google.protobuf.FieldMaskB\003\340A\002\022\037\n\n" + "request_id\030\003 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"k\n" @@ -501,98 +503,113 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + ")storage.googleapis.com/IntelligenceConfig\"f\n" + "#GetProjectIntelligenceConfigRequest\022?\n" + "\004name\030\001 \001(\tB1\340A\002\372A+\n" - + ")storage.googleapis.com/IntelligenceConfig2\202&\n" + + ")storage.googleapis.com/IntelligenceConfig2\356*\n" + "\016StorageControl\022\232\001\n" - + "\014CreateFolder\022..google.storage.control.v2.CreateFolderRequest\032!.google.stora" - + "ge.control.v2.Folder\"7\332A\027parent,folder,folder_id\212\323\344\223\002\027\022\025\n" + + "\014CreateFolder\022..google.storage.control.v2.CreateFolderRe" + + "quest\032!.google.storage.control.v2.Folder\"7\332A\027parent,folder,folder_id\212\323\344\223\002\027\022\025\n" + "\006parent\022\013{bucket=**}\022\217\001\n" - + "\014DeleteFolder\022..google.storage.control." - + "v2.DeleteFolderRequest\032\026.google.protobuf.Empty\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\014DeleteFolder\022..google.storage.control.v2.DeleteFolderReque" + + "st\032\026.google.protobuf.Empty\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\224\001\n" - + "\tGetFolder\022+.google.storage.control.v2.GetFolderReque" - + "st\032!.google.storage.control.v2.Folder\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\tGetFolder\022+.google.storage.contr" + + "ol.v2.GetFolderRequest\032!.google.storage.control.v2.Folder\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\224\001\n" - + "\013ListFolders\022-.google.storage.control.v2.ListFoldersRequest\032.." - + "google.storage.control.v2.ListFoldersResponse\"&\332A\006parent\212\323\344\223\002\027\022\025\n" + + "\013ListFolders\022-.google.storage.control.v2.L" + + "istFoldersRequest\032..google.storage.contr" + + "ol.v2.ListFoldersResponse\"&\332A\006parent\212\323\344\223\002\027\022\025\n" + "\006parent\022\013{bucket=**}\022\315\001\n" - + "\014RenameFolder\022..google.storage." - + "control.v2.RenameFolderRequest\032\035.google.longrunning.Operation\"n\312A\036\n" - + "\006Folder\022\024Rena" - + "meFolderMetadata\332A\032name,destination_folder_id\212\323\344\223\002*\022(\n" + + "\014RenameFolder\022..google.storage.control.v2.RenameFol" + + "derRequest\032\035.google.longrunning.Operation\"n\312A\036\n" + + "\006Folder\022\024RenameFolderMetadata\332A\032name,destination_folder_id\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\251\001\n" - + "\020GetStorageLayout\0222.google.storage.control.v2.GetStorageLayoutR" - + "equest\032(.google.storage.control.v2.StorageLayout\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\020GetStorageLayout\0222.google.storage.control." + + "v2.GetStorageLayoutRequest\032(.google.stor" + + "age.control.v2.StorageLayout\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\277\001\n" - + "\023CreateManagedFolder\0225.google.storage.control.v2.Cr" - + "eateManagedFolderRequest\032(.google.storag" - + "e.control.v2.ManagedFolder\"G\332A\'parent,managed_folder,managed_folder_id\212\323\344\223\002\027\022\025\n" + + "\023CreateManagedFolder\0225.google.storage.control.v2.CreateManagedFolderReq" + + "uest\032(.google.storage.control.v2.Managed" + + "Folder\"G\332A\'parent,managed_folder,managed_folder_id\212\323\344\223\002\027\022\025\n" + "\006parent\022\013{bucket=**}\022\235\001\n" - + "\023DeleteManagedFolder\0225.google.storage.control.v2.DeleteMa" - + "nagedFolderRequest\032\026.google.protobuf.Empty\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\023DeleteManagedFolder\0225.google.storage" + + ".control.v2.DeleteManagedFolderRequest\032\026.google.protobuf.Empty\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\251\001\n" - + "\020GetManagedFolder\0222.google.storage.control.v2.GetManagedF" - + "olderRequest\032(.google.storage.control.v2.ManagedFolder\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\020GetManagedFolder\0222.google.storage.control.v2.GetManagedFolderRequest\032(.googl" + + "e.storage.control.v2.ManagedFolder\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\251\001\n" - + "\022ListManagedFolders\0224.google.storage.control." - + "v2.ListManagedFoldersRequest\0325.google.st" - + "orage.control.v2.ListManagedFoldersResponse\"&\332A\006parent\212\323\344\223\002\027\022\025\n" + + "\022ListManagedFolders\0224.google.storage.control.v2.ListManagedFolder" + + "sRequest\0325.google.storage.control.v2.Lis" + + "tManagedFoldersResponse\"&\332A\006parent\212\323\344\223\002\027\022\025\n" + "\006parent\022\013{bucket=**}\022\321\001\n" - + "\023CreateAnywhereCache\0225.google.sto" - + "rage.control.v2.CreateAnywhereCacheRequest\032\035.google.longrunning.Operation\"d\312A,\n\r" - + "AnywhereCache\022\033CreateAnywhereCacheMetadata\332A\025parent,anywhere_cache\212\323\344\223\002\027\022\025\n" + + "\023CreateAnywhereCache\0225.google.storage.control.v2.Crea" + + "teAnywhereCacheRequest\032\035.google.longrunning.Operation\"d\312A,\n\r" + + "AnywhereCache\022\033Creat" + + "eAnywhereCacheMetadata\332A\025parent,anywhere_cache\212\323\344\223\002\027\022\025\n" + "\006parent\022\013{bucket=**}\022\371\001\n" - + "\023UpdateAnywhereCache\0225.google.storage.control.v2.UpdateAnywhe" - + "reCacheRequest\032\035.google.longrunning.Operation\"\213\001\312A,\n\r" - + "AnywhereCache\022\033UpdateAnywhe" - + "reCacheMetadata\332A\032anywhere_cache,update_mask\212\323\344\223\0029\0227\n" + + "\023UpdateAnywhereCache\0225.google.storage.con" + + "trol.v2.UpdateAnywhereCacheRequest\032\035.google.longrunning.Operation\"\213\001\312A,\n\r" + + "Anywher" + + "eCache\022\033UpdateAnywhereCacheMetadata\332A\032anywhere_cache,update_mask\212\323\344\223\0029\0227\n" + "\023anywhere_cache.name\022 {bucket=projects/*/buckets/*}/**\022\261\001\n" - + "\024DisableAnywhereCache\0226.google.storage.control.v2" - + ".DisableAnywhereCacheRequest\032(.google.st" - + "orage.control.v2.AnywhereCache\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\024DisableAnywhereCache\0226.google.storage.control.v2.DisableAnywhereCach" + + "eRequest\032(.google.storage.control.v2.AnywhereCache\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\255\001\n" - + "\022PauseAnywhereCache\0224.google.storage.control.v2.PauseAnywhereCacheReq" - + "uest\032(.google.storage.control.v2.AnywhereCache\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\022PauseAnywhereCache\0224.google.storage.control.v2.P" + + "auseAnywhereCacheRequest\032(.google.storag" + + "e.control.v2.AnywhereCache\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\257\001\n" - + "\023ResumeAnywhereCache\0225.google.storage.control.v2.Resu" - + "meAnywhereCacheRequest\032(.google.storage." - + "control.v2.AnywhereCache\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\023ResumeAnywhereCache\0225.google.storage.control.v2.ResumeAnywhereCacheReque" + + "st\032(.google.storage.control.v2.AnywhereCache\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\251\001\n" - + "\020GetAnywhereCache\0222.google.storage.control.v2.GetAnywhereCacheRequest\032(.goo" - + "gle.storage.control.v2.AnywhereCache\"7\332A\004name\212\323\344\223\002*\022(\n" + + "\020GetAnywhereCache\0222.google.storage.control.v2.GetAnywhe" + + "reCacheRequest\032(.google.storage.control.v2.AnywhereCache\"7\332A\004name\212\323\344\223\002*\022(\n" + "\004name\022 {bucket=projects/*/buckets/*}/**\022\251\001\n" - + "\022ListAnywhereCaches\0224.google.storage.control.v2.ListAnywhereCac" - + "hesRequest\0325.google.storage.control.v2.L" - + "istAnywhereCachesResponse\"&\332A\006parent\212\323\344\223\002\027\022\025\n" + + "\022ListAnywhereCaches\0224.google.storage.contro" + + "l.v2.ListAnywhereCachesRequest\0325.google." + + "storage.control.v2.ListAnywhereCachesResponse\"&\332A\006parent\212\323\344\223\002\027\022\025\n" + "\006parent\022\013{bucket=**}\022\322\001\n" - + "\034GetProjectIntelligenceConfig\022>.google.storage.cont" - + "rol.v2.GetProjectIntelligenceConfigRequest\032-.google.storage.control.v2.Intellige" - + "nceConfig\"C\332A\004name\202\323\344\223\0026\0224/v2/{name=proj" - + "ects/*/locations/*/intelligenceConfig}\022\235\002\n" - + "\037UpdateProjectIntelligenceConfig\022A.google.storage.control.v2.UpdateProjectInte" - + "lligenceConfigRequest\032-.google.storage.c" - + "ontrol.v2.IntelligenceConfig\"\207\001\332A\037intell" - + "igence_config,update_mask\202\323\344\223\002_2H/v2/{in" - + "telligence_config.name=projects/*/locati" - + "ons/*/intelligenceConfig}:\023intelligence_config\022\317\001\n" - + "\033GetFolderIntelligenceConfig\022=.google.storage.control.v2.GetFolderInte" - + "lligenceConfigRequest\032-.google.storage.c" - + "ontrol.v2.IntelligenceConfig\"B\332A\004name\202\323\344" - + "\223\0025\0223/v2/{name=folders/*/locations/*/intelligenceConfig}\022\232\002\n" - + "\036UpdateFolderIntelligenceConfig\022@.google.storage.control.v2." - + "UpdateFolderIntelligenceConfigRequest\032-.google.storage.control.v2.IntelligenceCo" - + "nfig\"\206\001\332A\037intelligence_config,update_mas" - + "k\202\323\344\223\002^2G/v2/{intelligence_config.name=f" - + "olders/*/locations/*/intelligenceConfig}:\023intelligence_config\022\341\001\n" - + "!GetOrganizationIntelligenceConfig\022C.google.storage.con" - + "trol.v2.GetOrganizationIntelligenceConfigRequest\032-.google.storage.control.v2.Int" - + "elligenceConfig\"H\332A\004name\202\323\344\223\002;\0229/v2/{nam" - + "e=organizations/*/locations/*/intelligenceConfig}\022\254\002\n" - + "$UpdateOrganizationIntelligenceConfig\022F.google.storage.control.v2.U" - + "pdateOrganizationIntelligenceConfigRequest\032-.google.storage.control.v2.Intellige" - + "nceConfig\"\214\001\332A\037intelligence_config,updat" - + "e_mask\202\323\344\223\002d2M/v2/{intelligence_config.n" - + "ame=organizations/*/locations/*/intellig" - + "enceConfig}:\023intelligence_config\032\247\002\312A\026st" + + "\034GetProjectIntelligenceConfig\022>.google.storage.control.v2.GetProjectInt" + + "elligenceConfigRequest\032-.google.storage." + + "control.v2.IntelligenceConfig\"C\332A\004name\202\323" + + "\344\223\0026\0224/v2/{name=projects/*/locations/*/intelligenceConfig}\022\235\002\n" + + "\037UpdateProjectIntelligenceConfig\022A.google.storage.control." + + "v2.UpdateProjectIntelligenceConfigRequest\032-.google.storage.control.v2.Intelligen" + + "ceConfig\"\207\001\332A\037intelligence_config,update" + + "_mask\202\323\344\223\002_2H/v2/{intelligence_config.na" + + "me=projects/*/locations/*/intelligenceConfig}:\023intelligence_config\022\317\001\n" + + "\033GetFolderIntelligenceConfig\022=.google.storage.cont" + + "rol.v2.GetFolderIntelligenceConfigRequest\032-.google.storage.control.v2.Intelligen" + + "ceConfig\"B\332A\004name\202\323\344\223\0025\0223/v2/{name=folders/*/locations/*/intelligenceConfig}\022\232\002\n" + + "\036UpdateFolderIntelligenceConfig\022@.google.storage.control.v2.UpdateFolderIntellig" + + "enceConfigRequest\032-.google.storage.contr" + + "ol.v2.IntelligenceConfig\"\206\001\332A\037intelligen" + + "ce_config,update_mask\202\323\344\223\002^2G/v2/{intell" + + "igence_config.name=folders/*/locations/*" + + "/intelligenceConfig}:\023intelligence_config\022\341\001\n" + + "!GetOrganizationIntelligenceConfig\022C.google.storage.control.v2.GetOrganizat" + + "ionIntelligenceConfigRequest\032-.google.st" + + "orage.control.v2.IntelligenceConfig\"H\332A\004" + + "name\202\323\344\223\002;\0229/v2/{name=organizations/*/locations/*/intelligenceConfig}\022\254\002\n" + + "$UpdateOrganizationIntelligenceConfig\022F.google." + + "storage.control.v2.UpdateOrganizationIntelligenceConfigRequest\032-.google.storage." + + "control.v2.IntelligenceConfig\"\214\001\332A\037intel" + + "ligence_config,update_mask\202\323\344\223\002d2M/v2/{i" + + "ntelligence_config.name=organizations/*/" + + "locations/*/intelligenceConfig}:\023intelligence_config\022\243\001\n" + + "\014GetIamPolicy\022\".google.i" + + "am.v1.GetIamPolicyRequest\032\025.google.iam.v1.Policy\"X\332A\010resource\212\323\344\223\002G\022\027\n" + + "\010resource\022\013{bucket=**}\022,\n" + + "\010resource\022 {bucket=projects/*/buckets/*}/**\022\252\001\n" + + "\014SetIamPolicy\022\".google.iam.v1.SetIamPolicyRequest\032\025.google" + + ".iam.v1.Policy\"_\332A\017resource,policy\212\323\344\223\002G\022\027\n" + + "\010resource\022\013{bucket=**}\022,\n" + + "\010resource\022 {bucket=projects/*/buckets/*}/**\022\226\002\n" + + "\022TestIamPermissions\022(.google.iam.v1.TestIamPe" + + "rmissionsRequest\032).google.iam.v1.TestIam" + + "PermissionsResponse\"\252\001\332A\024resource,permissions\212\323\344\223\002\214\001\022\027\n" + + "\010resource\022\013{bucket=**}\0224\n" + + "\010resource\022({bucket=projects/*/buckets/*}/objects/**\022;\n" + + "\010resource\022/{bucket=project" + + "s/*/buckets/*}/managedFolders/**\032\247\002\312A\026st" + "orage.googleapis.com\322A\212\002https://www.goog" + "leapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.re" + "ad-only,https://www.googleapis.com/auth/devstorage.full_control,https://www.goog" @@ -614,6 +631,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.FieldInfoProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.api.RoutingProto.getDescriptor(), + com.google.iam.v1.IamPolicyProto.getDescriptor(), + com.google.iam.v1.PolicyProto.getDescriptor(), com.google.longrunning.OperationsProto.getDescriptor(), com.google.protobuf.DurationProto.getDescriptor(), com.google.protobuf.EmptyProto.getDescriptor(), @@ -1032,6 +1051,8 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.FieldInfoProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.api.RoutingProto.getDescriptor(); + com.google.iam.v1.IamPolicyProto.getDescriptor(); + com.google.iam.v1.PolicyProto.getDescriptor(); com.google.longrunning.OperationsProto.getDescriptor(); com.google.protobuf.DurationProto.getDescriptor(); com.google.protobuf.EmptyProto.getDescriptor(); diff --git a/proto-google-cloud-storage-control-v2/src/main/proto/google/storage/control/v2/storage_control.proto b/proto-google-cloud-storage-control-v2/src/main/proto/google/storage/control/v2/storage_control.proto index 28680a7617..4a3bda4e5b 100644 --- a/proto-google-cloud-storage-control-v2/src/main/proto/google/storage/control/v2/storage_control.proto +++ b/proto-google-cloud-storage-control-v2/src/main/proto/google/storage/control/v2/storage_control.proto @@ -22,6 +22,8 @@ import "google/api/field_behavior.proto"; import "google/api/field_info.proto"; import "google/api/resource.proto"; import "google/api/routing.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/empty.proto"; @@ -306,6 +308,63 @@ service StorageControl { }; option (google.api.method_signature) = "intelligence_config,update_mask"; } + + // Gets the IAM policy for a specified bucket. + // The `resource` field in the request should be + // `projects/_/buckets/{bucket}` for a bucket, or + // `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` + // for a managed folder. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.routing) = { + routing_parameters { field: "resource" path_template: "{bucket=**}" } + routing_parameters { + field: "resource" + path_template: "{bucket=projects/*/buckets/*}/**" + } + }; + option (google.api.method_signature) = "resource"; + } + + // Updates an IAM policy for the specified bucket. + // The `resource` field in the request should be + // `projects/_/buckets/{bucket}` for a bucket, or + // `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` + // for a managed folder. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) + returns (google.iam.v1.Policy) { + option (google.api.routing) = { + routing_parameters { field: "resource" path_template: "{bucket=**}" } + routing_parameters { + field: "resource" + path_template: "{bucket=projects/*/buckets/*}/**" + } + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Tests a set of permissions on the given bucket, object, or managed folder + // to see which, if any, are held by the caller. + // The `resource` field in the request should be + // `projects/_/buckets/{bucket}` for a bucket, + // `projects/_/buckets/{bucket}/objects/{object}` for an object, or + // `projects/_/buckets/{bucket}/managedFolders/{managedFolder}` + // for a managed folder. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) + returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.routing) = { + routing_parameters { field: "resource" path_template: "{bucket=**}" } + routing_parameters { + field: "resource" + path_template: "{bucket=projects/*/buckets/*}/objects/**" + } + routing_parameters { + field: "resource" + path_template: "{bucket=projects/*/buckets/*}/managedFolders/**" + } + }; + option (google.api.method_signature) = "resource,permissions"; + } } // Contains information about a pending rename operation. diff --git a/proto-google-cloud-storage-v2/pom.xml b/proto-google-cloud-storage-v2/pom.xml index 6b896e6b93..c1d72f4600 100644 --- a/proto-google-cloud-storage-v2/pom.xml +++ b/proto-google-cloud-storage-v2/pom.xml @@ -4,13 +4,13 @@ 4.0.0 com.google.api.grpc proto-google-cloud-storage-v2 - 2.57.0 + 2.58.0 proto-google-cloud-storage-v2 PROTO library for proto-google-cloud-storage-v2 com.google.cloud google-cloud-storage-parent - 2.57.0 + 2.58.0 diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml index b94f1f2b68..8a08445024 100644 --- a/samples/install-without-bom/pom.xml +++ b/samples/install-without-bom/pom.xml @@ -30,12 +30,12 @@ com.google.cloud google-cloud-storage - 2.56.0 + 2.57.0 com.google.cloud google-cloud-storage-control - 2.56.0 + 2.57.0 @@ -48,7 +48,7 @@ com.google.truth truth - 1.4.4 + 1.4.5 test @@ -66,19 +66,19 @@ com.google.cloud google-cloud-pubsub - 1.141.3 + 1.141.4 test com.google.cloud google-cloud-kms - 2.76.0 + 2.77.0 test com.google.cloud google-cloud-storage - 2.56.0 + 2.57.0 tests test diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml index 701a5da140..814b1ea2d6 100644 --- a/samples/snapshot/pom.xml +++ b/samples/snapshot/pom.xml @@ -28,12 +28,12 @@ com.google.cloud google-cloud-storage - 2.57.0 + 2.58.0 com.google.cloud google-cloud-storage-control - 2.57.0 + 2.58.0 compile @@ -46,7 +46,7 @@ com.google.truth truth - 1.4.4 + 1.4.5 test @@ -58,19 +58,19 @@ com.google.cloud google-cloud-pubsub - 1.141.3 + 1.141.4 test com.google.cloud google-cloud-kms - 2.76.0 + 2.77.0 test com.google.cloud google-cloud-storage - 2.57.0 + 2.58.0 tests test diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml index 43d0f1d13e..571f135634 100644 --- a/samples/snippets/pom.xml +++ b/samples/snippets/pom.xml @@ -31,7 +31,7 @@ com.google.cloud libraries-bom - 26.67.0 + 26.68.0 pom import @@ -58,7 +58,7 @@ com.google.truth truth - 1.4.4 + 1.4.5 test @@ -76,13 +76,13 @@ com.google.cloud google-cloud-pubsub - 1.141.3 + 1.141.4 test com.google.cloud google-cloud-kms - 2.76.0 + 2.77.0 test @@ -99,7 +99,7 @@ com.google.cloud google-cloud-storage - 2.56.0 + 2.57.0 tests test diff --git a/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectMultipleRangedRead.java b/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectMultipleRangedRead.java new file mode 100644 index 0000000000..ce36771ad9 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectMultipleRangedRead.java @@ -0,0 +1,65 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.storage.object; + +// [START storage_read_appendable_object_multiple_ranges] + +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.cloud.storage.BlobId; +import com.google.cloud.storage.BlobReadSession; +import com.google.cloud.storage.RangeSpec; +import com.google.cloud.storage.ReadProjectionConfigs; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; +import com.google.common.collect.ImmutableList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +public class AppendableObjectMultipleRangedRead { + public static void appendableObjectMultipleRangedRead( + String bucketName, String objectName, long offset1, int length1, long offset2, int length2) + throws Exception { + try (Storage storage = StorageOptions.grpc().build().getService()) { + BlobId blobId = BlobId.of(bucketName, objectName); + ApiFuture futureBlobReadSession = storage.blobReadSession(blobId); + RangeSpec rangeSpec1 = RangeSpec.of(offset1, length1); + RangeSpec rangeSpec2 = RangeSpec.of(offset2, length2); + + try (BlobReadSession blobReadSession = futureBlobReadSession.get(10, TimeUnit.SECONDS)) { + ApiFuture future1 = + blobReadSession.readAs(ReadProjectionConfigs.asFutureBytes().withRangeSpec(rangeSpec1)); + ApiFuture future2 = + blobReadSession.readAs(ReadProjectionConfigs.asFutureBytes().withRangeSpec(rangeSpec2)); + + List allBytes = ApiFutures.allAsList(ImmutableList.of(future1, future2)).get(); + + byte[] bytes1 = allBytes.get(0); + byte[] bytes2 = allBytes.get(1); + + System.out.println( + "Successfully read " + + bytes1.length + + " bytes from range 1 and " + + bytes2.length + + " bytes from range 2."); + } + } + } +} + +// [END storage_read_appendable_object_multiple_ranges] diff --git a/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectReadFullObject.java b/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectReadFullObject.java new file mode 100644 index 0000000000..0b24051ca6 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectReadFullObject.java @@ -0,0 +1,63 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.storage.object; + +// [START storage_read_appendable_object_full] + +import com.google.api.core.ApiFuture; +import com.google.cloud.storage.BlobId; +import com.google.cloud.storage.BlobReadSession; +import com.google.cloud.storage.ReadAsChannel; +import com.google.cloud.storage.ReadProjectionConfigs; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; +import java.nio.ByteBuffer; +import java.nio.channels.ScatteringByteChannel; +import java.util.Locale; +import java.util.concurrent.TimeUnit; + +public class AppendableObjectReadFullObject { + public static void appendableObjectReadFullObject(String bucketName, String objectName) + throws Exception { + try (Storage storage = StorageOptions.grpc().build().getService()) { + BlobId blobId = BlobId.of(bucketName, objectName); + ApiFuture futureBlobReadSession = storage.blobReadSession(blobId); + + try (BlobReadSession blobReadSession = futureBlobReadSession.get(10, TimeUnit.SECONDS)) { + + ReadAsChannel readAsChannelConfig = ReadProjectionConfigs.asChannel(); + try (ScatteringByteChannel channel = blobReadSession.readAs(readAsChannelConfig)) { + long totalBytesRead = 0; + ByteBuffer buffer = ByteBuffer.allocate(64 * 1024); + int bytesRead; + + while ((bytesRead = channel.read(buffer)) != -1) { + totalBytesRead += bytesRead; + buffer.clear(); + } + + System.out.printf( + Locale.US, + "Successfully read a total of %d bytes from object %s%n", + totalBytesRead, + blobId.toGsUtilUri()); + } + } + } + } +} +// [END storage_read_appendable_object_full] diff --git a/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectSingleRangedRead.java b/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectSingleRangedRead.java new file mode 100644 index 0000000000..437f47203f --- /dev/null +++ b/samples/snippets/src/main/java/com/example/storage/object/AppendableObjectSingleRangedRead.java @@ -0,0 +1,58 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.storage.object; + +// [START storage_read_appendable_object_single_range] + +import com.google.api.core.ApiFuture; +import com.google.cloud.storage.BlobId; +import com.google.cloud.storage.BlobReadSession; +import com.google.cloud.storage.RangeSpec; +import com.google.cloud.storage.ReadProjectionConfigs; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; +import java.util.concurrent.TimeUnit; + +public class AppendableObjectSingleRangedRead { + public static void appendableObjectSingleRangedRead( + String bucketName, String objectName, long offset, int length) throws Exception { + + try (Storage storage = StorageOptions.grpc().build().getService()) { + BlobId blobId = BlobId.of(bucketName, objectName); + ApiFuture futureBlobReadSession = storage.blobReadSession(blobId); + + try (BlobReadSession blobReadSession = futureBlobReadSession.get(10, TimeUnit.SECONDS)) { + // Define the range of bytes to read. + RangeSpec rangeSpec = RangeSpec.of(offset, length); + ApiFuture future = + blobReadSession.readAs(ReadProjectionConfigs.asFutureBytes().withRangeSpec(rangeSpec)); + + // Wait for the read to complete. + byte[] bytes = future.get(); + + System.out.println( + "Successfully read " + + bytes.length + + " bytes from object " + + objectName + + " in bucket " + + bucketName); + } + } + } +} +// [END storage_read_appendable_object_single_range] diff --git a/samples/snippets/src/main/java/com/example/storage/object/FinalizeAppendableObjectUpload.java b/samples/snippets/src/main/java/com/example/storage/object/FinalizeAppendableObjectUpload.java new file mode 100644 index 0000000000..161a2272cf --- /dev/null +++ b/samples/snippets/src/main/java/com/example/storage/object/FinalizeAppendableObjectUpload.java @@ -0,0 +1,64 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.storage.object; + +// [START storage_finalize_appendable_object_upload] + +import com.google.cloud.storage.Blob; +import com.google.cloud.storage.BlobAppendableUpload; +import com.google.cloud.storage.BlobAppendableUploadConfig; +import com.google.cloud.storage.BlobId; +import com.google.cloud.storage.BlobInfo; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; + +public class FinalizeAppendableObjectUpload { + public static void finalizeAppendableObjectUpload(String bucketName, String objectName) + throws Exception { + // The ID of your GCS bucket + // String bucketName = "your-unique-bucket-name"; + + // The ID of your GCS unfinalized appendable object + // String objectName = "your-object-name"; + + try (Storage storage = StorageOptions.grpc().build().getService()) { + BlobId blobId = BlobId.of(bucketName, objectName); + Blob existingBlob = storage.get(blobId); + + if (existingBlob == null) { + System.out.println("Object " + objectName + " not found in bucket " + bucketName); + return; + } + + BlobInfo blobInfoForTakeover = BlobInfo.newBuilder(existingBlob.getBlobId()).build(); + BlobAppendableUpload finalizingSession = + storage.blobAppendableUpload( + blobInfoForTakeover, + BlobAppendableUploadConfig.of() + .withCloseAction(BlobAppendableUploadConfig.CloseAction.FINALIZE_WHEN_CLOSING)); + + try (BlobAppendableUpload.AppendableUploadWriteableByteChannel channel = + finalizingSession.open()) { + channel.finalizeAndClose(); + } + + System.out.println( + "Successfully finalized object " + objectName + " in bucket " + bucketName); + } + } +} +// [END storage_finalize_appendable_object_upload] diff --git a/samples/snippets/src/main/java/com/example/storage/object/ResumeAppendableObjectUpload.java b/samples/snippets/src/main/java/com/example/storage/object/ResumeAppendableObjectUpload.java new file mode 100644 index 0000000000..8852b585d8 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/storage/object/ResumeAppendableObjectUpload.java @@ -0,0 +1,91 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.storage.object; + +// [START storage_resume_appendable_object_upload] + +import com.google.cloud.storage.Blob; +import com.google.cloud.storage.BlobAppendableUpload; +import com.google.cloud.storage.BlobAppendableUpload.AppendableUploadWriteableByteChannel; +import com.google.cloud.storage.BlobAppendableUploadConfig; +import com.google.cloud.storage.BlobAppendableUploadConfig.CloseAction; +import com.google.cloud.storage.BlobId; +import com.google.cloud.storage.BlobInfo; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; +import com.google.common.io.ByteStreams; +import java.io.IOException; +import java.nio.channels.FileChannel; +import java.nio.file.Paths; +import java.util.Locale; + +public class ResumeAppendableObjectUpload { + public static void resumeAppendableObjectUpload( + String bucketName, String objectName, String filePath) throws Exception { + // The ID of your GCS bucket + // String bucketName = "your-unique-bucket-name"; + + // The ID of your GCS unfinalized appendable object + // String objectName = "your-object-name"; + + // The path to the file to upload + // String filePath = "path/to/your/file"; + + try (Storage storage = StorageOptions.grpc().build().getService()) { + BlobId blobId = BlobId.of(bucketName, objectName); + Blob existingBlob = storage.get(blobId); + BlobInfo blobInfoForTakeover = BlobInfo.newBuilder(existingBlob.getBlobId()).build(); + + long currentObjectSize = existingBlob.getSize(); + System.out.printf( + Locale.US, + "Resuming upload for %s. Currently uploaded size: %d bytes\n", + blobId.toGsUtilUri(), + currentObjectSize); + + BlobAppendableUploadConfig config = + BlobAppendableUploadConfig.of().withCloseAction(CloseAction.CLOSE_WITHOUT_FINALIZING); + BlobAppendableUpload resumeUploadSession = + storage.blobAppendableUpload(blobInfoForTakeover, config); + try (FileChannel fileChannel = FileChannel.open(Paths.get(filePath)); + AppendableUploadWriteableByteChannel channel = resumeUploadSession.open()) { + + if (fileChannel.size() < currentObjectSize) { + throw new IOException( + "Local file is smaller than the already uploaded data. File size: " + + fileChannel.size() + + ", Uploaded size: " + + currentObjectSize); + } else if (fileChannel.size() == currentObjectSize) { + System.out.println("No more data to upload."); + } else { + fileChannel.position(currentObjectSize); + System.out.printf( + Locale.US, "Appending %d bytes\n", fileChannel.size() - currentObjectSize); + ByteStreams.copy(fileChannel, channel); + } + } + BlobInfo result = storage.get(blobId); + System.out.printf( + Locale.US, + "Object %s successfully resumed. Total size: %d\n", + result.getBlobId().toGsUtilUriWithGeneration(), + result.getSize()); + } + } +} +// [END storage_resume_appendable_object_upload] diff --git a/samples/snippets/src/main/java/com/example/storage/object/StartAppendableObjectUpload.java b/samples/snippets/src/main/java/com/example/storage/object/StartAppendableObjectUpload.java new file mode 100644 index 0000000000..cda8b7c898 --- /dev/null +++ b/samples/snippets/src/main/java/com/example/storage/object/StartAppendableObjectUpload.java @@ -0,0 +1,70 @@ +/* + * Copyright 2025 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.storage.object; + +// [START storage_start_appendable_object_upload] + +import com.google.cloud.storage.BlobAppendableUpload; +import com.google.cloud.storage.BlobAppendableUpload.AppendableUploadWriteableByteChannel; +import com.google.cloud.storage.BlobAppendableUploadConfig; +import com.google.cloud.storage.BlobAppendableUploadConfig.CloseAction; +import com.google.cloud.storage.BlobId; +import com.google.cloud.storage.BlobInfo; +import com.google.cloud.storage.Storage; +import com.google.cloud.storage.StorageOptions; +import com.google.common.io.ByteStreams; +import java.io.IOException; +import java.nio.channels.FileChannel; +import java.nio.channels.ReadableByteChannel; +import java.nio.file.Paths; +import java.util.Locale; + +public class StartAppendableObjectUpload { + public static void startAppendableObjectUpload( + String bucketName, String objectName, String filePath) throws Exception { + // The ID of your GCS bucket + // String bucketName = "your-unique-bucket-name"; + + // The ID of your GCS object + // String objectName = "your-object-name"; + + // The path to the file to upload + // String filePath = "path/to/your/file"; + + try (Storage storage = StorageOptions.grpc().build().getService()) { + BlobId blobId = BlobId.of(bucketName, objectName); + BlobInfo blobInfo = BlobInfo.newBuilder(blobId).build(); + + BlobAppendableUploadConfig config = + BlobAppendableUploadConfig.of().withCloseAction(CloseAction.CLOSE_WITHOUT_FINALIZING); + BlobAppendableUpload uploadSession = storage.blobAppendableUpload(blobInfo, config); + try (AppendableUploadWriteableByteChannel channel = uploadSession.open(); + ReadableByteChannel readableByteChannel = FileChannel.open(Paths.get(filePath))) { + ByteStreams.copy(readableByteChannel, channel); + } catch (IOException ex) { + throw new IOException("Failed to upload to object " + blobId.toGsUtilUri(), ex); + } + BlobInfo result = storage.get(blobId); + System.out.printf( + Locale.US, + "Object %s successfully uploaded", + result.getBlobId().toGsUtilUriWithGeneration()); + } + } +} + +// [END storage_start_appendable_object_upload] diff --git a/storage-shared-benchmarking/pom.xml b/storage-shared-benchmarking/pom.xml index f43678d25e..ec0080c9b1 100644 --- a/storage-shared-benchmarking/pom.xml +++ b/storage-shared-benchmarking/pom.xml @@ -10,7 +10,7 @@ com.google.cloud google-cloud-storage-parent - 2.57.0 + 2.58.0 @@ -31,7 +31,7 @@ com.google.cloud google-cloud-storage - 2.57.0 + 2.58.0 tests diff --git a/versions.txt b/versions.txt index 5eff244cfc..1a8a97cccd 100644 --- a/versions.txt +++ b/versions.txt @@ -1,10 +1,10 @@ # Format: # module:released-version:current-version -google-cloud-storage:2.57.0:2.57.0 -gapic-google-cloud-storage-v2:2.57.0:2.57.0 -grpc-google-cloud-storage-v2:2.57.0:2.57.0 -proto-google-cloud-storage-v2:2.57.0:2.57.0 -google-cloud-storage-control:2.57.0:2.57.0 -proto-google-cloud-storage-control-v2:2.57.0:2.57.0 -grpc-google-cloud-storage-control-v2:2.57.0:2.57.0 +google-cloud-storage:2.58.0:2.58.0 +gapic-google-cloud-storage-v2:2.58.0:2.58.0 +grpc-google-cloud-storage-v2:2.58.0:2.58.0 +proto-google-cloud-storage-v2:2.58.0:2.58.0 +google-cloud-storage-control:2.58.0:2.58.0 +proto-google-cloud-storage-control-v2:2.58.0:2.58.0 +grpc-google-cloud-storage-control-v2:2.58.0:2.58.0