From 76b022c75711575b356b7ff56d5dee4c42e745de Mon Sep 17 00:00:00 2001 From: Alice Li Date: Tue, 23 Aug 2022 15:18:14 -0400 Subject: [PATCH] feat: initial generation --- .github/.OwlBot.lock.yaml | 16 + .github/.OwlBot.yaml | 32 + .github/CODEOWNERS | 10 + .github/ISSUE_TEMPLATE/bug_report.md | 51 + .github/ISSUE_TEMPLATE/feature_request.md | 21 + .github/ISSUE_TEMPLATE/support_request.md | 7 + .github/PULL_REQUEST_TEMPLATE.md | 10 + .github/auto-label.yaml | 15 + .github/blunderbuss.yml | 7 + .github/generated-files-bot.yml | 12 + .github/release-please.yml | 3 + .github/release-trigger.yml | 1 + .github/snippet-bot.yml | 0 .github/sync-repo-settings.yaml | 63 + .github/trusted-contribution.yml | 3 + .github/workflows/approve-readme.yaml | 69 + .github/workflows/auto-release.yaml | 103 + .github/workflows/ci.yaml | 89 + .github/workflows/samples.yaml | 30 + .gitignore | 17 + .kokoro/build.bat | 18 + .kokoro/build.sh | 134 + .kokoro/coerce_logs.sh | 37 + .kokoro/common.cfg | 13 + .kokoro/common.sh | 60 + .kokoro/continuous/common.cfg | 25 + .kokoro/continuous/java8.cfg | 12 + .kokoro/dependencies.sh | 110 + .kokoro/nightly/common.cfg | 25 + .kokoro/nightly/integration.cfg | 37 + .kokoro/nightly/java11-integration.cfg | 37 + .kokoro/nightly/java11.cfg | 7 + .kokoro/nightly/java7.cfg | 7 + .kokoro/nightly/java8-osx.cfg | 3 + .kokoro/nightly/java8-win.cfg | 3 + .kokoro/nightly/java8.cfg | 12 + .kokoro/nightly/samples.cfg | 38 + .kokoro/populate-secrets.sh | 43 + .kokoro/presubmit/clirr.cfg | 13 + .kokoro/presubmit/common.cfg | 34 + .kokoro/presubmit/dependencies.cfg | 12 + .kokoro/presubmit/graalvm-native-17.cfg | 33 + .kokoro/presubmit/graalvm-native.cfg | 33 + .kokoro/presubmit/integration.cfg | 33 + .kokoro/presubmit/java11.cfg | 7 + .kokoro/presubmit/java7.cfg | 7 + .kokoro/presubmit/java8-osx.cfg | 3 + .kokoro/presubmit/java8-win.cfg | 3 + .kokoro/presubmit/java8.cfg | 12 + .kokoro/presubmit/linkage-monitor.cfg | 12 + .kokoro/presubmit/lint.cfg | 13 + .kokoro/presubmit/samples.cfg | 33 + .kokoro/readme.sh | 45 + .kokoro/release/bump_snapshot.cfg | 53 + .kokoro/release/common.cfg | 49 + .kokoro/release/common.sh | 50 + .kokoro/release/drop.cfg | 6 + .kokoro/release/drop.sh | 32 + .kokoro/release/promote.cfg | 6 + .kokoro/release/promote.sh | 34 + .kokoro/release/publish_javadoc.cfg | 23 + .kokoro/release/publish_javadoc.sh | 53 + .kokoro/release/publish_javadoc11.cfg | 30 + .kokoro/release/publish_javadoc11.sh | 63 + .kokoro/release/snapshot.cfg | 6 + .kokoro/release/snapshot.sh | 33 + .kokoro/release/stage.cfg | 19 + .kokoro/release/stage.sh | 46 + .kokoro/trampoline.sh | 26 + .repo-metadata.json | 16 + CODE_OF_CONDUCT.md | 94 + CONTRIBUTING.md | 92 + LICENSE | 201 ++ README.md | 201 ++ SECURITY.md | 7 + google-cloud-apikeys-bom/pom.xml | 94 + google-cloud-apikeys/pom.xml | 139 + .../google/api/apikeys/v2/ApiKeysClient.java | 1207 +++++++ .../api/apikeys/v2/ApiKeysSettings.java | 323 ++ .../google/api/apikeys/v2/gapic_metadata.json | 42 + .../google/api/apikeys/v2/package-info.java | 40 + .../api/apikeys/v2/stub/ApiKeysStub.java | 112 + .../apikeys/v2/stub/ApiKeysStubSettings.java | 722 ++++ .../v2/stub/GrpcApiKeysCallableFactory.java | 113 + .../api/apikeys/v2/stub/GrpcApiKeysStub.java | 414 +++ .../stub/HttpJsonApiKeysCallableFactory.java | 105 + .../apikeys/v2/stub/HttpJsonApiKeysStub.java | 626 ++++ .../apikeys/v2/ApiKeysClientHttpJsonTest.java | 804 +++++ .../api/apikeys/v2/ApiKeysClientTest.java | 730 ++++ .../google/api/apikeys/v2/MockApiKeys.java | 59 + .../api/apikeys/v2/MockApiKeysImpl.java | 223 ++ grpc-google-cloud-apikeys-v2/pom.xml | 69 + .../google/api/apikeys/v2/ApiKeysGrpc.java | 1195 +++++++ java.header | 15 + license-checks.xml | 10 + owlbot.py | 24 + pom.xml | 188 ++ .../clirr-ignored-differences.xml | 19 + proto-google-cloud-apikeys-v2/pom.xml | 46 + .../api/apikeys/v2/AndroidApplication.java | 836 +++++ .../v2/AndroidApplicationOrBuilder.java | 81 + .../apikeys/v2/AndroidKeyRestrictions.java | 988 ++++++ .../v2/AndroidKeyRestrictionsOrBuilder.java | 82 + .../google/api/apikeys/v2/ApiKeysProto.java | 278 ++ .../com/google/api/apikeys/v2/ApiTarget.java | 1027 ++++++ .../api/apikeys/v2/ApiTargetOrBuilder.java | 135 + .../apikeys/v2/BrowserKeyRestrictions.java | 751 +++++ .../v2/BrowserKeyRestrictionsOrBuilder.java | 80 + .../api/apikeys/v2/CreateKeyRequest.java | 1161 +++++++ .../apikeys/v2/CreateKeyRequestOrBuilder.java | 132 + .../api/apikeys/v2/DeleteKeyRequest.java | 836 +++++ .../apikeys/v2/DeleteKeyRequestOrBuilder.java | 81 + .../google/api/apikeys/v2/GetKeyRequest.java | 649 ++++ .../apikeys/v2/GetKeyRequestOrBuilder.java | 54 + .../api/apikeys/v2/GetKeyStringRequest.java | 650 ++++ .../v2/GetKeyStringRequestOrBuilder.java | 54 + .../api/apikeys/v2/GetKeyStringResponse.java | 636 ++++ .../v2/GetKeyStringResponseOrBuilder.java | 50 + .../api/apikeys/v2/IosKeyRestrictions.java | 737 ++++ .../v2/IosKeyRestrictionsOrBuilder.java | 76 + .../java/com/google/api/apikeys/v2/Key.java | 2970 +++++++++++++++++ .../com/google/api/apikeys/v2/KeyName.java | 216 ++ .../google/api/apikeys/v2/KeyOrBuilder.java | 399 +++ .../api/apikeys/v2/ListKeysRequest.java | 1013 ++++++ .../apikeys/v2/ListKeysRequestOrBuilder.java | 106 + .../api/apikeys/v2/ListKeysResponse.java | 1119 +++++++ .../apikeys/v2/ListKeysResponseOrBuilder.java | 101 + .../google/api/apikeys/v2/LocationName.java | 192 ++ .../api/apikeys/v2/LookupKeyRequest.java | 636 ++++ .../apikeys/v2/LookupKeyRequestOrBuilder.java | 50 + .../api/apikeys/v2/LookupKeyResponse.java | 822 +++++ .../v2/LookupKeyResponseOrBuilder.java | 77 + .../google/api/apikeys/v2/ResourcesProto.java | 224 ++ .../google/api/apikeys/v2/Restrictions.java | 2352 +++++++++++++ .../api/apikeys/v2/RestrictionsOrBuilder.java | 234 ++ .../api/apikeys/v2/ServerKeyRestrictions.java | 751 +++++ .../v2/ServerKeyRestrictionsOrBuilder.java | 80 + .../api/apikeys/v2/UndeleteKeyRequest.java | 650 ++++ .../v2/UndeleteKeyRequestOrBuilder.java | 54 + .../api/apikeys/v2/UpdateKeyRequest.java | 1090 ++++++ .../apikeys/v2/UpdateKeyRequestOrBuilder.java | 119 + .../proto/google/api/apikeys/v2/apikeys.proto | 287 ++ .../google/api/apikeys/v2/resources.proto | 172 + renovate.json | 74 + samples/install-without-bom/pom.xml | 84 + samples/pom.xml | 56 + samples/snapshot/pom.xml | 83 + samples/snippets/pom.xml | 47 + versions.txt | 6 + 149 files changed, 33370 insertions(+) create mode 100644 .github/.OwlBot.lock.yaml create mode 100644 .github/.OwlBot.yaml create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/support_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/auto-label.yaml create mode 100644 .github/blunderbuss.yml create mode 100644 .github/generated-files-bot.yml create mode 100644 .github/release-please.yml create mode 100644 .github/release-trigger.yml create mode 100644 .github/snippet-bot.yml create mode 100644 .github/sync-repo-settings.yaml create mode 100644 .github/trusted-contribution.yml create mode 100644 .github/workflows/approve-readme.yaml create mode 100644 .github/workflows/auto-release.yaml create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/samples.yaml create mode 100644 .gitignore create mode 100644 .kokoro/build.bat create mode 100755 .kokoro/build.sh create mode 100755 .kokoro/coerce_logs.sh create mode 100644 .kokoro/common.cfg create mode 100644 .kokoro/common.sh create mode 100644 .kokoro/continuous/common.cfg create mode 100644 .kokoro/continuous/java8.cfg create mode 100755 .kokoro/dependencies.sh create mode 100644 .kokoro/nightly/common.cfg create mode 100644 .kokoro/nightly/integration.cfg create mode 100644 .kokoro/nightly/java11-integration.cfg create mode 100644 .kokoro/nightly/java11.cfg create mode 100644 .kokoro/nightly/java7.cfg create mode 100644 .kokoro/nightly/java8-osx.cfg create mode 100644 .kokoro/nightly/java8-win.cfg create mode 100644 .kokoro/nightly/java8.cfg create mode 100644 .kokoro/nightly/samples.cfg create mode 100755 .kokoro/populate-secrets.sh create mode 100644 .kokoro/presubmit/clirr.cfg create mode 100644 .kokoro/presubmit/common.cfg create mode 100644 .kokoro/presubmit/dependencies.cfg create mode 100644 .kokoro/presubmit/graalvm-native-17.cfg create mode 100644 .kokoro/presubmit/graalvm-native.cfg create mode 100644 .kokoro/presubmit/integration.cfg create mode 100644 .kokoro/presubmit/java11.cfg create mode 100644 .kokoro/presubmit/java7.cfg create mode 100644 .kokoro/presubmit/java8-osx.cfg create mode 100644 .kokoro/presubmit/java8-win.cfg create mode 100644 .kokoro/presubmit/java8.cfg create mode 100644 .kokoro/presubmit/linkage-monitor.cfg create mode 100644 .kokoro/presubmit/lint.cfg create mode 100644 .kokoro/presubmit/samples.cfg create mode 100755 .kokoro/readme.sh create mode 100644 .kokoro/release/bump_snapshot.cfg create mode 100644 .kokoro/release/common.cfg create mode 100755 .kokoro/release/common.sh create mode 100644 .kokoro/release/drop.cfg create mode 100755 .kokoro/release/drop.sh create mode 100644 .kokoro/release/promote.cfg create mode 100755 .kokoro/release/promote.sh create mode 100644 .kokoro/release/publish_javadoc.cfg create mode 100755 .kokoro/release/publish_javadoc.sh create mode 100644 .kokoro/release/publish_javadoc11.cfg create mode 100755 .kokoro/release/publish_javadoc11.sh create mode 100644 .kokoro/release/snapshot.cfg create mode 100755 .kokoro/release/snapshot.sh create mode 100644 .kokoro/release/stage.cfg create mode 100755 .kokoro/release/stage.sh create mode 100644 .kokoro/trampoline.sh create mode 100644 .repo-metadata.json create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 SECURITY.md create mode 100644 google-cloud-apikeys-bom/pom.xml create mode 100644 google-cloud-apikeys/pom.xml create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysClient.java create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysSettings.java create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/gapic_metadata.json create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/package-info.java create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStub.java create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStubSettings.java create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysCallableFactory.java create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysStub.java create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysCallableFactory.java create mode 100644 google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysStub.java create mode 100644 google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientHttpJsonTest.java create mode 100644 google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientTest.java create mode 100644 google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeys.java create mode 100644 google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeysImpl.java create mode 100644 grpc-google-cloud-apikeys-v2/pom.xml create mode 100644 grpc-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysGrpc.java create mode 100644 java.header create mode 100644 license-checks.xml create mode 100644 owlbot.py create mode 100644 pom.xml create mode 100644 proto-google-cloud-apikeys-v2/clirr-ignored-differences.xml create mode 100644 proto-google-cloud-apikeys-v2/pom.xml create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplication.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplicationOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictions.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictionsOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysProto.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTarget.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTargetOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictions.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictionsOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequest.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequestOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequest.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequestOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequest.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequestOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequest.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequestOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponse.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponseOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictions.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictionsOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Key.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyName.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequest.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequestOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponse.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponseOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LocationName.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequest.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequestOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponse.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponseOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ResourcesProto.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Restrictions.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/RestrictionsOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictions.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictionsOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequest.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequestOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequest.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequestOrBuilder.java create mode 100644 proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/apikeys.proto create mode 100644 proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/resources.proto create mode 100644 renovate.json create mode 100644 samples/install-without-bom/pom.xml create mode 100644 samples/pom.xml create mode 100644 samples/snapshot/pom.xml create mode 100644 samples/snippets/pom.xml create mode 100644 versions.txt diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 0000000..8218fd8 --- /dev/null +++ b/.github/.OwlBot.lock.yaml @@ -0,0 +1,16 @@ +# Copyright 2022 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. +docker: + digest: sha256:7a9a7eb50ca2af5bfffab3abd2f38d408735c990a74bacf9b7fde2af0a086a0b + image: gcr.io/cloud-devrel-public-resources/owlbot-java:latest \ No newline at end of file diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml new file mode 100644 index 0000000..faacbbc --- /dev/null +++ b/.github/.OwlBot.yaml @@ -0,0 +1,32 @@ +# Copyright 2021 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. + +docker: + image: "gcr.io/cloud-devrel-public-resources/owlbot-java:latest" + +deep-remove-regex: +- "/grpc-google-.*/src" +- "/proto-google-.*/src" +- "/google-.*/src" + +deep-preserve-regex: +- "/google-.*/src/test/java/com/google/cloud/.*/v.*/it/IT.*Test.java" + +deep-copy-regex: +- source: "/google/api/apikeys/(v.*)/.*-java/proto-google-.*/src" + dest: "/owl-bot-staging/$1/proto-google-cloud-apikeys-$1/src" +- source: "/google/api/apikeys/(v.*)/.*-java/grpc-google-.*/src" + dest: "/owl-bot-staging/$1/grpc-google-cloud-apikeys-$1/src" +- source: "/google/api/apikeys/(v.*)/.*-java/gapic-google-.*/src" + dest: "/owl-bot-staging/$1/google-cloud-apikeys/src" diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..30fdb7b --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,10 @@ +# Code owners file. +# This file controls who is tagged for review for any given pull request. + +# For syntax help see: +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax + +* @googleapis/yoshi-java + +# The java-samples-reviewers team is the default owner for samples changes +samples/**/*.java @googleapis/java-samples-reviewers diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..7192749 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,51 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +Please run down the following list and make sure you've tried the usual "quick fixes": + + - Search the issues already opened: https://github.com/googleapis/java-apikeys/issues + - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform + +If you are still having issues, please include as much information as possible: + +#### Environment details + +1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). + General, Core, and Other are also allowed as types +2. OS type and version: +3. Java version: +4. version(s): + +#### Steps to reproduce + + 1. ? + 2. ? + +#### Code example + +```java +// example +``` + +#### Stack trace +``` +Any relevant stacktrace here. +``` + +#### External references such as API reference guides + +- ? + +#### Any additional information below + + +Following these steps guarantees the quickest resolution possible. + +Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..754e30c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this library + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +**Is your feature request related to a problem? Please describe.** +What the problem is. Example: I'm always frustrated when [...] + +**Describe the solution you'd like** +What you want to happen. + +**Describe alternatives you've considered** +Any alternative solutions or features you've considered. + +**Additional context** +Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 0000000..9958690 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -0,0 +1,7 @@ +--- +name: Support request +about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. + +--- + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..aa196b8 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,10 @@ +Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: +- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-apikeys/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea +- [ ] Ensure the tests and linter pass +- [ ] Code coverage does not decrease (if any source code was changed) +- [ ] Appropriate docs were updated (if necessary) + +Fixes # ☕️ + +If you write sample code, please follow the [samples format]( +https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md). diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..4caef68 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# Copyright 2021 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. +requestsize: + enabled: true diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml new file mode 100644 index 0000000..2176b05 --- /dev/null +++ b/.github/blunderbuss.yml @@ -0,0 +1,7 @@ +# Configuration for the Blunderbuss GitHub app. For more info see +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/blunderbuss +assign_prs_by: +- labels: + - samples + to: + - googleapis/java-samples-reviewers \ No newline at end of file diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml new file mode 100644 index 0000000..c644a24 --- /dev/null +++ b/.github/generated-files-bot.yml @@ -0,0 +1,12 @@ +externalManifests: +- type: json + file: 'synth.metadata' + jsonpath: '$.generatedFiles[*]' +- type: json + file: '.github/readme/synth.metadata/synth.metadata' + jsonpath: '$.generatedFiles[*]' +ignoreAuthors: +- 'renovate-bot' +- 'yoshi-automation' +- 'release-please[bot]' +- 'gcf-owl-bot[bot]' diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 0000000..8ca7f9c --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,3 @@ +bumpMinorPreMajor: true +handleGHRelease: true +releaseType: java-yoshi diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 0000000..d4ca941 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml new file mode 100644 index 0000000..72acb9d --- /dev/null +++ b/.github/sync-repo-settings.yaml @@ -0,0 +1,63 @@ +# Copyright 2022 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. +# Whether or not rebase-merging is enabled on this repository. +# Defaults to `true` +rebaseMergeAllowed: false + +# Whether or not squash-merging is enabled on this repository. +# Defaults to `true` +squashMergeAllowed: true + +# Whether or not PRs are merged with a merge commit on this repository. +# Defaults to `false` +mergeCommitAllowed: false + +# Rules for main branch protection +branchProtectionRules: +# Identifies the protection rule pattern. Name of the branch to be protected. +# Defaults to `main` +- pattern: main + # Can admins overwrite branch protection. + # Defaults to `true` + isAdminEnforced: true + # Number of approving reviews required to update matching branches. + # Defaults to `1` + requiredApprovingReviewCount: 1 + # Are reviews from code owners required to update matching branches. + # Defaults to `false` + requiresCodeOwnerReviews: true + # Require up to date branches + requiresStrictStatusChecks: false + # List of required status check contexts that must pass for commits to be accepted to matching branches. + requiredStatusCheckContexts: + - "dependencies (11)" + - "lint" + - "units (8)" + - "units (11)" + - "Kokoro - Test: Integration" + - "cla/google" + - "OwlBot Post Processor" + - "Kokoro - Test: Java GraalVM Native Image" + - "Kokoro - Test: Java 17 GraalVM Native Image" +# List of explicit permissions to add (additive only) +permissionRules: +- team: yoshi-admins + permission: admin +- team: yoshi-java-admins + permission: admin +- team: yoshi-java + permission: push +- team: java-samples-reviewers + permission: push + diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml new file mode 100644 index 0000000..a0ba1f7 --- /dev/null +++ b/.github/trusted-contribution.yml @@ -0,0 +1,3 @@ +trustedContributors: +- renovate-bot +- gcf-owl-bot[bot] diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml new file mode 100644 index 0000000..f5fc7d5 --- /dev/null +++ b/.github/workflows/approve-readme.yaml @@ -0,0 +1,69 @@ +# Copyright 2022 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. +# Github action job to test core java library features on +# downstream client libraries before they are released. +on: + pull_request: +name: auto-merge-readme +jobs: + approve: + runs-on: ubuntu-latest + if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' + steps: + - uses: actions/github-script@v6 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + script: | + // only approve PRs from yoshi-automation + if (context.payload.pull_request.user.login !== "yoshi-automation") { + return; + } + + // only approve PRs like "chore: release " + if (!context.payload.pull_request.title === "chore: regenerate README") { + return; + } + + // only approve PRs with README.md and synth.metadata changes + const files = new Set( + ( + await github.paginate( + github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }) + ) + ).map(file => file.filename) + ); + if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { + return; + } + + // approve README regeneration PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped PR!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach automerge label + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['automerge'] + }); diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml new file mode 100644 index 0000000..7a106d0 --- /dev/null +++ b/.github/workflows/auto-release.yaml @@ -0,0 +1,103 @@ +# Copyright 2022 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. +# Github action job to test core java library features on +# downstream client libraries before they are released. +on: + pull_request: +name: auto-release +jobs: + approve: + runs-on: ubuntu-latest + if: contains(github.head_ref, 'release-please') + steps: + - uses: actions/github-script@v6 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + debug: true + script: | + // only approve PRs from release-please[bot] + if (context.payload.pull_request.user.login !== "release-please[bot]") { + return; + } + + // only approve PRs like "chore(main): release " + if ( !context.payload.pull_request.title.startsWith("chore(main): release") ) { + return; + } + + // only approve PRs with pom.xml and versions.txt changes + const filesPromise = github.rest.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + const changed_files = await github.paginate(filesPromise) + + if ( changed_files.length < 1 ) { + console.log( "Not proceeding since PR is empty!" ) + return; + } + + if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) { + console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" ) + return; + } + + // trigger auto-release when + // 1) it is a SNAPSHOT release (auto-generated post regular release) + // 2) there are dependency updates only + // 3) there are no open dependency update PRs in this repo (to avoid multiple releases) + if ( + context.payload.pull_request.body.includes("Fix") || + context.payload.pull_request.body.includes("Build") || + context.payload.pull_request.body.includes("Documentation") || + context.payload.pull_request.body.includes("BREAKING CHANGES") || + context.payload.pull_request.body.includes("Features") + ) { + console.log( "Not auto-releasing since it is not a dependency-update-only release." ); + return; + } + + const promise = github.rest.pulls.list.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + const open_pulls = await github.paginate(promise) + + if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) { + for ( const pull of open_pulls ) { + if ( pull.title.startsWith("deps: update dependency") ) { + console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." ); + return; + } + } + } + + // approve release PR + await github.rest.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped release!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach kokoro:force-run and automerge labels + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['kokoro:force-run', 'automerge'] + }); diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..e3bb26e --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,89 @@ +# Copyright 2022 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. +# Github action job to test core java library features on +# downstream client libraries before they are released. +on: + push: + branches: + - main + pull_request: +name: ci +jobs: + units: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + java: [8, 11, 17] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: test + windows: + runs-on: windows-latest + steps: + - name: Support longpaths + run: git config --system core.longpaths true + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 8 + - run: java -version + - run: .kokoro/build.bat + env: + JOB_TYPE: test + dependencies: + runs-on: ubuntu-latest + strategy: + matrix: + java: [8, 11, 17] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/dependencies.sh + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 11 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: lint + clirr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 8 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: clirr diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml new file mode 100644 index 0000000..912ed8b --- /dev/null +++ b/.github/workflows/samples.yaml @@ -0,0 +1,30 @@ +# Copyright 2022 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. +# Github action job to test core java library features on +# downstream client libraries before they are released. +on: + pull_request: +name: samples +jobs: + checkstyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: zulu + java-version: 8 + - name: Run checkstyle + run: mvn -P lint --quiet --batch-mode checkstyle:check + working-directory: samples/snippets diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..069d08f --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Maven +target/ + +# Eclipse +.classpath +.project +.settings + +# Intellij +*.iml +.idea/ + +# python utilities +*.pyc +__pycache__ + +.flattened-pom.xml diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 0000000..067cf4a --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,18 @@ +:: Copyright 2022 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. +:: Github action job to test core java library features on +:: downstream client libraries before they are released. +:: See documentation in type-shell-output.bat + +"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 0000000..f00b473 --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,134 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Maven & Java version +mvn -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +RETURN_CODE=0 +set +e + +case ${JOB_TYPE} in +test) + mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? + ;; +lint) + mvn com.coveo:fmt-maven-plugin:check -B -ntp + RETURN_CODE=$? + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc -B -ntp + RETURN_CODE=$? + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} \ + -ntp \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + ;; +graalvm) + # Run Unit and Integration Tests with Native Image + mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test + RETURN_CODE=$? + ;; +graalvm17) + # Run Unit and Integration Tests with Native Image + mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test + RETURN_CODE=$? + ;; +samples) + SAMPLES_DIR=samples + # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. + if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] + then + SAMPLES_DIR=samples/snapshot + fi + + if [[ -f ${SAMPLES_DIR}/pom.xml ]] + then + for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do + [[ -f "$FILE" ]] || continue + source "$FILE" + done + + pushd ${SAMPLES_DIR} + mvn -B \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi + ;; +clirr) + mvn -B -ntp -Denforcer.skip=true clirr:check + RETURN_CODE=$? + ;; +*) + ;; +esac + +if [ "${REPORT_COVERAGE}" == "true" ] +then + bash ${KOKORO_GFILE_DIR}/codecov.sh +fi + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +if [[ "${ENABLE_FLAKYBOT}" == "true" ]] +then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot + ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/java-apikeys +fi + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 0000000..46edbf7 --- /dev/null +++ b/.kokoro/coerce_logs.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copyright 2019 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. + +# This script finds and moves sponge logs so that they can be found by placer +# and are not flagged as flaky by sponge. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +job=$(basename ${KOKORO_JOB_NAME}) + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${job}/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 0000000..39b43c4 --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "java-apikeys/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/build.sh" +} diff --git a/.kokoro/common.sh b/.kokoro/common.sh new file mode 100644 index 0000000..f8f957a --- /dev/null +++ b/.kokoro/common.sh @@ -0,0 +1,60 @@ +#!/bin/bash +# Copyright 2020 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. + +function retry_with_backoff { + attempts_left=$1 + sleep_seconds=$2 + shift 2 + command=$@ + + + # store current flag state + flags=$- + + # allow a failures to continue + set +e + ${command} + exit_code=$? + + # restore "e" flag + if [[ ${flags} =~ e ]] + then set -e + else set +e + fi + + if [[ $exit_code == 0 ]] + then + return 0 + fi + + # failure + if [[ ${attempts_left} > 0 ]] + then + echo "failure (${exit_code}), sleeping ${sleep_seconds}..." + sleep ${sleep_seconds} + new_attempts=$((${attempts_left} - 1)) + new_sleep=$((${sleep_seconds} * 2)) + retry_with_backoff ${new_attempts} ${new_sleep} ${command} + fi + + return $exit_code +} + +## Helper functionss +function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } +function msg() { println "$*" >&2; } +function println() { printf '%s\n' "$(now) $*"; } + +## Helper comment to trigger updated repo dependency release \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 0000000..84578ed --- /dev/null +++ b/.kokoro/continuous/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-apikeys/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/continuous/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh new file mode 100755 index 0000000..d7476cf --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail +shopt -s nullglob + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java +java -version +echo $JOB_TYPE + +function determineMavenOpts() { + local javaVersion=$( + # filter down to the version line, then pull out the version between quotes, + # then trim the version number down to its minimal number (removing any + # update or suffix number). + java -version 2>&1 | grep "version" \ + | sed -E 's/^.*"(.*?)".*$/\1/g' \ + | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' + ) + + if [[ $javaVersion == 17* ]] + then + # MaxPermSize is no longer supported as of jdk 17 + echo -n "-Xmx1024m" + else + echo -n "-Xmx1024m -XX:MaxPermSize=128m" + fi +} + +export MAVEN_OPTS=$(determineMavenOpts) + +# this should run maven enforcer +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dmaven.javadoc.skip=true \ + -Dclirr.skip=true + +mvn -B dependency:analyze -DfailOnWarning=true + +echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" +## Run dependency list completeness check +function completenessCheck() { + # Output dep list with compile scope generated using the original pom + # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. + # This is stripped from the output as it is not present in the flattened pom. + # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. + msg "Generating dependency list using original pom..." + mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e 's/ --.*//' >.org-list.txt + + # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) + msg "Generating dependency list using flattened pom..." + mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + + # Compare two dependency lists + msg "Comparing dependency lists..." + diff .org-list.txt .new-list.txt >.diff.txt + if [[ $? == 0 ]] + then + msg "Success. No diff!" + else + msg "Diff found. See below: " + msg "You can also check .diff.txt file located in $1." + cat .diff.txt + return 1 + fi +} + +# Allow failures to continue running the script +set +e + +error_count=0 +for path in **/.flattened-pom.xml +do + # Check flattened pom in each dir that contains it for completeness + dir=$(dirname "$path") + pushd "$dir" + completenessCheck "$dir" + error_count=$(($error_count + $?)) + popd +done + +if [[ $error_count == 0 ]] +then + msg "All checks passed." + exit 0 +else + msg "Errors found. See log statements above." + exit 1 +fi diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg new file mode 100644 index 0000000..84578ed --- /dev/null +++ b/.kokoro/nightly/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-apikeys/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg new file mode 100644 index 0000000..a2907a2 --- /dev/null +++ b/.kokoro/nightly/integration.cfg @@ -0,0 +1,37 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "ENABLE_FLAKYBOT" + value: "true" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/nightly/java11-integration.cfg b/.kokoro/nightly/java11-integration.cfg new file mode 100644 index 0000000..58049cc --- /dev/null +++ b/.kokoro/nightly/java11-integration.cfg @@ -0,0 +1,37 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-public-resources/java11014" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "ENABLE_FLAKYBOT" + value: "true" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg new file mode 100644 index 0000000..709f2b4 --- /dev/null +++ b/.kokoro/nightly/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/nightly/java7.cfg b/.kokoro/nightly/java7.cfg new file mode 100644 index 0000000..cb24f44 --- /dev/null +++ b/.kokoro/nightly/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/nightly/java8-osx.cfg b/.kokoro/nightly/java8-osx.cfg new file mode 100644 index 0000000..61588ee --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-apikeys/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 0000000..ae7197f --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-apikeys/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/nightly/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg new file mode 100644 index 0000000..9761fd8 --- /dev/null +++ b/.kokoro/nightly/samples.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} + +env_vars: { + key: "ENABLE_FLAKYBOT" + value: "true" +} diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 0000000..f525142 --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 2020 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. + +set -eo pipefail + +function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} +function msg { println "$*" >&2 ;} +function println { printf '%s\n' "$(now) $*" ;} + + +# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: +# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com +SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" +msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" +mkdir -p ${SECRET_LOCATION} +for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") +do + msg "Retrieving secret ${key}" + docker run --entrypoint=gcloud \ + --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ + gcr.io/google.com/cloudsdktool/cloud-sdk \ + secrets versions access latest \ + --project cloud-devrel-kokoro-resources \ + --secret ${key} > \ + "${SECRET_LOCATION}/${key}" + if [[ $? == 0 ]]; then + msg "Secret written to ${SECRET_LOCATION}/${key}" + else + msg "Error retrieving secret ${key}" + fi +done diff --git a/.kokoro/presubmit/clirr.cfg b/.kokoro/presubmit/clirr.cfg new file mode 100644 index 0000000..ec57244 --- /dev/null +++ b/.kokoro/presubmit/clirr.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "clirr" +} \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 0000000..6d59695 --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-apikeys/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg new file mode 100644 index 0000000..98b387a --- /dev/null +++ b/.kokoro/presubmit/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/dependencies.sh" +} diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg new file mode 100644 index 0000000..a3f7fb9 --- /dev/null +++ b/.kokoro/presubmit/graalvm-native-17.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17" +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm17" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg new file mode 100644 index 0000000..4c7225e --- /dev/null +++ b/.kokoro/presubmit/graalvm-native.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/graalvm" +} + +env_vars: { + key: "JOB_TYPE" + value: "graalvm" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 0000000..dded67a --- /dev/null +++ b/.kokoro/presubmit/integration.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg new file mode 100644 index 0000000..709f2b4 --- /dev/null +++ b/.kokoro/presubmit/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/presubmit/java7.cfg b/.kokoro/presubmit/java7.cfg new file mode 100644 index 0000000..cb24f44 --- /dev/null +++ b/.kokoro/presubmit/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/presubmit/java8-osx.cfg b/.kokoro/presubmit/java8-osx.cfg new file mode 100644 index 0000000..61588ee --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-apikeys/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 0000000..ae7197f --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-apikeys/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/presubmit/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg new file mode 100644 index 0000000..2d8daef --- /dev/null +++ b/.kokoro/presubmit/linkage-monitor.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/linkage-monitor.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 0000000..6d323c8 --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg new file mode 100644 index 0000000..01e0960 --- /dev/null +++ b/.kokoro/presubmit/samples.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} \ No newline at end of file diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh new file mode 100755 index 0000000..02e766e --- /dev/null +++ b/.kokoro/readme.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2020 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. + +set -eo pipefail + +cd ${KOKORO_ARTIFACTS_DIR}/github/java-apikeys + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Kokoro exposes this as a file, but the scripts expect just a plain variable. +export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) + +# Setup git credentials +echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials +git config --global credential.helper 'store --file ~/.git-credentials' + +python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool + +set +e +python3.6 -m autosynth.synth \ + --repository=googleapis/java-apikeys \ + --synth-file-name=.github/readme/synth.py \ + --metadata-path=.github/readme/synth.metadata \ + --pr-title="chore: regenerate README" \ + --branch-suffix="readme" + +# autosynth returns 28 to signal there are no changes +RETURN_CODE=$? +if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] +then + exit ${RETURN_CODE} +fi diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg new file mode 100644 index 0000000..2a13bca --- /dev/null +++ b/.kokoro/release/bump_snapshot.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-apikeys/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/release/bump_snapshot.sh" +} + +# tokens used by release-please to keep an up-to-date release PR. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" + } + } +} diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg new file mode 100644 index 0000000..e4f9c2d --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,49 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-apikeys/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-keyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-passphrase" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-pubkeyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "sonatype-credentials" + } + } +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh new file mode 100755 index 0000000..7f78ee4 --- /dev/null +++ b/.kokoro/release/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2018 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. + +set -eo pipefail + +# Get secrets from keystore and set and environment variables +setup_environment_secrets() { + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) + export GPG_TTY=$(tty) + export GPG_HOMEDIR=/gpg + mkdir $GPG_HOMEDIR + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') +} + +create_settings_xml_file() { + echo " + + + ossrh + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-staging + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-snapshots + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + +" > $1 +} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg new file mode 100644 index 0000000..de74307 --- /dev/null +++ b/.kokoro/release/drop.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/release/drop.sh" +} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 0000000..742ec1a --- /dev/null +++ b/.kokoro/release/drop.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2018 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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:drop -B \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg new file mode 100644 index 0000000..c530e94 --- /dev/null +++ b/.kokoro/release/promote.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/release/promote.sh" +} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 0000000..3cac3d8 --- /dev/null +++ b/.kokoro/release/promote.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2018 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. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh + +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg new file mode 100644 index 0000000..56ec88f --- /dev/null +++ b/.kokoro/release/publish_javadoc.cfg @@ -0,0 +1,23 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/" + +env_vars: { + key: "STAGING_BUCKET" + value: "docs-staging" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/release/publish_javadoc.sh" +} + + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh new file mode 100755 index 0000000..12da081 --- /dev/null +++ b/.kokoro/release/publish_javadoc.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET}" ]]; then + echo "Need to set STAGING_BUCKET environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-cloud-apikeys +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# build the docs +mvn site -B -q + +pushd target/site/apidocs + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --language java + +# upload docs +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg new file mode 100644 index 0000000..5a43598 --- /dev/null +++ b/.kokoro/release/publish_javadoc11.cfg @@ -0,0 +1,30 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# cloud-rad production +env_vars: { + key: "STAGING_BUCKET_V2" + value: "docs-staging-v2" +} + +# Configure the docker image for kokoro-trampoline +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/release/publish_javadoc11.sh" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} + +# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh new file mode 100755 index 0000000..4161ea2 --- /dev/null +++ b/.kokoro/release/publish_javadoc11.sh @@ -0,0 +1,63 @@ +#!/bin/bash +# Copyright 2021 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. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET_V2}" ]]; then + echo "Need to set STAGING_BUCKET_V2 environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-cloud-apikeys +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# cloud RAD generation +mvn clean javadoc:aggregate -B -q -P docFX +# include CHANGELOG +cp CHANGELOG.md target/docfx-yml/history.md + +pushd target/docfx-yml + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --xrefs devsite://java/gax \ + --xrefs devsite://java/google-cloud-core \ + --xrefs devsite://java/api-common \ + --xrefs devsite://java/proto-google-common-protos \ + --xrefs devsite://java/google-api-client \ + --xrefs devsite://java/google-http-client \ + --xrefs devsite://java/protobuf \ + --language java + +# upload yml to production bucket +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET_V2} \ + --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg new file mode 100644 index 0000000..1b5505a --- /dev/null +++ b/.kokoro/release/snapshot.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/release/snapshot.sh" +} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh new file mode 100755 index 0000000..1f55b77 --- /dev/null +++ b/.kokoro/release/snapshot.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 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. + +set -eo pipefail + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +# ensure we're trying to push a snapshot (no-result returns non-zero exit code) +grep SNAPSHOT versions.txt + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg new file mode 100644 index 0000000..7d3a9c2 --- /dev/null +++ b/.kokoro/release/stage.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-apikeys/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-apikeys/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-apikeys" + } +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" +} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh new file mode 100755 index 0000000..1dba8de --- /dev/null +++ b/.kokoro/release/stage.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Copyright 2018 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. + +set -eo pipefail + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +source $(dirname "$0")/../common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +# attempt to stage 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn clean deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DskipTests=true \ + -Dclirr.skip=true \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} + +if [[ -n "${AUTORELEASE_PR}" ]] +then + mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml +fi diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 0000000..8b69b79 --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2018 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. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT + +$(dirname $0)/populate-secrets.sh # Secret Manager secrets. +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.repo-metadata.json b/.repo-metadata.json new file mode 100644 index 0000000..7088c27 --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,16 @@ +{ + "api_shortname": "apikeys", + "name_pretty": "API Keys", + "product_documentation": "cloud.google.com/api-keys/", + "api_description": "manages the API keys associated with projects.", + "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/overview", + "release_level": "preview", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-apikeys", + "repo_short": "java-apikeys", + "distribution_name": "com.google.cloud:google-cloud-apikeys", + "api_id": "apikeys.googleapis.com", + "library_type": "GAPIC_AUTO", + "requires_billing": true +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..2add254 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b65dd27 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,92 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). + +## Building the project + +To build, package, and run all unit tests run the command + +``` +mvn clean verify +``` + +### Running Integration tests + +To include integration tests when building the project, you need access to +a GCP Project with a valid service account. + +For instructions on how to generate a service account and corresponding +credentials JSON see: [Creating a Service Account][1]. + +Then run the following to build, package, run all unit tests and run all +integration tests. + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-integration-tests clean verify +``` + +## Code Samples + +All code samples must be in compliance with the [java sample formatting guide][3]. +Code Samples must be bundled in separate Maven modules. + +The samples must be separate from the primary project for a few reasons: +1. Primary projects have a minimum Java version of Java 8 whereas samples can have + Java version of Java 11. Due to this we need the ability to + selectively exclude samples from a build run. +2. Many code samples depend on external GCP services and need + credentials to access the service. +3. Code samples are not released as Maven artifacts and must be excluded from + release builds. + +### Building + +```bash +mvn clean verify +``` + +Some samples require access to GCP services and require a service account: + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn clean verify +``` + +### Code Formatting + +Code in this repo is formatted with +[google-java-format](https://github.com/google/google-java-format). +To run formatting on your project, you can run: +``` +mvn com.coveo:fmt-maven-plugin:format +``` + +[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account +[2]: https://maven.apache.org/settings.html#Active_Profiles +[3]: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..aa22d4b --- /dev/null +++ b/README.md @@ -0,0 +1,201 @@ +# Google API Keys Client for Java + +Java idiomatic client for [API Keys][product-docs]. + +[![Maven][maven-version-image]][maven-version-link] +![Stability][stability-image] + +- [Product Documentation][product-docs] +- [Client Library Documentation][javadocs] + +> Note: This client is a work-in-progress, and may occasionally +> make backwards-incompatible changes. + + +## Quickstart + + +If you are using Maven, add this to your pom.xml file: + + +```xml + + com.google.cloud + google-cloud-apikeys + 0.0.0 + +``` + +If you are using Gradle without BOM, add this to your dependencies: + +```Groovy +implementation 'com.google.cloud:google-cloud-apikeys:0.0.0' +``` + +If you are using SBT, add this to your dependencies: + +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-apikeys" % "0.0.0" +``` + +## Authentication + +See the [Authentication][authentication] section in the base directory's README. + +## Authorization + +The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired API Keys APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the API Keys API calls. + +## Getting Started + +### Prerequisites + +You will need a [Google Cloud Platform Console][developer-console] project with the API Keys [API enabled][enable-api]. +You will need to [enable billing][enable-billing] to use Google API Keys. +[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by +[installing the Google Cloud SDK][cloud-sdk] and running the following commands in command line: +`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. + +### Installation and setup + +You'll need to obtain the `google-cloud-apikeys` library. See the [Quickstart](#quickstart) section +to add `google-cloud-apikeys` as a dependency in your code. + +## About API Keys + + +[API Keys][product-docs] manages the API keys associated with projects. + +See the [API Keys client library docs][javadocs] to learn how to +use this API Keys Client Library. + + + + + + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. + +## Transport + +API Keys uses gRPC for the transport layer. + +## Supported Java Versions + +Java 8 or above is required for using this client. + +Google's Java client libraries, +[Google Cloud Client Libraries][cloudlibs] +and +[Google Cloud API Libraries][apilibs], +follow the +[Oracle Java SE support roadmap][oracle] +(see the Oracle Java SE Product Releases section). + +### For new development + +In general, new feature development occurs with support for the lowest Java +LTS version covered by Oracle's Premier Support (which typically lasts 5 years +from initial General Availability). If the minimum required JVM for a given +library is changed, it is accompanied by a [semver][semver] major release. + +Java 11 and (in September 2021) Java 17 are the best choices for new +development. + +### Keeping production systems current + +Google tests its client libraries with all current LTS versions covered by +Oracle's Extended Support (which typically lasts 8 years from initial +General Availability). + +#### Legacy support + +Google's client libraries support legacy versions of Java runtimes with long +term stable libraries that don't receive feature updates on a best efforts basis +as it may not be possible to backport all patches. + +Google provides updates on a best efforts basis to apps that continue to use +Java 7, though apps might need to upgrade to current versions of the library +that supports their JVM. + +#### Where to find specific information + +The latest versions and the supported Java versions are identified on +the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` +and on [google-cloud-java][g-c-j]. + +## Versioning + + +This library follows [Semantic Versioning](http://semver.org/). + + +It is currently in major version zero (``0.y.z``), which means that anything may change at any time +and the public API should not be considered stable. + + +## Contributing + + +Contributions to this library are always welcome and highly encouraged. + +See [CONTRIBUTING][contributing] for more information how to get started. + +Please note that this project is released with a Contributor Code of Conduct. By participating in +this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more +information. + + +## License + +Apache 2.0 - See [LICENSE][license] for more information. + +## CI Status + +Java Version | Status +------------ | ------ +Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] +Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] +Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] +Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] + +Java is a registered trademark of Oracle and/or its affiliates. + +[product-docs]: cloud.google.com/api-keys/ +[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-apikeys/latest/overview +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-apikeys/java11.html +[stability-image]: https://img.shields.io/badge/stability-preview-yellow +[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-apikeys.svg +[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-apikeys&core=gav +[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 +[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy +[developer-console]: https://console.developers.google.com/ +[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects +[cloud-sdk]: https://cloud.google.com/sdk/ +[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting +[contributing]: https://github.com/googleapis/java-apikeys/blob/main/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/java-apikeys/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/java-apikeys/blob/main/LICENSE +[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing +[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=apikeys.googleapis.com +[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png + +[semver]: https://semver.org/ +[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained +[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries +[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html +[g-c-j]: http://github.com/googleapis/google-cloud-java diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..8b58ae9 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/google-cloud-apikeys-bom/pom.xml b/google-cloud-apikeys-bom/pom.xml new file mode 100644 index 0000000..ef99150 --- /dev/null +++ b/google-cloud-apikeys-bom/pom.xml @@ -0,0 +1,94 @@ + + + 4.0.0 + com.google.cloud + google-cloud-apikeys-bom + 0.0.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 1.2.7 + + + Google API Keys BOM + https://github.com/googleapis/java-apikeys + + BOM for API Keys + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + neenushaji + Neenu Shaji + neenushaji@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-apikeys.git + scm:git:git@github.com:googleapis/java-apikeys.git + https://github.com/googleapis/java-apikeys + + + + true + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + com.google.cloud + google-cloud-apikeys + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-apikeys-v2 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-apikeys-v2 + 0.0.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + diff --git a/google-cloud-apikeys/pom.xml b/google-cloud-apikeys/pom.xml new file mode 100644 index 0000000..ac12d75 --- /dev/null +++ b/google-cloud-apikeys/pom.xml @@ -0,0 +1,139 @@ + + + 4.0.0 + com.google.cloud + google-cloud-apikeys + 0.0.1-SNAPSHOT + jar + Google API Keys + https://github.com/googleapis/java-apikeys + API Keys manages the API keys associated with projects. + + com.google.cloud + google-cloud-apikeys-parent + 0.0.1-SNAPSHOT + + + google-cloud-apikeys + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + + com.google.api.grpc + proto-google-cloud-apikeys-v2 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + com.google.api + gax-httpjson + + + com.google.api.grpc + grpc-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api.grpc + grpc-google-iam-v1 + + + org.threeten + threetenbp + + + + + junit + junit + test + 4.13.2 + + + + com.google.api.grpc + grpc-google-cloud-apikeys-v2 + test + + + + com.google.api + gax + testlib + test + + + com.google.api + gax-grpc + testlib + test + + + com.google.api + gax-httpjson + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysClient.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysClient.java new file mode 100644 index 0000000..a4b1ded --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysClient.java @@ -0,0 +1,1207 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2; + +import com.google.api.apikeys.v2.stub.ApiKeysStub; +import com.google.api.apikeys.v2.stub.ApiKeysStubSettings; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.httpjson.longrunning.OperationsClient; +import com.google.api.gax.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Service Description: Manages the API keys associated with projects. + * + *

This class provides the ability to make remote calls to the backing service through method + * calls that map to API methods. Sample code to get started: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+ *   KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]");
+ *   Key response = apiKeysClient.getKey(name);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the ApiKeysClient object to clean up resources such as + * threads. In the example above, try-with-resources is used, which automatically calls close(). + * + *

The surface of this class includes several types of Java methods for each of the API's + * methods: + * + *

    + *
  1. A "flattened" method. With this type of method, the fields of the request type have been + * converted into function parameters. It may be the case that not all fields are available as + * parameters, and not every API method will have a flattened method entry point. + *
  2. A "request object" method. This type of method only takes one parameter, a request object, + * which must be constructed before the call. Not every API method will have a request object + * method. + *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API + * callable object, which can be used to initiate calls to the service. + *
+ * + *

See the individual methods for example code. + * + *

Many parameters require resource names to be formatted in a particular way. To assist with + * these names, this class includes a format method for each type of name, and additionally a parse + * method to extract the individual identifiers contained within names that are returned. + * + *

This class can be customized by passing in a custom instance of ApiKeysSettings to create(). + * For example: + * + *

To customize credentials: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ApiKeysSettings apiKeysSettings =
+ *     ApiKeysSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * ApiKeysClient apiKeysClient = ApiKeysClient.create(apiKeysSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ApiKeysSettings apiKeysSettings = ApiKeysSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * ApiKeysClient apiKeysClient = ApiKeysClient.create(apiKeysSettings);
+ * }
+ * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ApiKeysSettings apiKeysSettings =
+ *     ApiKeysSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             ApiKeysSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * ApiKeysClient apiKeysClient = ApiKeysClient.create(apiKeysSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class ApiKeysClient implements BackgroundResource { + private final ApiKeysSettings settings; + private final ApiKeysStub stub; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; + + /** Constructs an instance of ApiKeysClient with default settings. */ + public static final ApiKeysClient create() throws IOException { + return create(ApiKeysSettings.newBuilder().build()); + } + + /** + * Constructs an instance of ApiKeysClient, using the given settings. The channels are created + * based on the settings passed in, or defaults for any settings that are not set. + */ + public static final ApiKeysClient create(ApiKeysSettings settings) throws IOException { + return new ApiKeysClient(settings); + } + + /** + * Constructs an instance of ApiKeysClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(ApiKeysSettings). + */ + public static final ApiKeysClient create(ApiKeysStub stub) { + return new ApiKeysClient(stub); + } + + /** + * Constructs an instance of ApiKeysClient, using the given settings. This is protected so that it + * is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected ApiKeysClient(ApiKeysSettings settings) throws IOException { + this.settings = settings; + this.stub = ((ApiKeysStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + protected ApiKeysClient(ApiKeysStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); + } + + public final ApiKeysSettings getSettings() { + return settings; + } + + public ApiKeysStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final com.google.longrunning.OperationsClient getOperationsClient() { + return operationsClient; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + @BetaApi + public final OperationsClient getHttpJsonOperationsClient() { + return httpJsonOperationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Key key = Key.newBuilder().build();
+   *   String keyId = "keyId101944282";
+   *   Key response = apiKeysClient.createKeyAsync(parent, key, keyId).get();
+   * }
+   * }
+ * + * @param parent Required. The project in which the API key is created. + * @param key Required. The API key fields to set at creation time. You can configure only the + * `display_name`, `restrictions`, and `annotations` fields. + * @param keyId User specified key id (optional). If specified, it will become the final component + * of the key resource name. + *

The id must be unique within the project, must conform with RFC-1034, is restricted to + * lower-cased letters, and has a maximum length of 63 characters. In another word, the id + * must match the regular expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + *

The id must NOT be a UUID-like string. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createKeyAsync( + LocationName parent, Key key, String keyId) { + CreateKeyRequest request = + CreateKeyRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setKey(key) + .setKeyId(keyId) + .build(); + return createKeyAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   Key key = Key.newBuilder().build();
+   *   String keyId = "keyId101944282";
+   *   Key response = apiKeysClient.createKeyAsync(parent, key, keyId).get();
+   * }
+   * }
+ * + * @param parent Required. The project in which the API key is created. + * @param key Required. The API key fields to set at creation time. You can configure only the + * `display_name`, `restrictions`, and `annotations` fields. + * @param keyId User specified key id (optional). If specified, it will become the final component + * of the key resource name. + *

The id must be unique within the project, must conform with RFC-1034, is restricted to + * lower-cased letters, and has a maximum length of 63 characters. In another word, the id + * must match the regular expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + *

The id must NOT be a UUID-like string. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createKeyAsync(String parent, Key key, String keyId) { + CreateKeyRequest request = + CreateKeyRequest.newBuilder().setParent(parent).setKey(key).setKeyId(keyId).build(); + return createKeyAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   CreateKeyRequest request =
+   *       CreateKeyRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setKey(Key.newBuilder().build())
+   *           .setKeyId("keyId101944282")
+   *           .build();
+   *   Key response = apiKeysClient.createKeyAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture createKeyAsync(CreateKeyRequest request) { + return createKeyOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   CreateKeyRequest request =
+   *       CreateKeyRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setKey(Key.newBuilder().build())
+   *           .setKeyId("keyId101944282")
+   *           .build();
+   *   OperationFuture future =
+   *       apiKeysClient.createKeyOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable createKeyOperationCallable() { + return stub.createKeyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Creates a new API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   CreateKeyRequest request =
+   *       CreateKeyRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setKey(Key.newBuilder().build())
+   *           .setKeyId("keyId101944282")
+   *           .build();
+   *   ApiFuture future = apiKeysClient.createKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createKeyCallable() { + return stub.createKeyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the API keys owned by a project. The key string of the API key isn't included in the + * response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Key element : apiKeysClient.listKeys(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. Lists all API keys associated with this project. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListKeysPagedResponse listKeys(LocationName parent) { + ListKeysRequest request = + ListKeysRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listKeys(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the API keys owned by a project. The key string of the API key isn't included in the + * response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+   *   for (Key element : apiKeysClient.listKeys(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. Lists all API keys associated with this project. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListKeysPagedResponse listKeys(String parent) { + ListKeysRequest request = ListKeysRequest.newBuilder().setParent(parent).build(); + return listKeys(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the API keys owned by a project. The key string of the API key isn't included in the + * response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   ListKeysRequest request =
+   *       ListKeysRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   for (Key element : apiKeysClient.listKeys(request).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @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 ListKeysPagedResponse listKeys(ListKeysRequest request) { + return listKeysPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the API keys owned by a project. The key string of the API key isn't included in the + * response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   ListKeysRequest request =
+   *       ListKeysRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   ApiFuture future = apiKeysClient.listKeysPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Key element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listKeysPagedCallable() { + return stub.listKeysPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the API keys owned by a project. The key string of the API key isn't included in the + * response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   ListKeysRequest request =
+   *       ListKeysRequest.newBuilder()
+   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setShowDeleted(true)
+   *           .build();
+   *   while (true) {
+   *     ListKeysResponse response = apiKeysClient.listKeysCallable().call(request);
+   *     for (Key element : response.getKeysList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listKeysCallable() { + return stub.listKeysCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the metadata for an API key. The key string of the API key isn't included in the response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]");
+   *   Key response = apiKeysClient.getKey(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the API key to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Key getKey(KeyName name) { + GetKeyRequest request = + GetKeyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the metadata for an API key. The key string of the API key isn't included in the response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   String name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString();
+   *   Key response = apiKeysClient.getKey(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the API key to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Key getKey(String name) { + GetKeyRequest request = GetKeyRequest.newBuilder().setName(name).build(); + return getKey(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the metadata for an API key. The key string of the API key isn't included in the response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   GetKeyRequest request =
+   *       GetKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .build();
+   *   Key response = apiKeysClient.getKey(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 Key getKey(GetKeyRequest request) { + return getKeyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the metadata for an API key. The key string of the API key isn't included in the response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   GetKeyRequest request =
+   *       GetKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .build();
+   *   ApiFuture future = apiKeysClient.getKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getKeyCallable() { + return stub.getKeyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get the key string for an API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]");
+   *   GetKeyStringResponse response = apiKeysClient.getKeyString(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the API key to be retrieved. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final GetKeyStringResponse getKeyString(KeyName name) { + GetKeyStringRequest request = + GetKeyStringRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getKeyString(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get the key string for an API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   String name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString();
+   *   GetKeyStringResponse response = apiKeysClient.getKeyString(name);
+   * }
+   * }
+ * + * @param name Required. The resource name of the API key to be retrieved. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final GetKeyStringResponse getKeyString(String name) { + GetKeyStringRequest request = GetKeyStringRequest.newBuilder().setName(name).build(); + return getKeyString(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get the key string for an API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   GetKeyStringRequest request =
+   *       GetKeyStringRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .build();
+   *   GetKeyStringResponse response = apiKeysClient.getKeyString(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 GetKeyStringResponse getKeyString(GetKeyStringRequest request) { + return getKeyStringCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get the key string for an API key. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   GetKeyStringRequest request =
+   *       GetKeyStringRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       apiKeysClient.getKeyStringCallable().futureCall(request);
+   *   // Do something.
+   *   GetKeyStringResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getKeyStringCallable() { + return stub.getKeyStringCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Patches the modifiable fields of an API key. The key string of the API key isn't included in + * the response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   Key key = Key.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Key response = apiKeysClient.updateKeyAsync(key, updateMask).get();
+   * }
+   * }
+ * + * @param key Required. Set the `name` field to the resource name of the API key to be updated. + * You can update only the `display_name`, `restrictions`, and `annotations` fields. + * @param updateMask The field mask specifies which fields to be updated as part of this request. + * All other fields are ignored. Mutable fields are: `display_name`, `restrictions`, and + * `annotations`. If an update mask is not provided, the service treats it as an implied mask + * equivalent to all allowed fields that are set on the wire. If the field mask has a special + * value "*", the service treats it equivalent to replace all allowed mutable fields. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updateKeyAsync(Key key, FieldMask updateMask) { + UpdateKeyRequest request = + UpdateKeyRequest.newBuilder().setKey(key).setUpdateMask(updateMask).build(); + return updateKeyAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Patches the modifiable fields of an API key. The key string of the API key isn't included in + * the response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   UpdateKeyRequest request =
+   *       UpdateKeyRequest.newBuilder()
+   *           .setKey(Key.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Key response = apiKeysClient.updateKeyAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture updateKeyAsync(UpdateKeyRequest request) { + return updateKeyOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Patches the modifiable fields of an API key. The key string of the API key isn't included in + * the response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   UpdateKeyRequest request =
+   *       UpdateKeyRequest.newBuilder()
+   *           .setKey(Key.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   OperationFuture future =
+   *       apiKeysClient.updateKeyOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable updateKeyOperationCallable() { + return stub.updateKeyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Patches the modifiable fields of an API key. The key string of the API key isn't included in + * the response. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   UpdateKeyRequest request =
+   *       UpdateKeyRequest.newBuilder()
+   *           .setKey(Key.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future = apiKeysClient.updateKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateKeyCallable() { + return stub.updateKeyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key + * will be purged from the project. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]");
+   *   Key response = apiKeysClient.deleteKeyAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The resource name of the API key to be deleted. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteKeyAsync(KeyName name) { + DeleteKeyRequest request = + DeleteKeyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return deleteKeyAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key + * will be purged from the project. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   String name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString();
+   *   Key response = apiKeysClient.deleteKeyAsync(name).get();
+   * }
+   * }
+ * + * @param name Required. The resource name of the API key to be deleted. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteKeyAsync(String name) { + DeleteKeyRequest request = DeleteKeyRequest.newBuilder().setName(name).build(); + return deleteKeyAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key + * will be purged from the project. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   DeleteKeyRequest request =
+   *       DeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   Key response = apiKeysClient.deleteKeyAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture deleteKeyAsync(DeleteKeyRequest request) { + return deleteKeyOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key + * will be purged from the project. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   DeleteKeyRequest request =
+   *       DeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   OperationFuture future =
+   *       apiKeysClient.deleteKeyOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable deleteKeyOperationCallable() { + return stub.deleteKeyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key + * will be purged from the project. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   DeleteKeyRequest request =
+   *       DeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .setEtag("etag3123477")
+   *           .build();
+   *   ApiFuture future = apiKeysClient.deleteKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteKeyCallable() { + return stub.deleteKeyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes an API key which was deleted within 30 days. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   UndeleteKeyRequest request =
+   *       UndeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .build();
+   *   Key response = apiKeysClient.undeleteKeyAsync(request).get();
+   * }
+   * }
+ * + * @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 OperationFuture undeleteKeyAsync(UndeleteKeyRequest request) { + return undeleteKeyOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes an API key which was deleted within 30 days. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   UndeleteKeyRequest request =
+   *       UndeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .build();
+   *   OperationFuture future =
+   *       apiKeysClient.undeleteKeyOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Key response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable undeleteKeyOperationCallable() { + return stub.undeleteKeyOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Undeletes an API key which was deleted within 30 days. + * + *

NOTE: Key is a global resource; hence the only supported value for location is `global`. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   UndeleteKeyRequest request =
+   *       UndeleteKeyRequest.newBuilder()
+   *           .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString())
+   *           .build();
+   *   ApiFuture future = apiKeysClient.undeleteKeyCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable undeleteKeyCallable() { + return stub.undeleteKeyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Find the parent project and resource name of the API key that matches the key string in the + * request. If the API key has been purged, resource name will not be set. The service account + * must have the `apikeys.keys.lookup` permission on the parent project. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   LookupKeyRequest request =
+   *       LookupKeyRequest.newBuilder().setKeyString("keyString-1988270256").build();
+   *   LookupKeyResponse response = apiKeysClient.lookupKey(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 LookupKeyResponse lookupKey(LookupKeyRequest request) { + return lookupKeyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Find the parent project and resource name of the API key that matches the key string in the + * request. If the API key has been purged, resource name will not be set. The service account + * must have the `apikeys.keys.lookup` permission on the parent project. + * + *

Sample code: + * + *

{@code
+   * // This snippet has been automatically generated for illustrative purposes only.
+   * // It may require modifications to work in your environment.
+   * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+   *   LookupKeyRequest request =
+   *       LookupKeyRequest.newBuilder().setKeyString("keyString-1988270256").build();
+   *   ApiFuture future = apiKeysClient.lookupKeyCallable().futureCall(request);
+   *   // Do something.
+   *   LookupKeyResponse response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable lookupKeyCallable() { + return stub.lookupKeyCallable(); + } + + @Override + public final void close() { + stub.close(); + } + + @Override + public void shutdown() { + stub.shutdown(); + } + + @Override + public boolean isShutdown() { + return stub.isShutdown(); + } + + @Override + public boolean isTerminated() { + return stub.isTerminated(); + } + + @Override + public void shutdownNow() { + stub.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return stub.awaitTermination(duration, unit); + } + + public static class ListKeysPagedResponse + extends AbstractPagedListResponse< + ListKeysRequest, ListKeysResponse, Key, ListKeysPage, ListKeysFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListKeysPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, input -> new ListKeysPagedResponse(input), MoreExecutors.directExecutor()); + } + + private ListKeysPagedResponse(ListKeysPage page) { + super(page, ListKeysFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListKeysPage + extends AbstractPage { + + private ListKeysPage( + PageContext context, ListKeysResponse response) { + super(context, response); + } + + private static ListKeysPage createEmptyPage() { + return new ListKeysPage(null, null); + } + + @Override + protected ListKeysPage createPage( + PageContext context, ListKeysResponse response) { + return new ListKeysPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListKeysFixedSizeCollection + extends AbstractFixedSizeCollection< + ListKeysRequest, ListKeysResponse, Key, ListKeysPage, ListKeysFixedSizeCollection> { + + private ListKeysFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListKeysFixedSizeCollection createEmptyCollection() { + return new ListKeysFixedSizeCollection(null, 0); + } + + @Override + protected ListKeysFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListKeysFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysSettings.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysSettings.java new file mode 100644 index 0000000..abd0604 --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysSettings.java @@ -0,0 +1,323 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2; + +import static com.google.api.apikeys.v2.ApiKeysClient.ListKeysPagedResponse; + +import com.google.api.apikeys.v2.stub.ApiKeysStubSettings; +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ApiKeysClient}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (apikeys.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getKey to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ApiKeysSettings.Builder apiKeysSettingsBuilder = ApiKeysSettings.newBuilder();
+ * apiKeysSettingsBuilder
+ *     .getKeySettings()
+ *     .setRetrySettings(
+ *         apiKeysSettingsBuilder
+ *             .getKeySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ApiKeysSettings apiKeysSettings = apiKeysSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ApiKeysSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to createKey. */ + public UnaryCallSettings createKeySettings() { + return ((ApiKeysStubSettings) getStubSettings()).createKeySettings(); + } + + /** Returns the object with the settings used for calls to createKey. */ + public OperationCallSettings createKeyOperationSettings() { + return ((ApiKeysStubSettings) getStubSettings()).createKeyOperationSettings(); + } + + /** Returns the object with the settings used for calls to listKeys. */ + public PagedCallSettings + listKeysSettings() { + return ((ApiKeysStubSettings) getStubSettings()).listKeysSettings(); + } + + /** Returns the object with the settings used for calls to getKey. */ + public UnaryCallSettings getKeySettings() { + return ((ApiKeysStubSettings) getStubSettings()).getKeySettings(); + } + + /** Returns the object with the settings used for calls to getKeyString. */ + public UnaryCallSettings getKeyStringSettings() { + return ((ApiKeysStubSettings) getStubSettings()).getKeyStringSettings(); + } + + /** Returns the object with the settings used for calls to updateKey. */ + public UnaryCallSettings updateKeySettings() { + return ((ApiKeysStubSettings) getStubSettings()).updateKeySettings(); + } + + /** Returns the object with the settings used for calls to updateKey. */ + public OperationCallSettings updateKeyOperationSettings() { + return ((ApiKeysStubSettings) getStubSettings()).updateKeyOperationSettings(); + } + + /** Returns the object with the settings used for calls to deleteKey. */ + public UnaryCallSettings deleteKeySettings() { + return ((ApiKeysStubSettings) getStubSettings()).deleteKeySettings(); + } + + /** Returns the object with the settings used for calls to deleteKey. */ + public OperationCallSettings deleteKeyOperationSettings() { + return ((ApiKeysStubSettings) getStubSettings()).deleteKeyOperationSettings(); + } + + /** Returns the object with the settings used for calls to undeleteKey. */ + public UnaryCallSettings undeleteKeySettings() { + return ((ApiKeysStubSettings) getStubSettings()).undeleteKeySettings(); + } + + /** Returns the object with the settings used for calls to undeleteKey. */ + public OperationCallSettings undeleteKeyOperationSettings() { + return ((ApiKeysStubSettings) getStubSettings()).undeleteKeyOperationSettings(); + } + + /** Returns the object with the settings used for calls to lookupKey. */ + public UnaryCallSettings lookupKeySettings() { + return ((ApiKeysStubSettings) getStubSettings()).lookupKeySettings(); + } + + public static final ApiKeysSettings create(ApiKeysStubSettings stub) throws IOException { + return new ApiKeysSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return ApiKeysStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return ApiKeysStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return ApiKeysStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return ApiKeysStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return ApiKeysStubSettings.defaultGrpcTransportProviderBuilder(); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ApiKeysStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return ApiKeysStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiKeysStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ApiKeysSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for ApiKeysSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(ApiKeysStubSettings.newBuilder(clientContext)); + } + + protected Builder(ApiKeysSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(ApiKeysStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(ApiKeysStubSettings.newBuilder()); + } + + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(ApiKeysStubSettings.newHttpJsonBuilder()); + } + + public ApiKeysStubSettings.Builder getStubSettingsBuilder() { + return ((ApiKeysStubSettings.Builder) getStubSettings()); + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createKey. */ + public UnaryCallSettings.Builder createKeySettings() { + return getStubSettingsBuilder().createKeySettings(); + } + + /** Returns the builder for the settings used for calls to createKey. */ + public OperationCallSettings.Builder + createKeyOperationSettings() { + return getStubSettingsBuilder().createKeyOperationSettings(); + } + + /** Returns the builder for the settings used for calls to listKeys. */ + public PagedCallSettings.Builder + listKeysSettings() { + return getStubSettingsBuilder().listKeysSettings(); + } + + /** Returns the builder for the settings used for calls to getKey. */ + public UnaryCallSettings.Builder getKeySettings() { + return getStubSettingsBuilder().getKeySettings(); + } + + /** Returns the builder for the settings used for calls to getKeyString. */ + public UnaryCallSettings.Builder + getKeyStringSettings() { + return getStubSettingsBuilder().getKeyStringSettings(); + } + + /** Returns the builder for the settings used for calls to updateKey. */ + public UnaryCallSettings.Builder updateKeySettings() { + return getStubSettingsBuilder().updateKeySettings(); + } + + /** Returns the builder for the settings used for calls to updateKey. */ + public OperationCallSettings.Builder + updateKeyOperationSettings() { + return getStubSettingsBuilder().updateKeyOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deleteKey. */ + public UnaryCallSettings.Builder deleteKeySettings() { + return getStubSettingsBuilder().deleteKeySettings(); + } + + /** Returns the builder for the settings used for calls to deleteKey. */ + public OperationCallSettings.Builder + deleteKeyOperationSettings() { + return getStubSettingsBuilder().deleteKeyOperationSettings(); + } + + /** Returns the builder for the settings used for calls to undeleteKey. */ + public UnaryCallSettings.Builder undeleteKeySettings() { + return getStubSettingsBuilder().undeleteKeySettings(); + } + + /** Returns the builder for the settings used for calls to undeleteKey. */ + public OperationCallSettings.Builder + undeleteKeyOperationSettings() { + return getStubSettingsBuilder().undeleteKeyOperationSettings(); + } + + /** Returns the builder for the settings used for calls to lookupKey. */ + public UnaryCallSettings.Builder lookupKeySettings() { + return getStubSettingsBuilder().lookupKeySettings(); + } + + @Override + public ApiKeysSettings build() throws IOException { + return new ApiKeysSettings(this); + } + } +} diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/gapic_metadata.json b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/gapic_metadata.json new file mode 100644 index 0000000..aee2228 --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/gapic_metadata.json @@ -0,0 +1,42 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.api.apikeys.v2", + "libraryPackage": "com.google.api.apikeys.v2", + "services": { + "ApiKeys": { + "clients": { + "grpc": { + "libraryClient": "ApiKeysClient", + "rpcs": { + "CreateKey": { + "methods": ["createKeyAsync", "createKeyAsync", "createKeyAsync", "createKeyOperationCallable", "createKeyCallable"] + }, + "DeleteKey": { + "methods": ["deleteKeyAsync", "deleteKeyAsync", "deleteKeyAsync", "deleteKeyOperationCallable", "deleteKeyCallable"] + }, + "GetKey": { + "methods": ["getKey", "getKey", "getKey", "getKeyCallable"] + }, + "GetKeyString": { + "methods": ["getKeyString", "getKeyString", "getKeyString", "getKeyStringCallable"] + }, + "ListKeys": { + "methods": ["listKeys", "listKeys", "listKeys", "listKeysPagedCallable", "listKeysCallable"] + }, + "LookupKey": { + "methods": ["lookupKey", "lookupKeyCallable"] + }, + "UndeleteKey": { + "methods": ["undeleteKeyAsync", "undeleteKeyOperationCallable", "undeleteKeyCallable"] + }, + "UpdateKey": { + "methods": ["updateKeyAsync", "updateKeyAsync", "updateKeyOperationCallable", "updateKeyCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/package-info.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/package-info.java new file mode 100644 index 0000000..feea953 --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/package-info.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 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 + * + * https://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. + */ + +/** + * A client to API Keys API + * + *

The interfaces provided are listed below, along with usage samples. + * + *

======================= ApiKeysClient ======================= + * + *

Service Description: Manages the API keys associated with projects. + * + *

Sample for ApiKeysClient: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (ApiKeysClient apiKeysClient = ApiKeysClient.create()) {
+ *   KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]");
+ *   Key response = apiKeysClient.getKey(name);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.api.apikeys.v2; + +import javax.annotation.Generated; diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStub.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStub.java new file mode 100644 index 0000000..a7ed239 --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStub.java @@ -0,0 +1,112 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2.stub; + +import static com.google.api.apikeys.v2.ApiKeysClient.ListKeysPagedResponse; + +import com.google.api.apikeys.v2.CreateKeyRequest; +import com.google.api.apikeys.v2.DeleteKeyRequest; +import com.google.api.apikeys.v2.GetKeyRequest; +import com.google.api.apikeys.v2.GetKeyStringRequest; +import com.google.api.apikeys.v2.GetKeyStringResponse; +import com.google.api.apikeys.v2.Key; +import com.google.api.apikeys.v2.ListKeysRequest; +import com.google.api.apikeys.v2.ListKeysResponse; +import com.google.api.apikeys.v2.LookupKeyRequest; +import com.google.api.apikeys.v2.LookupKeyResponse; +import com.google.api.apikeys.v2.UndeleteKeyRequest; +import com.google.api.apikeys.v2.UpdateKeyRequest; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the ApiKeys service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class ApiKeysStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; + } + + public OperationCallable createKeyOperationCallable() { + throw new UnsupportedOperationException("Not implemented: createKeyOperationCallable()"); + } + + public UnaryCallable createKeyCallable() { + throw new UnsupportedOperationException("Not implemented: createKeyCallable()"); + } + + public UnaryCallable listKeysPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listKeysPagedCallable()"); + } + + public UnaryCallable listKeysCallable() { + throw new UnsupportedOperationException("Not implemented: listKeysCallable()"); + } + + public UnaryCallable getKeyCallable() { + throw new UnsupportedOperationException("Not implemented: getKeyCallable()"); + } + + public UnaryCallable getKeyStringCallable() { + throw new UnsupportedOperationException("Not implemented: getKeyStringCallable()"); + } + + public OperationCallable updateKeyOperationCallable() { + throw new UnsupportedOperationException("Not implemented: updateKeyOperationCallable()"); + } + + public UnaryCallable updateKeyCallable() { + throw new UnsupportedOperationException("Not implemented: updateKeyCallable()"); + } + + public OperationCallable deleteKeyOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteKeyOperationCallable()"); + } + + public UnaryCallable deleteKeyCallable() { + throw new UnsupportedOperationException("Not implemented: deleteKeyCallable()"); + } + + public OperationCallable undeleteKeyOperationCallable() { + throw new UnsupportedOperationException("Not implemented: undeleteKeyOperationCallable()"); + } + + public UnaryCallable undeleteKeyCallable() { + throw new UnsupportedOperationException("Not implemented: undeleteKeyCallable()"); + } + + public UnaryCallable lookupKeyCallable() { + throw new UnsupportedOperationException("Not implemented: lookupKeyCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStubSettings.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStubSettings.java new file mode 100644 index 0000000..ea9af67 --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStubSettings.java @@ -0,0 +1,722 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2.stub; + +import static com.google.api.apikeys.v2.ApiKeysClient.ListKeysPagedResponse; + +import com.google.api.apikeys.v2.CreateKeyRequest; +import com.google.api.apikeys.v2.DeleteKeyRequest; +import com.google.api.apikeys.v2.GetKeyRequest; +import com.google.api.apikeys.v2.GetKeyStringRequest; +import com.google.api.apikeys.v2.GetKeyStringResponse; +import com.google.api.apikeys.v2.Key; +import com.google.api.apikeys.v2.ListKeysRequest; +import com.google.api.apikeys.v2.ListKeysResponse; +import com.google.api.apikeys.v2.LookupKeyRequest; +import com.google.api.apikeys.v2.LookupKeyResponse; +import com.google.api.apikeys.v2.UndeleteKeyRequest; +import com.google.api.apikeys.v2.UpdateKeyRequest; +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Settings class to configure an instance of {@link ApiKeysStub}. + * + *

The default instance has everything set to sensible defaults: + * + *

    + *
  • The default service address (apikeys.googleapis.com) and default port (443) are used. + *
  • Credentials are acquired automatically through Application Default Credentials. + *
  • Retries are configured for idempotent methods but not for non-idempotent methods. + *
+ * + *

The builder of this class is recursive, so contained classes are themselves builders. When + * build() is called, the tree of builders is called to create the complete settings object. + * + *

For example, to set the total timeout of getKey to 30 seconds: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ApiKeysStubSettings.Builder apiKeysSettingsBuilder = ApiKeysStubSettings.newBuilder();
+ * apiKeysSettingsBuilder
+ *     .getKeySettings()
+ *     .setRetrySettings(
+ *         apiKeysSettingsBuilder
+ *             .getKeySettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * ApiKeysStubSettings apiKeysSettings = apiKeysSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class ApiKeysStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder() + .add("https://www.googleapis.com/auth/cloud-platform") + .add("https://www.googleapis.com/auth/cloud-platform.read-only") + .build(); + + private final UnaryCallSettings createKeySettings; + private final OperationCallSettings createKeyOperationSettings; + private final PagedCallSettings + listKeysSettings; + private final UnaryCallSettings getKeySettings; + private final UnaryCallSettings getKeyStringSettings; + private final UnaryCallSettings updateKeySettings; + private final OperationCallSettings updateKeyOperationSettings; + private final UnaryCallSettings deleteKeySettings; + private final OperationCallSettings deleteKeyOperationSettings; + private final UnaryCallSettings undeleteKeySettings; + private final OperationCallSettings undeleteKeyOperationSettings; + private final UnaryCallSettings lookupKeySettings; + + private static final PagedListDescriptor + LIST_KEYS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListKeysRequest injectToken(ListKeysRequest payload, String token) { + return ListKeysRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListKeysRequest injectPageSize(ListKeysRequest payload, int pageSize) { + return ListKeysRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListKeysRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListKeysResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListKeysResponse payload) { + return payload.getKeysList() == null + ? ImmutableList.of() + : payload.getKeysList(); + } + }; + + private static final PagedListResponseFactory< + ListKeysRequest, ListKeysResponse, ListKeysPagedResponse> + LIST_KEYS_PAGE_STR_FACT = + new PagedListResponseFactory() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListKeysRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_KEYS_PAGE_STR_DESC, request, context); + return ListKeysPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to createKey. */ + public UnaryCallSettings createKeySettings() { + return createKeySettings; + } + + /** Returns the object with the settings used for calls to createKey. */ + public OperationCallSettings createKeyOperationSettings() { + return createKeyOperationSettings; + } + + /** Returns the object with the settings used for calls to listKeys. */ + public PagedCallSettings + listKeysSettings() { + return listKeysSettings; + } + + /** Returns the object with the settings used for calls to getKey. */ + public UnaryCallSettings getKeySettings() { + return getKeySettings; + } + + /** Returns the object with the settings used for calls to getKeyString. */ + public UnaryCallSettings getKeyStringSettings() { + return getKeyStringSettings; + } + + /** Returns the object with the settings used for calls to updateKey. */ + public UnaryCallSettings updateKeySettings() { + return updateKeySettings; + } + + /** Returns the object with the settings used for calls to updateKey. */ + public OperationCallSettings updateKeyOperationSettings() { + return updateKeyOperationSettings; + } + + /** Returns the object with the settings used for calls to deleteKey. */ + public UnaryCallSettings deleteKeySettings() { + return deleteKeySettings; + } + + /** Returns the object with the settings used for calls to deleteKey. */ + public OperationCallSettings deleteKeyOperationSettings() { + return deleteKeyOperationSettings; + } + + /** Returns the object with the settings used for calls to undeleteKey. */ + public UnaryCallSettings undeleteKeySettings() { + return undeleteKeySettings; + } + + /** Returns the object with the settings used for calls to undeleteKey. */ + public OperationCallSettings undeleteKeyOperationSettings() { + return undeleteKeyOperationSettings; + } + + /** Returns the object with the settings used for calls to lookupKey. */ + public UnaryCallSettings lookupKeySettings() { + return lookupKeySettings; + } + + public ApiKeysStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcApiKeysStub.create(this); + } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonApiKeysStub.create(this); + } + throw new UnsupportedOperationException( + String.format( + "Transport not supported: %s", getTransportChannelProvider().getTransportName())); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return InstantiatingExecutorProvider.newBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return "apikeys.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "apikeys.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder() + .setScopesToApply(DEFAULT_SERVICE_SCOPES) + .setUseJwtAccessWithScope(true); + } + + /** Returns a builder for the default gRPC ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(ApiKeysStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(ApiKeysStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiKeysStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected ApiKeysStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createKeySettings = settingsBuilder.createKeySettings().build(); + createKeyOperationSettings = settingsBuilder.createKeyOperationSettings().build(); + listKeysSettings = settingsBuilder.listKeysSettings().build(); + getKeySettings = settingsBuilder.getKeySettings().build(); + getKeyStringSettings = settingsBuilder.getKeyStringSettings().build(); + updateKeySettings = settingsBuilder.updateKeySettings().build(); + updateKeyOperationSettings = settingsBuilder.updateKeyOperationSettings().build(); + deleteKeySettings = settingsBuilder.deleteKeySettings().build(); + deleteKeyOperationSettings = settingsBuilder.deleteKeyOperationSettings().build(); + undeleteKeySettings = settingsBuilder.undeleteKeySettings().build(); + undeleteKeyOperationSettings = settingsBuilder.undeleteKeyOperationSettings().build(); + lookupKeySettings = settingsBuilder.lookupKeySettings().build(); + } + + /** Builder for ApiKeysStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder createKeySettings; + private final OperationCallSettings.Builder + createKeyOperationSettings; + private final PagedCallSettings.Builder< + ListKeysRequest, ListKeysResponse, ListKeysPagedResponse> + listKeysSettings; + private final UnaryCallSettings.Builder getKeySettings; + private final UnaryCallSettings.Builder + getKeyStringSettings; + private final UnaryCallSettings.Builder updateKeySettings; + private final OperationCallSettings.Builder + updateKeyOperationSettings; + private final UnaryCallSettings.Builder deleteKeySettings; + private final OperationCallSettings.Builder + deleteKeyOperationSettings; + private final UnaryCallSettings.Builder undeleteKeySettings; + private final OperationCallSettings.Builder + undeleteKeyOperationSettings; + private final UnaryCallSettings.Builder lookupKeySettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRpcTimeout(Duration.ofMillis(10000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(10000L)) + .setTotalTimeout(Duration.ofMillis(10000L)) + .build(); + definitions.put("no_retry_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createKeyOperationSettings = OperationCallSettings.newBuilder(); + listKeysSettings = PagedCallSettings.newBuilder(LIST_KEYS_PAGE_STR_FACT); + getKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + getKeyStringSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateKeyOperationSettings = OperationCallSettings.newBuilder(); + deleteKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteKeyOperationSettings = OperationCallSettings.newBuilder(); + undeleteKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + undeleteKeyOperationSettings = OperationCallSettings.newBuilder(); + lookupKeySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createKeySettings, + listKeysSettings, + getKeySettings, + getKeyStringSettings, + updateKeySettings, + deleteKeySettings, + undeleteKeySettings, + lookupKeySettings); + initDefaults(this); + } + + protected Builder(ApiKeysStubSettings settings) { + super(settings); + + createKeySettings = settings.createKeySettings.toBuilder(); + createKeyOperationSettings = settings.createKeyOperationSettings.toBuilder(); + listKeysSettings = settings.listKeysSettings.toBuilder(); + getKeySettings = settings.getKeySettings.toBuilder(); + getKeyStringSettings = settings.getKeyStringSettings.toBuilder(); + updateKeySettings = settings.updateKeySettings.toBuilder(); + updateKeyOperationSettings = settings.updateKeyOperationSettings.toBuilder(); + deleteKeySettings = settings.deleteKeySettings.toBuilder(); + deleteKeyOperationSettings = settings.deleteKeyOperationSettings.toBuilder(); + undeleteKeySettings = settings.undeleteKeySettings.toBuilder(); + undeleteKeyOperationSettings = settings.undeleteKeyOperationSettings.toBuilder(); + lookupKeySettings = settings.lookupKeySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createKeySettings, + listKeysSettings, + getKeySettings, + getKeyStringSettings, + updateKeySettings, + deleteKeySettings, + undeleteKeySettings, + lookupKeySettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .createKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); + + builder + .listKeysSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); + + builder + .getKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); + + builder + .getKeyStringSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); + + builder + .updateKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); + + builder + .deleteKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); + + builder + .undeleteKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); + + builder + .lookupKeySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); + + builder + .createKeyOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")) + .build()) + .setResponseTransformer(ProtoOperationTransformers.ResponseTransformer.create(Key.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(Empty.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .updateKeyOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")) + .build()) + .setResponseTransformer(ProtoOperationTransformers.ResponseTransformer.create(Key.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(Empty.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .deleteKeyOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")) + .build()) + .setResponseTransformer(ProtoOperationTransformers.ResponseTransformer.create(Key.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(Empty.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .undeleteKeyOperationSettings() + .setInitialCallSettings( + UnaryCallSettings.newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")) + .build()) + .setResponseTransformer(ProtoOperationTransformers.ResponseTransformer.create(Key.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(Empty.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createKey. */ + public UnaryCallSettings.Builder createKeySettings() { + return createKeySettings; + } + + /** Returns the builder for the settings used for calls to createKey. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createKeyOperationSettings() { + return createKeyOperationSettings; + } + + /** Returns the builder for the settings used for calls to listKeys. */ + public PagedCallSettings.Builder + listKeysSettings() { + return listKeysSettings; + } + + /** Returns the builder for the settings used for calls to getKey. */ + public UnaryCallSettings.Builder getKeySettings() { + return getKeySettings; + } + + /** Returns the builder for the settings used for calls to getKeyString. */ + public UnaryCallSettings.Builder + getKeyStringSettings() { + return getKeyStringSettings; + } + + /** Returns the builder for the settings used for calls to updateKey. */ + public UnaryCallSettings.Builder updateKeySettings() { + return updateKeySettings; + } + + /** Returns the builder for the settings used for calls to updateKey. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateKeyOperationSettings() { + return updateKeyOperationSettings; + } + + /** Returns the builder for the settings used for calls to deleteKey. */ + public UnaryCallSettings.Builder deleteKeySettings() { + return deleteKeySettings; + } + + /** Returns the builder for the settings used for calls to deleteKey. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteKeyOperationSettings() { + return deleteKeyOperationSettings; + } + + /** Returns the builder for the settings used for calls to undeleteKey. */ + public UnaryCallSettings.Builder undeleteKeySettings() { + return undeleteKeySettings; + } + + /** Returns the builder for the settings used for calls to undeleteKey. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + undeleteKeyOperationSettings() { + return undeleteKeyOperationSettings; + } + + /** Returns the builder for the settings used for calls to lookupKey. */ + public UnaryCallSettings.Builder lookupKeySettings() { + return lookupKeySettings; + } + + @Override + public ApiKeysStubSettings build() throws IOException { + return new ApiKeysStubSettings(this); + } + } +} diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysCallableFactory.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysCallableFactory.java new file mode 100644 index 0000000..05ff6df --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysCallableFactory.java @@ -0,0 +1,113 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2.stub; + +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcCallableFactory; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.BidiStreamingCallable; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientStreamingCallable; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.StreamingCallSettings; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC callable factory implementation for the ApiKeys service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcApiKeysCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysStub.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysStub.java new file mode 100644 index 0000000..03e9ad8 --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysStub.java @@ -0,0 +1,414 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2.stub; + +import static com.google.api.apikeys.v2.ApiKeysClient.ListKeysPagedResponse; + +import com.google.api.apikeys.v2.CreateKeyRequest; +import com.google.api.apikeys.v2.DeleteKeyRequest; +import com.google.api.apikeys.v2.GetKeyRequest; +import com.google.api.apikeys.v2.GetKeyStringRequest; +import com.google.api.apikeys.v2.GetKeyStringResponse; +import com.google.api.apikeys.v2.Key; +import com.google.api.apikeys.v2.ListKeysRequest; +import com.google.api.apikeys.v2.ListKeysResponse; +import com.google.api.apikeys.v2.LookupKeyRequest; +import com.google.api.apikeys.v2.LookupKeyResponse; +import com.google.api.apikeys.v2.UndeleteKeyRequest; +import com.google.api.apikeys.v2.UpdateKeyRequest; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the ApiKeys service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcApiKeysStub extends ApiKeysStub { + private static final MethodDescriptor createKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.apikeys.v2.ApiKeys/CreateKey") + .setRequestMarshaller(ProtoUtils.marshaller(CreateKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listKeysMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.apikeys.v2.ApiKeys/ListKeys") + .setRequestMarshaller(ProtoUtils.marshaller(ListKeysRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ListKeysResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.apikeys.v2.ApiKeys/GetKey") + .setRequestMarshaller(ProtoUtils.marshaller(GetKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Key.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + getKeyStringMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.apikeys.v2.ApiKeys/GetKeyString") + .setRequestMarshaller(ProtoUtils.marshaller(GetKeyStringRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(GetKeyStringResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor updateKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.apikeys.v2.ApiKeys/UpdateKey") + .setRequestMarshaller(ProtoUtils.marshaller(UpdateKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor deleteKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.apikeys.v2.ApiKeys/DeleteKey") + .setRequestMarshaller(ProtoUtils.marshaller(DeleteKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor undeleteKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.apikeys.v2.ApiKeys/UndeleteKey") + .setRequestMarshaller(ProtoUtils.marshaller(UndeleteKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + lookupKeyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.api.apikeys.v2.ApiKeys/LookupKey") + .setRequestMarshaller(ProtoUtils.marshaller(LookupKeyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(LookupKeyResponse.getDefaultInstance())) + .build(); + + private final UnaryCallable createKeyCallable; + private final OperationCallable createKeyOperationCallable; + private final UnaryCallable listKeysCallable; + private final UnaryCallable listKeysPagedCallable; + private final UnaryCallable getKeyCallable; + private final UnaryCallable getKeyStringCallable; + private final UnaryCallable updateKeyCallable; + private final OperationCallable updateKeyOperationCallable; + private final UnaryCallable deleteKeyCallable; + private final OperationCallable deleteKeyOperationCallable; + private final UnaryCallable undeleteKeyCallable; + private final OperationCallable undeleteKeyOperationCallable; + private final UnaryCallable lookupKeyCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcApiKeysStub create(ApiKeysStubSettings settings) throws IOException { + return new GrpcApiKeysStub(settings, ClientContext.create(settings)); + } + + public static final GrpcApiKeysStub create(ClientContext clientContext) throws IOException { + return new GrpcApiKeysStub(ApiKeysStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcApiKeysStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcApiKeysStub( + ApiKeysStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcApiKeysStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected GrpcApiKeysStub(ApiKeysStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcApiKeysCallableFactory()); + } + + /** + * Constructs an instance of GrpcApiKeysStub, using the given settings. This is protected so that + * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. + */ + protected GrpcApiKeysStub( + ApiKeysStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings createKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createKeyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings listKeysTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listKeysMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + }) + .build(); + GrpcCallSettings getKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getKeyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings getKeyStringTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getKeyStringMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings updateKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateKeyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("key.name", String.valueOf(request.getKey().getName())); + return params.build(); + }) + .build(); + GrpcCallSettings deleteKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteKeyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings undeleteKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(undeleteKeyMethodDescriptor) + .setParamsExtractor( + request -> { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + }) + .build(); + GrpcCallSettings lookupKeyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(lookupKeyMethodDescriptor) + .build(); + + this.createKeyCallable = + callableFactory.createUnaryCallable( + createKeyTransportSettings, settings.createKeySettings(), clientContext); + this.createKeyOperationCallable = + callableFactory.createOperationCallable( + createKeyTransportSettings, + settings.createKeyOperationSettings(), + clientContext, + operationsStub); + this.listKeysCallable = + callableFactory.createUnaryCallable( + listKeysTransportSettings, settings.listKeysSettings(), clientContext); + this.listKeysPagedCallable = + callableFactory.createPagedCallable( + listKeysTransportSettings, settings.listKeysSettings(), clientContext); + this.getKeyCallable = + callableFactory.createUnaryCallable( + getKeyTransportSettings, settings.getKeySettings(), clientContext); + this.getKeyStringCallable = + callableFactory.createUnaryCallable( + getKeyStringTransportSettings, settings.getKeyStringSettings(), clientContext); + this.updateKeyCallable = + callableFactory.createUnaryCallable( + updateKeyTransportSettings, settings.updateKeySettings(), clientContext); + this.updateKeyOperationCallable = + callableFactory.createOperationCallable( + updateKeyTransportSettings, + settings.updateKeyOperationSettings(), + clientContext, + operationsStub); + this.deleteKeyCallable = + callableFactory.createUnaryCallable( + deleteKeyTransportSettings, settings.deleteKeySettings(), clientContext); + this.deleteKeyOperationCallable = + callableFactory.createOperationCallable( + deleteKeyTransportSettings, + settings.deleteKeyOperationSettings(), + clientContext, + operationsStub); + this.undeleteKeyCallable = + callableFactory.createUnaryCallable( + undeleteKeyTransportSettings, settings.undeleteKeySettings(), clientContext); + this.undeleteKeyOperationCallable = + callableFactory.createOperationCallable( + undeleteKeyTransportSettings, + settings.undeleteKeyOperationSettings(), + clientContext, + operationsStub); + this.lookupKeyCallable = + callableFactory.createUnaryCallable( + lookupKeyTransportSettings, settings.lookupKeySettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable createKeyCallable() { + return createKeyCallable; + } + + @Override + public OperationCallable createKeyOperationCallable() { + return createKeyOperationCallable; + } + + @Override + public UnaryCallable listKeysCallable() { + return listKeysCallable; + } + + @Override + public UnaryCallable listKeysPagedCallable() { + return listKeysPagedCallable; + } + + @Override + public UnaryCallable getKeyCallable() { + return getKeyCallable; + } + + @Override + public UnaryCallable getKeyStringCallable() { + return getKeyStringCallable; + } + + @Override + public UnaryCallable updateKeyCallable() { + return updateKeyCallable; + } + + @Override + public OperationCallable updateKeyOperationCallable() { + return updateKeyOperationCallable; + } + + @Override + public UnaryCallable deleteKeyCallable() { + return deleteKeyCallable; + } + + @Override + public OperationCallable deleteKeyOperationCallable() { + return deleteKeyOperationCallable; + } + + @Override + public UnaryCallable undeleteKeyCallable() { + return undeleteKeyCallable; + } + + @Override + public OperationCallable undeleteKeyOperationCallable() { + return undeleteKeyOperationCallable; + } + + @Override + public UnaryCallable lookupKeyCallable() { + return lookupKeyCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysCallableFactory.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysCallableFactory.java new file mode 100644 index 0000000..2c4b2a2 --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the ApiKeys service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonApiKeysCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysStub.java b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysStub.java new file mode 100644 index 0000000..b4e267d --- /dev/null +++ b/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysStub.java @@ -0,0 +1,626 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2.stub; + +import static com.google.api.apikeys.v2.ApiKeysClient.ListKeysPagedResponse; + +import com.google.api.apikeys.v2.CreateKeyRequest; +import com.google.api.apikeys.v2.DeleteKeyRequest; +import com.google.api.apikeys.v2.GetKeyRequest; +import com.google.api.apikeys.v2.GetKeyStringRequest; +import com.google.api.apikeys.v2.GetKeyStringResponse; +import com.google.api.apikeys.v2.Key; +import com.google.api.apikeys.v2.ListKeysRequest; +import com.google.api.apikeys.v2.ListKeysResponse; +import com.google.api.apikeys.v2.LookupKeyRequest; +import com.google.api.apikeys.v2.LookupKeyResponse; +import com.google.api.apikeys.v2.UndeleteKeyRequest; +import com.google.api.apikeys.v2.UpdateKeyRequest; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the ApiKeys service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonApiKeysStub extends ApiKeysStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder().add(Empty.getDescriptor()).add(Key.getDescriptor()).build(); + + private static final ApiMethodDescriptor createKeyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.api.apikeys.v2.ApiKeys/CreateKey") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/keys", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "keyId", request.getKeyId()); + return fields; + }) + .setRequestBodyExtractor( + request -> ProtoRestSerializer.create().toBody("key", request.getKey())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateKeyRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + listKeysMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.api.apikeys.v2.ApiKeys/ListKeys") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{parent=projects/*/locations/*}/keys", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListKeysResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor getKeyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.api.apikeys.v2.ApiKeys/GetKey") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/keys/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Key.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getKeyStringMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.api.apikeys.v2.ApiKeys/GetKeyString") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/keys/*}/keyString", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GetKeyStringResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor updateKeyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.api.apikeys.v2.ApiKeys/UpdateKey") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{key.name=projects/*/locations/*/keys/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "key.name", request.getKey().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> ProtoRestSerializer.create().toBody("key", request.getKey())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UpdateKeyRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor deleteKeyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.api.apikeys.v2.ApiKeys/DeleteKey") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/keys/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "etag", request.getEtag()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteKeyRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + undeleteKeyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.api.apikeys.v2.ApiKeys/UndeleteKey") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/{name=projects/*/locations/*/keys/*}:undelete", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UndeleteKeyRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + lookupKeyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.api.apikeys.v2.ApiKeys/LookupKey") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v2/keys:lookupKey", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "keyString", request.getKeyString()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(LookupKeyResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createKeyCallable; + private final OperationCallable createKeyOperationCallable; + private final UnaryCallable listKeysCallable; + private final UnaryCallable listKeysPagedCallable; + private final UnaryCallable getKeyCallable; + private final UnaryCallable getKeyStringCallable; + private final UnaryCallable updateKeyCallable; + private final OperationCallable updateKeyOperationCallable; + private final UnaryCallable deleteKeyCallable; + private final OperationCallable deleteKeyOperationCallable; + private final UnaryCallable undeleteKeyCallable; + private final OperationCallable undeleteKeyOperationCallable; + private final UnaryCallable lookupKeyCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonApiKeysStub create(ApiKeysStubSettings settings) throws IOException { + return new HttpJsonApiKeysStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonApiKeysStub create(ClientContext clientContext) throws IOException { + return new HttpJsonApiKeysStub(ApiKeysStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonApiKeysStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonApiKeysStub( + ApiKeysStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of HttpJsonApiKeysStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonApiKeysStub(ApiKeysStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new HttpJsonApiKeysCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonApiKeysStub, using the given settings. This is protected so + * that it is easy to make a subclass, but otherwise, the static factory methods should be + * preferred. + */ + protected HttpJsonApiKeysStub( + ApiKeysStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings createKeyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createKeyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listKeysTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listKeysMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getKeyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getKeyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getKeyStringTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getKeyStringMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateKeyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateKeyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteKeyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteKeyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings undeleteKeyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(undeleteKeyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings lookupKeyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(lookupKeyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createKeyCallable = + callableFactory.createUnaryCallable( + createKeyTransportSettings, settings.createKeySettings(), clientContext); + this.createKeyOperationCallable = + callableFactory.createOperationCallable( + createKeyTransportSettings, + settings.createKeyOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.listKeysCallable = + callableFactory.createUnaryCallable( + listKeysTransportSettings, settings.listKeysSettings(), clientContext); + this.listKeysPagedCallable = + callableFactory.createPagedCallable( + listKeysTransportSettings, settings.listKeysSettings(), clientContext); + this.getKeyCallable = + callableFactory.createUnaryCallable( + getKeyTransportSettings, settings.getKeySettings(), clientContext); + this.getKeyStringCallable = + callableFactory.createUnaryCallable( + getKeyStringTransportSettings, settings.getKeyStringSettings(), clientContext); + this.updateKeyCallable = + callableFactory.createUnaryCallable( + updateKeyTransportSettings, settings.updateKeySettings(), clientContext); + this.updateKeyOperationCallable = + callableFactory.createOperationCallable( + updateKeyTransportSettings, + settings.updateKeyOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deleteKeyCallable = + callableFactory.createUnaryCallable( + deleteKeyTransportSettings, settings.deleteKeySettings(), clientContext); + this.deleteKeyOperationCallable = + callableFactory.createOperationCallable( + deleteKeyTransportSettings, + settings.deleteKeyOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.undeleteKeyCallable = + callableFactory.createUnaryCallable( + undeleteKeyTransportSettings, settings.undeleteKeySettings(), clientContext); + this.undeleteKeyOperationCallable = + callableFactory.createOperationCallable( + undeleteKeyTransportSettings, + settings.undeleteKeyOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.lookupKeyCallable = + callableFactory.createUnaryCallable( + lookupKeyTransportSettings, settings.lookupKeySettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createKeyMethodDescriptor); + methodDescriptors.add(listKeysMethodDescriptor); + methodDescriptors.add(getKeyMethodDescriptor); + methodDescriptors.add(getKeyStringMethodDescriptor); + methodDescriptors.add(updateKeyMethodDescriptor); + methodDescriptors.add(deleteKeyMethodDescriptor); + methodDescriptors.add(undeleteKeyMethodDescriptor); + methodDescriptors.add(lookupKeyMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable createKeyCallable() { + return createKeyCallable; + } + + @Override + public OperationCallable createKeyOperationCallable() { + return createKeyOperationCallable; + } + + @Override + public UnaryCallable listKeysCallable() { + return listKeysCallable; + } + + @Override + public UnaryCallable listKeysPagedCallable() { + return listKeysPagedCallable; + } + + @Override + public UnaryCallable getKeyCallable() { + return getKeyCallable; + } + + @Override + public UnaryCallable getKeyStringCallable() { + return getKeyStringCallable; + } + + @Override + public UnaryCallable updateKeyCallable() { + return updateKeyCallable; + } + + @Override + public OperationCallable updateKeyOperationCallable() { + return updateKeyOperationCallable; + } + + @Override + public UnaryCallable deleteKeyCallable() { + return deleteKeyCallable; + } + + @Override + public OperationCallable deleteKeyOperationCallable() { + return deleteKeyOperationCallable; + } + + @Override + public UnaryCallable undeleteKeyCallable() { + return undeleteKeyCallable; + } + + @Override + public OperationCallable undeleteKeyOperationCallable() { + return undeleteKeyOperationCallable; + } + + @Override + public UnaryCallable lookupKeyCallable() { + return lookupKeyCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientHttpJsonTest.java b/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientHttpJsonTest.java new file mode 100644 index 0000000..8763ba0 --- /dev/null +++ b/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientHttpJsonTest.java @@ -0,0 +1,804 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2; + +import static com.google.api.apikeys.v2.ApiKeysClient.ListKeysPagedResponse; + +import com.google.api.apikeys.v2.stub.HttpJsonApiKeysStub; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ApiKeysClientHttpJsonTest { + private static MockHttpService mockService; + private static ApiKeysClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonApiKeysStub.getMethodDescriptors(), ApiKeysSettings.getDefaultEndpoint()); + ApiKeysSettings settings = + ApiKeysSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + ApiKeysSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ApiKeysClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Key key = Key.newBuilder().build(); + String keyId = "keyId101944282"; + + Key actualResponse = client.createKeyAsync(parent, key, keyId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createKeyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Key key = Key.newBuilder().build(); + String keyId = "keyId101944282"; + client.createKeyAsync(parent, key, keyId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createKeyTest2() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + Key key = Key.newBuilder().build(); + String keyId = "keyId101944282"; + + Key actualResponse = client.createKeyAsync(parent, key, keyId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createKeyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Key key = Key.newBuilder().build(); + String keyId = "keyId101944282"; + client.createKeyAsync(parent, key, keyId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void listKeysTest() throws Exception { + Key responsesElement = Key.newBuilder().build(); + ListKeysResponse expectedResponse = + ListKeysResponse.newBuilder() + .setNextPageToken("") + .addAllKeys(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListKeysPagedResponse pagedListResponse = client.listKeys(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getKeysList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listKeysExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listKeys(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listKeysTest2() throws Exception { + Key responsesElement = Key.newBuilder().build(); + ListKeysResponse expectedResponse = + ListKeysResponse.newBuilder() + .setNextPageToken("") + .addAllKeys(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListKeysPagedResponse pagedListResponse = client.listKeys(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getKeysList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listKeysExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listKeys(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + + Key actualResponse = client.getKey(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getKeyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + client.getKey(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getKeyTest2() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-4172/locations/location-4172/keys/key-4172"; + + Key actualResponse = client.getKey(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getKeyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4172/locations/location-4172/keys/key-4172"; + client.getKey(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getKeyStringTest() throws Exception { + GetKeyStringResponse expectedResponse = + GetKeyStringResponse.newBuilder().setKeyString("keyString-1988270256").build(); + mockService.addResponse(expectedResponse); + + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + + GetKeyStringResponse actualResponse = client.getKeyString(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getKeyStringExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + client.getKeyString(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getKeyStringTest2() throws Exception { + GetKeyStringResponse expectedResponse = + GetKeyStringResponse.newBuilder().setKeyString("keyString-1988270256").build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-4172/locations/location-4172/keys/key-4172"; + + GetKeyStringResponse actualResponse = client.getKeyString(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getKeyStringExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4172/locations/location-4172/keys/key-4172"; + client.getKeyString(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + Key key = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Key actualResponse = client.updateKeyAsync(key, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateKeyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Key key = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateKeyAsync(key, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + + Key actualResponse = client.deleteKeyAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteKeyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + client.deleteKeyAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteKeyTest2() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-4172/locations/location-4172/keys/key-4172"; + + Key actualResponse = client.deleteKeyAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteKeyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-4172/locations/location-4172/keys/key-4172"; + client.deleteKeyAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeleteKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + UndeleteKeyRequest request = + UndeleteKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .build(); + + Key actualResponse = client.undeleteKeyAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeleteKeyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + UndeleteKeyRequest request = + UndeleteKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .build(); + client.undeleteKeyAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void lookupKeyTest() throws Exception { + LookupKeyResponse expectedResponse = + LookupKeyResponse.newBuilder().setParent("parent-995424086").setName("name3373707").build(); + mockService.addResponse(expectedResponse); + + LookupKeyRequest request = + LookupKeyRequest.newBuilder().setKeyString("keyString-1988270256").build(); + + LookupKeyResponse actualResponse = client.lookupKey(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void lookupKeyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LookupKeyRequest request = + LookupKeyRequest.newBuilder().setKeyString("keyString-1988270256").build(); + client.lookupKey(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientTest.java b/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientTest.java new file mode 100644 index 0000000..6f3b311 --- /dev/null +++ b/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientTest.java @@ -0,0 +1,730 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2; + +import static com.google.api.apikeys.v2.ApiKeysClient.ListKeysPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ApiKeysClientTest { + private static MockApiKeys mockApiKeys; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private ApiKeysClient client; + + @BeforeClass + public static void startStaticServer() { + mockApiKeys = new MockApiKeys(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockApiKeys)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + ApiKeysSettings settings = + ApiKeysSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ApiKeysClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockApiKeys.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Key key = Key.newBuilder().build(); + String keyId = "keyId101944282"; + + Key actualResponse = client.createKeyAsync(parent, key, keyId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateKeyRequest actualRequest = ((CreateKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(key, actualRequest.getKey()); + Assert.assertEquals(keyId, actualRequest.getKeyId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Key key = Key.newBuilder().build(); + String keyId = "keyId101944282"; + client.createKeyAsync(parent, key, keyId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createKeyTest2() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockApiKeys.addResponse(resultOperation); + + String parent = "parent-995424086"; + Key key = Key.newBuilder().build(); + String keyId = "keyId101944282"; + + Key actualResponse = client.createKeyAsync(parent, key, keyId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateKeyRequest actualRequest = ((CreateKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(key, actualRequest.getKey()); + Assert.assertEquals(keyId, actualRequest.getKeyId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createKeyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + String parent = "parent-995424086"; + Key key = Key.newBuilder().build(); + String keyId = "keyId101944282"; + client.createKeyAsync(parent, key, keyId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void listKeysTest() throws Exception { + Key responsesElement = Key.newBuilder().build(); + ListKeysResponse expectedResponse = + ListKeysResponse.newBuilder() + .setNextPageToken("") + .addAllKeys(Arrays.asList(responsesElement)) + .build(); + mockApiKeys.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListKeysPagedResponse pagedListResponse = client.listKeys(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getKeysList().get(0), resources.get(0)); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListKeysRequest actualRequest = ((ListKeysRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listKeysExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listKeys(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listKeysTest2() throws Exception { + Key responsesElement = Key.newBuilder().build(); + ListKeysResponse expectedResponse = + ListKeysResponse.newBuilder() + .setNextPageToken("") + .addAllKeys(Arrays.asList(responsesElement)) + .build(); + mockApiKeys.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListKeysPagedResponse pagedListResponse = client.listKeys(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getKeysList().get(0), resources.get(0)); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListKeysRequest actualRequest = ((ListKeysRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listKeysExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + String parent = "parent-995424086"; + client.listKeys(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + mockApiKeys.addResponse(expectedResponse); + + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + + Key actualResponse = client.getKey(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetKeyRequest actualRequest = ((GetKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + client.getKey(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getKeyTest2() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + mockApiKeys.addResponse(expectedResponse); + + String name = "name3373707"; + + Key actualResponse = client.getKey(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetKeyRequest actualRequest = ((GetKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getKeyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + String name = "name3373707"; + client.getKey(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getKeyStringTest() throws Exception { + GetKeyStringResponse expectedResponse = + GetKeyStringResponse.newBuilder().setKeyString("keyString-1988270256").build(); + mockApiKeys.addResponse(expectedResponse); + + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + + GetKeyStringResponse actualResponse = client.getKeyString(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetKeyStringRequest actualRequest = ((GetKeyStringRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getKeyStringExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + client.getKeyString(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getKeyStringTest2() throws Exception { + GetKeyStringResponse expectedResponse = + GetKeyStringResponse.newBuilder().setKeyString("keyString-1988270256").build(); + mockApiKeys.addResponse(expectedResponse); + + String name = "name3373707"; + + GetKeyStringResponse actualResponse = client.getKeyString(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetKeyStringRequest actualRequest = ((GetKeyStringRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getKeyStringExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + String name = "name3373707"; + client.getKeyString(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockApiKeys.addResponse(resultOperation); + + Key key = Key.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Key actualResponse = client.updateKeyAsync(key, updateMask).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateKeyRequest actualRequest = ((UpdateKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(key, actualRequest.getKey()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + Key key = Key.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateKeyAsync(key, updateMask).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockApiKeys.addResponse(resultOperation); + + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + + Key actualResponse = client.deleteKeyAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteKeyRequest actualRequest = ((DeleteKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + KeyName name = KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]"); + client.deleteKeyAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteKeyTest2() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockApiKeys.addResponse(resultOperation); + + String name = "name3373707"; + + Key actualResponse = client.deleteKeyAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteKeyRequest actualRequest = ((DeleteKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteKeyExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + String name = "name3373707"; + client.deleteKeyAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void undeleteKeyTest() throws Exception { + Key expectedResponse = + Key.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .setUid("uid115792") + .setDisplayName("displayName1714148973") + .setKeyString("keyString-1988270256") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDeleteTime(Timestamp.newBuilder().build()) + .putAllAnnotations(new HashMap()) + .setRestrictions(Restrictions.newBuilder().build()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeleteKeyTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockApiKeys.addResponse(resultOperation); + + UndeleteKeyRequest request = + UndeleteKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .build(); + + Key actualResponse = client.undeleteKeyAsync(request).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UndeleteKeyRequest actualRequest = ((UndeleteKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getName(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void undeleteKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + UndeleteKeyRequest request = + UndeleteKeyRequest.newBuilder() + .setName(KeyName.of("[PROJECT]", "[LOCATION]", "[KEY]").toString()) + .build(); + client.undeleteKeyAsync(request).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void lookupKeyTest() throws Exception { + LookupKeyResponse expectedResponse = + LookupKeyResponse.newBuilder().setParent("parent-995424086").setName("name3373707").build(); + mockApiKeys.addResponse(expectedResponse); + + LookupKeyRequest request = + LookupKeyRequest.newBuilder().setKeyString("keyString-1988270256").build(); + + LookupKeyResponse actualResponse = client.lookupKey(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockApiKeys.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + LookupKeyRequest actualRequest = ((LookupKeyRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getKeyString(), actualRequest.getKeyString()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void lookupKeyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockApiKeys.addException(exception); + + try { + LookupKeyRequest request = + LookupKeyRequest.newBuilder().setKeyString("keyString-1988270256").build(); + client.lookupKey(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeys.java b/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeys.java new file mode 100644 index 0000000..70b23d6 --- /dev/null +++ b/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeys.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockApiKeys implements MockGrpcService { + private final MockApiKeysImpl serviceImpl; + + public MockApiKeys() { + serviceImpl = new MockApiKeysImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeysImpl.java b/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeysImpl.java new file mode 100644 index 0000000..26a5b95 --- /dev/null +++ b/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeysImpl.java @@ -0,0 +1,223 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2; + +import com.google.api.apikeys.v2.ApiKeysGrpc.ApiKeysImplBase; +import com.google.api.core.BetaApi; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockApiKeysImpl extends ApiKeysImplBase { + private List requests; + private Queue responses; + + public MockApiKeysImpl() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + public List getRequests() { + return requests; + } + + public void addResponse(AbstractMessage response) { + responses.add(response); + } + + public void setResponses(List responses) { + this.responses = new LinkedList(responses); + } + + public void addException(Exception exception) { + responses.add(exception); + } + + public void reset() { + requests = new ArrayList<>(); + responses = new LinkedList<>(); + } + + @Override + public void createKey(CreateKeyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) 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 CreateKey, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listKeys(ListKeysRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListKeysResponse) { + requests.add(request); + responseObserver.onNext(((ListKeysResponse) 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 ListKeys, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListKeysResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getKey(GetKeyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Key) { + requests.add(request); + responseObserver.onNext(((Key) 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 GetKey, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Key.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getKeyString( + GetKeyStringRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof GetKeyStringResponse) { + requests.add(request); + responseObserver.onNext(((GetKeyStringResponse) 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 GetKeyString, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + GetKeyStringResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateKey(UpdateKeyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) 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 UpdateKey, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteKey(DeleteKeyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) 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 DeleteKey, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void undeleteKey(UndeleteKeyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) 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 UndeleteKey, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void lookupKey( + LookupKeyRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof LookupKeyResponse) { + requests.add(request); + responseObserver.onNext(((LookupKeyResponse) 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 LookupKey, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + LookupKeyResponse.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/grpc-google-cloud-apikeys-v2/pom.xml b/grpc-google-cloud-apikeys-v2/pom.xml new file mode 100644 index 0000000..59b6a63 --- /dev/null +++ b/grpc-google-cloud-apikeys-v2/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-apikeys-v2 + 0.0.1-SNAPSHOT + grpc-google-cloud-apikeys-v2 + GRPC library for google-cloud-apikeys + + com.google.cloud + google-cloud-apikeys-parent + 0.0.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-cloud-apikeys-v2 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/grpc-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysGrpc.java b/grpc-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysGrpc.java new file mode 100644 index 0000000..a631353 --- /dev/null +++ b/grpc-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysGrpc.java @@ -0,0 +1,1195 @@ +/* + * Copyright 2020 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 + * + * https://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.api.apikeys.v2; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Manages the API keys associated with projects.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/api/apikeys/v2/apikeys.proto") +@io.grpc.stub.annotations.GrpcGenerated +public final class ApiKeysGrpc { + + private ApiKeysGrpc() {} + + public static final String SERVICE_NAME = "google.api.apikeys.v2.ApiKeys"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.CreateKeyRequest, com.google.longrunning.Operation> + getCreateKeyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateKey", + requestType = com.google.api.apikeys.v2.CreateKeyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.CreateKeyRequest, com.google.longrunning.Operation> + getCreateKeyMethod() { + io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.CreateKeyRequest, com.google.longrunning.Operation> + getCreateKeyMethod; + if ((getCreateKeyMethod = ApiKeysGrpc.getCreateKeyMethod) == null) { + synchronized (ApiKeysGrpc.class) { + if ((getCreateKeyMethod = ApiKeysGrpc.getCreateKeyMethod) == null) { + ApiKeysGrpc.getCreateKeyMethod = + getCreateKeyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.CreateKeyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new ApiKeysMethodDescriptorSupplier("CreateKey")) + .build(); + } + } + } + return getCreateKeyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.ListKeysRequest, com.google.api.apikeys.v2.ListKeysResponse> + getListKeysMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListKeys", + requestType = com.google.api.apikeys.v2.ListKeysRequest.class, + responseType = com.google.api.apikeys.v2.ListKeysResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.ListKeysRequest, com.google.api.apikeys.v2.ListKeysResponse> + getListKeysMethod() { + io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.ListKeysRequest, com.google.api.apikeys.v2.ListKeysResponse> + getListKeysMethod; + if ((getListKeysMethod = ApiKeysGrpc.getListKeysMethod) == null) { + synchronized (ApiKeysGrpc.class) { + if ((getListKeysMethod = ApiKeysGrpc.getListKeysMethod) == null) { + ApiKeysGrpc.getListKeysMethod = + getListKeysMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListKeys")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.ListKeysRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.ListKeysResponse.getDefaultInstance())) + .setSchemaDescriptor(new ApiKeysMethodDescriptorSupplier("ListKeys")) + .build(); + } + } + } + return getListKeysMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.GetKeyRequest, com.google.api.apikeys.v2.Key> + getGetKeyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetKey", + requestType = com.google.api.apikeys.v2.GetKeyRequest.class, + responseType = com.google.api.apikeys.v2.Key.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.GetKeyRequest, com.google.api.apikeys.v2.Key> + getGetKeyMethod() { + io.grpc.MethodDescriptor + getGetKeyMethod; + if ((getGetKeyMethod = ApiKeysGrpc.getGetKeyMethod) == null) { + synchronized (ApiKeysGrpc.class) { + if ((getGetKeyMethod = ApiKeysGrpc.getGetKeyMethod) == null) { + ApiKeysGrpc.getGetKeyMethod = + getGetKeyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.GetKeyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.Key.getDefaultInstance())) + .setSchemaDescriptor(new ApiKeysMethodDescriptorSupplier("GetKey")) + .build(); + } + } + } + return getGetKeyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.GetKeyStringRequest, + com.google.api.apikeys.v2.GetKeyStringResponse> + getGetKeyStringMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetKeyString", + requestType = com.google.api.apikeys.v2.GetKeyStringRequest.class, + responseType = com.google.api.apikeys.v2.GetKeyStringResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.GetKeyStringRequest, + com.google.api.apikeys.v2.GetKeyStringResponse> + getGetKeyStringMethod() { + io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.GetKeyStringRequest, + com.google.api.apikeys.v2.GetKeyStringResponse> + getGetKeyStringMethod; + if ((getGetKeyStringMethod = ApiKeysGrpc.getGetKeyStringMethod) == null) { + synchronized (ApiKeysGrpc.class) { + if ((getGetKeyStringMethod = ApiKeysGrpc.getGetKeyStringMethod) == null) { + ApiKeysGrpc.getGetKeyStringMethod = + getGetKeyStringMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetKeyString")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.GetKeyStringRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.GetKeyStringResponse.getDefaultInstance())) + .setSchemaDescriptor(new ApiKeysMethodDescriptorSupplier("GetKeyString")) + .build(); + } + } + } + return getGetKeyStringMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.UpdateKeyRequest, com.google.longrunning.Operation> + getUpdateKeyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateKey", + requestType = com.google.api.apikeys.v2.UpdateKeyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.UpdateKeyRequest, com.google.longrunning.Operation> + getUpdateKeyMethod() { + io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.UpdateKeyRequest, com.google.longrunning.Operation> + getUpdateKeyMethod; + if ((getUpdateKeyMethod = ApiKeysGrpc.getUpdateKeyMethod) == null) { + synchronized (ApiKeysGrpc.class) { + if ((getUpdateKeyMethod = ApiKeysGrpc.getUpdateKeyMethod) == null) { + ApiKeysGrpc.getUpdateKeyMethod = + getUpdateKeyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.UpdateKeyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new ApiKeysMethodDescriptorSupplier("UpdateKey")) + .build(); + } + } + } + return getUpdateKeyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.DeleteKeyRequest, com.google.longrunning.Operation> + getDeleteKeyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteKey", + requestType = com.google.api.apikeys.v2.DeleteKeyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.DeleteKeyRequest, com.google.longrunning.Operation> + getDeleteKeyMethod() { + io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.DeleteKeyRequest, com.google.longrunning.Operation> + getDeleteKeyMethod; + if ((getDeleteKeyMethod = ApiKeysGrpc.getDeleteKeyMethod) == null) { + synchronized (ApiKeysGrpc.class) { + if ((getDeleteKeyMethod = ApiKeysGrpc.getDeleteKeyMethod) == null) { + ApiKeysGrpc.getDeleteKeyMethod = + getDeleteKeyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.DeleteKeyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new ApiKeysMethodDescriptorSupplier("DeleteKey")) + .build(); + } + } + } + return getDeleteKeyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.UndeleteKeyRequest, com.google.longrunning.Operation> + getUndeleteKeyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UndeleteKey", + requestType = com.google.api.apikeys.v2.UndeleteKeyRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.UndeleteKeyRequest, com.google.longrunning.Operation> + getUndeleteKeyMethod() { + io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.UndeleteKeyRequest, com.google.longrunning.Operation> + getUndeleteKeyMethod; + if ((getUndeleteKeyMethod = ApiKeysGrpc.getUndeleteKeyMethod) == null) { + synchronized (ApiKeysGrpc.class) { + if ((getUndeleteKeyMethod = ApiKeysGrpc.getUndeleteKeyMethod) == null) { + ApiKeysGrpc.getUndeleteKeyMethod = + getUndeleteKeyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UndeleteKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.UndeleteKeyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new ApiKeysMethodDescriptorSupplier("UndeleteKey")) + .build(); + } + } + } + return getUndeleteKeyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.LookupKeyRequest, com.google.api.apikeys.v2.LookupKeyResponse> + getLookupKeyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "LookupKey", + requestType = com.google.api.apikeys.v2.LookupKeyRequest.class, + responseType = com.google.api.apikeys.v2.LookupKeyResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.LookupKeyRequest, com.google.api.apikeys.v2.LookupKeyResponse> + getLookupKeyMethod() { + io.grpc.MethodDescriptor< + com.google.api.apikeys.v2.LookupKeyRequest, com.google.api.apikeys.v2.LookupKeyResponse> + getLookupKeyMethod; + if ((getLookupKeyMethod = ApiKeysGrpc.getLookupKeyMethod) == null) { + synchronized (ApiKeysGrpc.class) { + if ((getLookupKeyMethod = ApiKeysGrpc.getLookupKeyMethod) == null) { + ApiKeysGrpc.getLookupKeyMethod = + getLookupKeyMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "LookupKey")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.LookupKeyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.api.apikeys.v2.LookupKeyResponse.getDefaultInstance())) + .setSchemaDescriptor(new ApiKeysMethodDescriptorSupplier("LookupKey")) + .build(); + } + } + } + return getLookupKeyMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static ApiKeysStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ApiKeysStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ApiKeysStub(channel, callOptions); + } + }; + return ApiKeysStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static ApiKeysBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ApiKeysBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ApiKeysBlockingStub(channel, callOptions); + } + }; + return ApiKeysBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static ApiKeysFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public ApiKeysFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ApiKeysFutureStub(channel, callOptions); + } + }; + return ApiKeysFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Manages the API keys associated with projects.
+   * 
+ */ + public abstract static class ApiKeysImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a new API key.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void createKey( + com.google.api.apikeys.v2.CreateKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getCreateKeyMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists the API keys owned by a project. The key string of the API key
+     * isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void listKeys( + com.google.api.apikeys.v2.ListKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListKeysMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets the metadata for an API key. The key string of the API key
+     * isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void getKey( + com.google.api.apikeys.v2.GetKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetKeyMethod(), responseObserver); + } + + /** + * + * + *
+     * Get the key string for an API key.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void getKeyString( + com.google.api.apikeys.v2.GetKeyStringRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetKeyStringMethod(), responseObserver); + } + + /** + * + * + *
+     * Patches the modifiable fields of an API key.
+     * The key string of the API key isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void updateKey( + com.google.api.apikeys.v2.UpdateKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUpdateKeyMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes an API key. Deleted key can be retrieved within 30 days of
+     * deletion. Afterward, key will be purged from the project.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void deleteKey( + com.google.api.apikeys.v2.DeleteKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getDeleteKeyMethod(), responseObserver); + } + + /** + * + * + *
+     * Undeletes an API key which was deleted within 30 days.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void undeleteKey( + com.google.api.apikeys.v2.UndeleteKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUndeleteKeyMethod(), responseObserver); + } + + /** + * + * + *
+     * Find the parent project and resource name of the API
+     * key that matches the key string in the request. If the API key has been
+     * purged, resource name will not be set.
+     * The service account must have the `apikeys.keys.lookup` permission
+     * on the parent project.
+     * 
+ */ + public void lookupKey( + com.google.api.apikeys.v2.LookupKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getLookupKeyMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateKeyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.apikeys.v2.CreateKeyRequest, com.google.longrunning.Operation>( + this, METHODID_CREATE_KEY))) + .addMethod( + getListKeysMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.apikeys.v2.ListKeysRequest, + com.google.api.apikeys.v2.ListKeysResponse>(this, METHODID_LIST_KEYS))) + .addMethod( + getGetKeyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.apikeys.v2.GetKeyRequest, com.google.api.apikeys.v2.Key>( + this, METHODID_GET_KEY))) + .addMethod( + getGetKeyStringMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.apikeys.v2.GetKeyStringRequest, + com.google.api.apikeys.v2.GetKeyStringResponse>( + this, METHODID_GET_KEY_STRING))) + .addMethod( + getUpdateKeyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.apikeys.v2.UpdateKeyRequest, com.google.longrunning.Operation>( + this, METHODID_UPDATE_KEY))) + .addMethod( + getDeleteKeyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.apikeys.v2.DeleteKeyRequest, com.google.longrunning.Operation>( + this, METHODID_DELETE_KEY))) + .addMethod( + getUndeleteKeyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.apikeys.v2.UndeleteKeyRequest, + com.google.longrunning.Operation>(this, METHODID_UNDELETE_KEY))) + .addMethod( + getLookupKeyMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.api.apikeys.v2.LookupKeyRequest, + com.google.api.apikeys.v2.LookupKeyResponse>(this, METHODID_LOOKUP_KEY))) + .build(); + } + } + + /** + * + * + *
+   * Manages the API keys associated with projects.
+   * 
+ */ + public static final class ApiKeysStub extends io.grpc.stub.AbstractAsyncStub { + private ApiKeysStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ApiKeysStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ApiKeysStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new API key.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void createKey( + com.google.api.apikeys.v2.CreateKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateKeyMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Lists the API keys owned by a project. The key string of the API key
+     * isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void listKeys( + com.google.api.apikeys.v2.ListKeysRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListKeysMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Gets the metadata for an API key. The key string of the API key
+     * isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void getKey( + com.google.api.apikeys.v2.GetKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetKeyMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Get the key string for an API key.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void getKeyString( + com.google.api.apikeys.v2.GetKeyStringRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetKeyStringMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Patches the modifiable fields of an API key.
+     * The key string of the API key isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void updateKey( + com.google.api.apikeys.v2.UpdateKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateKeyMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Deletes an API key. Deleted key can be retrieved within 30 days of
+     * deletion. Afterward, key will be purged from the project.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void deleteKey( + com.google.api.apikeys.v2.DeleteKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteKeyMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Undeletes an API key which was deleted within 30 days.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public void undeleteKey( + com.google.api.apikeys.v2.UndeleteKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUndeleteKeyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Find the parent project and resource name of the API
+     * key that matches the key string in the request. If the API key has been
+     * purged, resource name will not be set.
+     * The service account must have the `apikeys.keys.lookup` permission
+     * on the parent project.
+     * 
+ */ + public void lookupKey( + com.google.api.apikeys.v2.LookupKeyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getLookupKeyMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + * + * + *
+   * Manages the API keys associated with projects.
+   * 
+ */ + public static final class ApiKeysBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private ApiKeysBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ApiKeysBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ApiKeysBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new API key.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.longrunning.Operation createKey( + com.google.api.apikeys.v2.CreateKeyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateKeyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists the API keys owned by a project. The key string of the API key
+     * isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.api.apikeys.v2.ListKeysResponse listKeys( + com.google.api.apikeys.v2.ListKeysRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListKeysMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets the metadata for an API key. The key string of the API key
+     * isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.api.apikeys.v2.Key getKey(com.google.api.apikeys.v2.GetKeyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetKeyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Get the key string for an API key.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.api.apikeys.v2.GetKeyStringResponse getKeyString( + com.google.api.apikeys.v2.GetKeyStringRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetKeyStringMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Patches the modifiable fields of an API key.
+     * The key string of the API key isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.longrunning.Operation updateKey( + com.google.api.apikeys.v2.UpdateKeyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateKeyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes an API key. Deleted key can be retrieved within 30 days of
+     * deletion. Afterward, key will be purged from the project.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.longrunning.Operation deleteKey( + com.google.api.apikeys.v2.DeleteKeyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteKeyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Undeletes an API key which was deleted within 30 days.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.longrunning.Operation undeleteKey( + com.google.api.apikeys.v2.UndeleteKeyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUndeleteKeyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Find the parent project and resource name of the API
+     * key that matches the key string in the request. If the API key has been
+     * purged, resource name will not be set.
+     * The service account must have the `apikeys.keys.lookup` permission
+     * on the parent project.
+     * 
+ */ + public com.google.api.apikeys.v2.LookupKeyResponse lookupKey( + com.google.api.apikeys.v2.LookupKeyRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getLookupKeyMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Manages the API keys associated with projects.
+   * 
+ */ + public static final class ApiKeysFutureStub + extends io.grpc.stub.AbstractFutureStub { + private ApiKeysFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected ApiKeysFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new ApiKeysFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new API key.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createKey(com.google.api.apikeys.v2.CreateKeyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateKeyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists the API keys owned by a project. The key string of the API key
+     * isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.api.apikeys.v2.ListKeysResponse> + listKeys(com.google.api.apikeys.v2.ListKeysRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListKeysMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets the metadata for an API key. The key string of the API key
+     * isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture getKey( + com.google.api.apikeys.v2.GetKeyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetKeyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Get the key string for an API key.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.api.apikeys.v2.GetKeyStringResponse> + getKeyString(com.google.api.apikeys.v2.GetKeyStringRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetKeyStringMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Patches the modifiable fields of an API key.
+     * The key string of the API key isn't included in the response.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateKey(com.google.api.apikeys.v2.UpdateKeyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateKeyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes an API key. Deleted key can be retrieved within 30 days of
+     * deletion. Afterward, key will be purged from the project.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteKey(com.google.api.apikeys.v2.DeleteKeyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteKeyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Undeletes an API key which was deleted within 30 days.
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + undeleteKey(com.google.api.apikeys.v2.UndeleteKeyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUndeleteKeyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Find the parent project and resource name of the API
+     * key that matches the key string in the request. If the API key has been
+     * purged, resource name will not be set.
+     * The service account must have the `apikeys.keys.lookup` permission
+     * on the parent project.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.api.apikeys.v2.LookupKeyResponse> + lookupKey(com.google.api.apikeys.v2.LookupKeyRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getLookupKeyMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_KEY = 0; + private static final int METHODID_LIST_KEYS = 1; + private static final int METHODID_GET_KEY = 2; + private static final int METHODID_GET_KEY_STRING = 3; + private static final int METHODID_UPDATE_KEY = 4; + private static final int METHODID_DELETE_KEY = 5; + private static final int METHODID_UNDELETE_KEY = 6; + private static final int METHODID_LOOKUP_KEY = 7; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final ApiKeysImplBase serviceImpl; + private final int methodId; + + MethodHandlers(ApiKeysImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_KEY: + serviceImpl.createKey( + (com.google.api.apikeys.v2.CreateKeyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_KEYS: + serviceImpl.listKeys( + (com.google.api.apikeys.v2.ListKeysRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_KEY: + serviceImpl.getKey( + (com.google.api.apikeys.v2.GetKeyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_GET_KEY_STRING: + serviceImpl.getKeyString( + (com.google.api.apikeys.v2.GetKeyStringRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_KEY: + serviceImpl.updateKey( + (com.google.api.apikeys.v2.UpdateKeyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_KEY: + serviceImpl.deleteKey( + (com.google.api.apikeys.v2.DeleteKeyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UNDELETE_KEY: + serviceImpl.undeleteKey( + (com.google.api.apikeys.v2.UndeleteKeyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LOOKUP_KEY: + serviceImpl.lookupKey( + (com.google.api.apikeys.v2.LookupKeyRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class ApiKeysBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + ApiKeysBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("ApiKeys"); + } + } + + private static final class ApiKeysFileDescriptorSupplier extends ApiKeysBaseDescriptorSupplier { + ApiKeysFileDescriptorSupplier() {} + } + + private static final class ApiKeysMethodDescriptorSupplier extends ApiKeysBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + ApiKeysMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (ApiKeysGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new ApiKeysFileDescriptorSupplier()) + .addMethod(getCreateKeyMethod()) + .addMethod(getListKeysMethod()) + .addMethod(getGetKeyMethod()) + .addMethod(getGetKeyStringMethod()) + .addMethod(getUpdateKeyMethod()) + .addMethod(getDeleteKeyMethod()) + .addMethod(getUndeleteKeyMethod()) + .addMethod(getLookupKeyMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java.header b/java.header new file mode 100644 index 0000000..d0970ba --- /dev/null +++ b/java.header @@ -0,0 +1,15 @@ +^/\*$ +^ \* Copyright \d\d\d\d,? Google (Inc\.|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$ +^ \*$ +^ \*[ ]+https?://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\.$ +^ \*/$ diff --git a/license-checks.xml b/license-checks.xml new file mode 100644 index 0000000..6597fce --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 0000000..7724346 --- /dev/null +++ b/owlbot.py @@ -0,0 +1,24 @@ +# Copyright 2021 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 +# +# https://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. + +import synthtool as s +from synthtool.languages import java + + +for library in s.get_staging_dirs(): + # put any special-case replacements here + s.move(library) + +s.remove_staging_dirs() +java.common_templates() \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..b79c827 --- /dev/null +++ b/pom.xml @@ -0,0 +1,188 @@ + + + 4.0.0 + com.google.cloud + google-cloud-apikeys-parent + pom + 0.0.1-SNAPSHOT + Google API Keys Parent + https://github.com/googleapis/java-apikeys + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 1.5.0 + + + + + chingor + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + neenushaji + Neenu Shaji + neenushaji@google.com + Google LLC + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-apikeys.git + scm:git:git@github.com:googleapis/java-apikeys.git + https://github.com/googleapis/java-apikeys + HEAD + + + https://github.com/googleapis/java-apikeys/issues + GitHub Issues + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-apikeys-parent + + + + + + com.google.cloud + google-cloud-apikeys + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-apikeys-v2 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-apikeys-v2 + 0.0.1-SNAPSHOT + + + + com.google.cloud + google-cloud-shared-dependencies + 2.13.0 + pom + import + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.objenesis:objenesis + javax.annotation:javax.annotation-api + + + + + + + + + google-cloud-apikeys + grpc-google-cloud-apikeys-v2 + proto-google-cloud-apikeys-v2 + google-cloud-apikeys-bom + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.3.0 + + + + index + dependency-info + team + ci-management + issue-management + licenses + scm + dependency-management + distribution-management + summary + modules + + + + + true + ${site.installationModule} + jar + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.0 + + + html + + aggregate + javadoc + + + + + none + protected + true + ${project.build.directory}/javadoc + + + Test helpers packages + com.google.cloud.testing + + + SPI packages + com.google.cloud.spi* + + + + + https://grpc.io/grpc-java/javadoc/ + https://developers.google.com/protocol-buffers/docs/reference/java/ + https://googleapis.dev/java/google-auth-library/latest/ + https://googleapis.dev/java/gax/latest/ + https://googleapis.github.io/api-common-java/${google.api-common.version}/apidocs/ + + + + + + diff --git a/proto-google-cloud-apikeys-v2/clirr-ignored-differences.xml b/proto-google-cloud-apikeys-v2/clirr-ignored-differences.xml new file mode 100644 index 0000000..4e0074d --- /dev/null +++ b/proto-google-cloud-apikeys-v2/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/api/apikeys/v2/*OrBuilder + * get*(*) + + + 7012 + com/google/api/apikeys/v2/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/api/apikeys/v2/*OrBuilder + boolean has*(*) + + diff --git a/proto-google-cloud-apikeys-v2/pom.xml b/proto-google-cloud-apikeys-v2/pom.xml new file mode 100644 index 0000000..da8e178 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-apikeys-v2 + 0.0.1-SNAPSHOT + proto-google-cloud-apikeys-v2 + Proto library for google-cloud-apikeys + + com.google.cloud + google-cloud-apikeys-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplication.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplication.java new file mode 100644 index 0000000..e154663 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplication.java @@ -0,0 +1,836 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Identifier of an Android application for key use.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.AndroidApplication} + */ +public final class AndroidApplication extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.AndroidApplication) + AndroidApplicationOrBuilder { + private static final long serialVersionUID = 0L; + // Use AndroidApplication.newBuilder() to construct. + private AndroidApplication(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AndroidApplication() { + sha1Fingerprint_ = ""; + packageName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AndroidApplication(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AndroidApplication( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + sha1Fingerprint_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + packageName_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidApplication_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidApplication_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.AndroidApplication.class, + com.google.api.apikeys.v2.AndroidApplication.Builder.class); + } + + public static final int SHA1_FINGERPRINT_FIELD_NUMBER = 1; + private volatile java.lang.Object sha1Fingerprint_; + /** + * + * + *
+   * The SHA1 fingerprint of the application. For example, both sha1 formats are
+   * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+   * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+   * Output format is the latter.
+   * 
+ * + * string sha1_fingerprint = 1; + * + * @return The sha1Fingerprint. + */ + @java.lang.Override + public java.lang.String getSha1Fingerprint() { + java.lang.Object ref = sha1Fingerprint_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sha1Fingerprint_ = s; + return s; + } + } + /** + * + * + *
+   * The SHA1 fingerprint of the application. For example, both sha1 formats are
+   * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+   * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+   * Output format is the latter.
+   * 
+ * + * string sha1_fingerprint = 1; + * + * @return The bytes for sha1Fingerprint. + */ + @java.lang.Override + public com.google.protobuf.ByteString getSha1FingerprintBytes() { + java.lang.Object ref = sha1Fingerprint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sha1Fingerprint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PACKAGE_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object packageName_; + /** + * + * + *
+   * The package name of the application.
+   * 
+ * + * string package_name = 2; + * + * @return The packageName. + */ + @java.lang.Override + public java.lang.String getPackageName() { + java.lang.Object ref = packageName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + packageName_ = s; + return s; + } + } + /** + * + * + *
+   * The package name of the application.
+   * 
+ * + * string package_name = 2; + * + * @return The bytes for packageName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPackageNameBytes() { + java.lang.Object ref = packageName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + packageName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sha1Fingerprint_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, sha1Fingerprint_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(packageName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, packageName_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(sha1Fingerprint_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, sha1Fingerprint_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(packageName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, packageName_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.AndroidApplication)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.AndroidApplication other = + (com.google.api.apikeys.v2.AndroidApplication) obj; + + if (!getSha1Fingerprint().equals(other.getSha1Fingerprint())) return false; + if (!getPackageName().equals(other.getPackageName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SHA1_FINGERPRINT_FIELD_NUMBER; + hash = (53 * hash) + getSha1Fingerprint().hashCode(); + hash = (37 * hash) + PACKAGE_NAME_FIELD_NUMBER; + hash = (53 * hash) + getPackageName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.AndroidApplication parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.AndroidApplication prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Identifier of an Android application for key use.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.AndroidApplication} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.AndroidApplication) + com.google.api.apikeys.v2.AndroidApplicationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidApplication_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidApplication_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.AndroidApplication.class, + com.google.api.apikeys.v2.AndroidApplication.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.AndroidApplication.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + sha1Fingerprint_ = ""; + + packageName_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidApplication_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.AndroidApplication getDefaultInstanceForType() { + return com.google.api.apikeys.v2.AndroidApplication.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.AndroidApplication build() { + com.google.api.apikeys.v2.AndroidApplication result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.AndroidApplication buildPartial() { + com.google.api.apikeys.v2.AndroidApplication result = + new com.google.api.apikeys.v2.AndroidApplication(this); + result.sha1Fingerprint_ = sha1Fingerprint_; + result.packageName_ = packageName_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.AndroidApplication) { + return mergeFrom((com.google.api.apikeys.v2.AndroidApplication) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.AndroidApplication other) { + if (other == com.google.api.apikeys.v2.AndroidApplication.getDefaultInstance()) return this; + if (!other.getSha1Fingerprint().isEmpty()) { + sha1Fingerprint_ = other.sha1Fingerprint_; + onChanged(); + } + if (!other.getPackageName().isEmpty()) { + packageName_ = other.packageName_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.AndroidApplication parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.AndroidApplication) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object sha1Fingerprint_ = ""; + /** + * + * + *
+     * The SHA1 fingerprint of the application. For example, both sha1 formats are
+     * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+     * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+     * Output format is the latter.
+     * 
+ * + * string sha1_fingerprint = 1; + * + * @return The sha1Fingerprint. + */ + public java.lang.String getSha1Fingerprint() { + java.lang.Object ref = sha1Fingerprint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + sha1Fingerprint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The SHA1 fingerprint of the application. For example, both sha1 formats are
+     * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+     * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+     * Output format is the latter.
+     * 
+ * + * string sha1_fingerprint = 1; + * + * @return The bytes for sha1Fingerprint. + */ + public com.google.protobuf.ByteString getSha1FingerprintBytes() { + java.lang.Object ref = sha1Fingerprint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + sha1Fingerprint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The SHA1 fingerprint of the application. For example, both sha1 formats are
+     * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+     * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+     * Output format is the latter.
+     * 
+ * + * string sha1_fingerprint = 1; + * + * @param value The sha1Fingerprint to set. + * @return This builder for chaining. + */ + public Builder setSha1Fingerprint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + sha1Fingerprint_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The SHA1 fingerprint of the application. For example, both sha1 formats are
+     * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+     * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+     * Output format is the latter.
+     * 
+ * + * string sha1_fingerprint = 1; + * + * @return This builder for chaining. + */ + public Builder clearSha1Fingerprint() { + + sha1Fingerprint_ = getDefaultInstance().getSha1Fingerprint(); + onChanged(); + return this; + } + /** + * + * + *
+     * The SHA1 fingerprint of the application. For example, both sha1 formats are
+     * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+     * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+     * Output format is the latter.
+     * 
+ * + * string sha1_fingerprint = 1; + * + * @param value The bytes for sha1Fingerprint to set. + * @return This builder for chaining. + */ + public Builder setSha1FingerprintBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + sha1Fingerprint_ = value; + onChanged(); + return this; + } + + private java.lang.Object packageName_ = ""; + /** + * + * + *
+     * The package name of the application.
+     * 
+ * + * string package_name = 2; + * + * @return The packageName. + */ + public java.lang.String getPackageName() { + java.lang.Object ref = packageName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + packageName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The package name of the application.
+     * 
+ * + * string package_name = 2; + * + * @return The bytes for packageName. + */ + public com.google.protobuf.ByteString getPackageNameBytes() { + java.lang.Object ref = packageName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + packageName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The package name of the application.
+     * 
+ * + * string package_name = 2; + * + * @param value The packageName to set. + * @return This builder for chaining. + */ + public Builder setPackageName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + packageName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The package name of the application.
+     * 
+ * + * string package_name = 2; + * + * @return This builder for chaining. + */ + public Builder clearPackageName() { + + packageName_ = getDefaultInstance().getPackageName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The package name of the application.
+     * 
+ * + * string package_name = 2; + * + * @param value The bytes for packageName to set. + * @return This builder for chaining. + */ + public Builder setPackageNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + packageName_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.AndroidApplication) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.AndroidApplication) + private static final com.google.api.apikeys.v2.AndroidApplication DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.AndroidApplication(); + } + + public static com.google.api.apikeys.v2.AndroidApplication getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AndroidApplication parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AndroidApplication(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.AndroidApplication getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplicationOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplicationOrBuilder.java new file mode 100644 index 0000000..a67e1a6 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplicationOrBuilder.java @@ -0,0 +1,81 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public interface AndroidApplicationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.AndroidApplication) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The SHA1 fingerprint of the application. For example, both sha1 formats are
+   * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+   * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+   * Output format is the latter.
+   * 
+ * + * string sha1_fingerprint = 1; + * + * @return The sha1Fingerprint. + */ + java.lang.String getSha1Fingerprint(); + /** + * + * + *
+   * The SHA1 fingerprint of the application. For example, both sha1 formats are
+   * acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or
+   * DA39A3EE5E6B4B0D3255BFEF95601890AFD80709.
+   * Output format is the latter.
+   * 
+ * + * string sha1_fingerprint = 1; + * + * @return The bytes for sha1Fingerprint. + */ + com.google.protobuf.ByteString getSha1FingerprintBytes(); + + /** + * + * + *
+   * The package name of the application.
+   * 
+ * + * string package_name = 2; + * + * @return The packageName. + */ + java.lang.String getPackageName(); + /** + * + * + *
+   * The package name of the application.
+   * 
+ * + * string package_name = 2; + * + * @return The bytes for packageName. + */ + com.google.protobuf.ByteString getPackageNameBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictions.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictions.java new file mode 100644 index 0000000..e773c85 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictions.java @@ -0,0 +1,988 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * The Android apps that are allowed to use the key.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.AndroidKeyRestrictions} + */ +public final class AndroidKeyRestrictions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.AndroidKeyRestrictions) + AndroidKeyRestrictionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use AndroidKeyRestrictions.newBuilder() to construct. + private AndroidKeyRestrictions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AndroidKeyRestrictions() { + allowedApplications_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AndroidKeyRestrictions(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AndroidKeyRestrictions( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + allowedApplications_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + allowedApplications_.add( + input.readMessage( + com.google.api.apikeys.v2.AndroidApplication.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + allowedApplications_ = java.util.Collections.unmodifiableList(allowedApplications_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidKeyRestrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidKeyRestrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.AndroidKeyRestrictions.class, + com.google.api.apikeys.v2.AndroidKeyRestrictions.Builder.class); + } + + public static final int ALLOWED_APPLICATIONS_FIELD_NUMBER = 1; + private java.util.List allowedApplications_; + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + @java.lang.Override + public java.util.List getAllowedApplicationsList() { + return allowedApplications_; + } + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + @java.lang.Override + public java.util.List + getAllowedApplicationsOrBuilderList() { + return allowedApplications_; + } + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + @java.lang.Override + public int getAllowedApplicationsCount() { + return allowedApplications_.size(); + } + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + @java.lang.Override + public com.google.api.apikeys.v2.AndroidApplication getAllowedApplications(int index) { + return allowedApplications_.get(index); + } + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + @java.lang.Override + public com.google.api.apikeys.v2.AndroidApplicationOrBuilder getAllowedApplicationsOrBuilder( + int index) { + return allowedApplications_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < allowedApplications_.size(); i++) { + output.writeMessage(1, allowedApplications_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < allowedApplications_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, allowedApplications_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.AndroidKeyRestrictions)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.AndroidKeyRestrictions other = + (com.google.api.apikeys.v2.AndroidKeyRestrictions) obj; + + if (!getAllowedApplicationsList().equals(other.getAllowedApplicationsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAllowedApplicationsCount() > 0) { + hash = (37 * hash) + ALLOWED_APPLICATIONS_FIELD_NUMBER; + hash = (53 * hash) + getAllowedApplicationsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.AndroidKeyRestrictions prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The Android apps that are allowed to use the key.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.AndroidKeyRestrictions} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.AndroidKeyRestrictions) + com.google.api.apikeys.v2.AndroidKeyRestrictionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidKeyRestrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidKeyRestrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.AndroidKeyRestrictions.class, + com.google.api.apikeys.v2.AndroidKeyRestrictions.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.AndroidKeyRestrictions.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getAllowedApplicationsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (allowedApplicationsBuilder_ == null) { + allowedApplications_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + allowedApplicationsBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_AndroidKeyRestrictions_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.AndroidKeyRestrictions getDefaultInstanceForType() { + return com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.AndroidKeyRestrictions build() { + com.google.api.apikeys.v2.AndroidKeyRestrictions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.AndroidKeyRestrictions buildPartial() { + com.google.api.apikeys.v2.AndroidKeyRestrictions result = + new com.google.api.apikeys.v2.AndroidKeyRestrictions(this); + int from_bitField0_ = bitField0_; + if (allowedApplicationsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + allowedApplications_ = java.util.Collections.unmodifiableList(allowedApplications_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.allowedApplications_ = allowedApplications_; + } else { + result.allowedApplications_ = allowedApplicationsBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.AndroidKeyRestrictions) { + return mergeFrom((com.google.api.apikeys.v2.AndroidKeyRestrictions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.AndroidKeyRestrictions other) { + if (other == com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance()) + return this; + if (allowedApplicationsBuilder_ == null) { + if (!other.allowedApplications_.isEmpty()) { + if (allowedApplications_.isEmpty()) { + allowedApplications_ = other.allowedApplications_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAllowedApplicationsIsMutable(); + allowedApplications_.addAll(other.allowedApplications_); + } + onChanged(); + } + } else { + if (!other.allowedApplications_.isEmpty()) { + if (allowedApplicationsBuilder_.isEmpty()) { + allowedApplicationsBuilder_.dispose(); + allowedApplicationsBuilder_ = null; + allowedApplications_ = other.allowedApplications_; + bitField0_ = (bitField0_ & ~0x00000001); + allowedApplicationsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getAllowedApplicationsFieldBuilder() + : null; + } else { + allowedApplicationsBuilder_.addAllMessages(other.allowedApplications_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.AndroidKeyRestrictions parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.AndroidKeyRestrictions) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List allowedApplications_ = + java.util.Collections.emptyList(); + + private void ensureAllowedApplicationsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + allowedApplications_ = + new java.util.ArrayList( + allowedApplications_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.AndroidApplication, + com.google.api.apikeys.v2.AndroidApplication.Builder, + com.google.api.apikeys.v2.AndroidApplicationOrBuilder> + allowedApplicationsBuilder_; + + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public java.util.List + getAllowedApplicationsList() { + if (allowedApplicationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(allowedApplications_); + } else { + return allowedApplicationsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public int getAllowedApplicationsCount() { + if (allowedApplicationsBuilder_ == null) { + return allowedApplications_.size(); + } else { + return allowedApplicationsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public com.google.api.apikeys.v2.AndroidApplication getAllowedApplications(int index) { + if (allowedApplicationsBuilder_ == null) { + return allowedApplications_.get(index); + } else { + return allowedApplicationsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder setAllowedApplications( + int index, com.google.api.apikeys.v2.AndroidApplication value) { + if (allowedApplicationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedApplicationsIsMutable(); + allowedApplications_.set(index, value); + onChanged(); + } else { + allowedApplicationsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder setAllowedApplications( + int index, com.google.api.apikeys.v2.AndroidApplication.Builder builderForValue) { + if (allowedApplicationsBuilder_ == null) { + ensureAllowedApplicationsIsMutable(); + allowedApplications_.set(index, builderForValue.build()); + onChanged(); + } else { + allowedApplicationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder addAllowedApplications(com.google.api.apikeys.v2.AndroidApplication value) { + if (allowedApplicationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedApplicationsIsMutable(); + allowedApplications_.add(value); + onChanged(); + } else { + allowedApplicationsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder addAllowedApplications( + int index, com.google.api.apikeys.v2.AndroidApplication value) { + if (allowedApplicationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedApplicationsIsMutable(); + allowedApplications_.add(index, value); + onChanged(); + } else { + allowedApplicationsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder addAllowedApplications( + com.google.api.apikeys.v2.AndroidApplication.Builder builderForValue) { + if (allowedApplicationsBuilder_ == null) { + ensureAllowedApplicationsIsMutable(); + allowedApplications_.add(builderForValue.build()); + onChanged(); + } else { + allowedApplicationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder addAllowedApplications( + int index, com.google.api.apikeys.v2.AndroidApplication.Builder builderForValue) { + if (allowedApplicationsBuilder_ == null) { + ensureAllowedApplicationsIsMutable(); + allowedApplications_.add(index, builderForValue.build()); + onChanged(); + } else { + allowedApplicationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder addAllAllowedApplications( + java.lang.Iterable values) { + if (allowedApplicationsBuilder_ == null) { + ensureAllowedApplicationsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, allowedApplications_); + onChanged(); + } else { + allowedApplicationsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder clearAllowedApplications() { + if (allowedApplicationsBuilder_ == null) { + allowedApplications_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + allowedApplicationsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public Builder removeAllowedApplications(int index) { + if (allowedApplicationsBuilder_ == null) { + ensureAllowedApplicationsIsMutable(); + allowedApplications_.remove(index); + onChanged(); + } else { + allowedApplicationsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public com.google.api.apikeys.v2.AndroidApplication.Builder getAllowedApplicationsBuilder( + int index) { + return getAllowedApplicationsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public com.google.api.apikeys.v2.AndroidApplicationOrBuilder getAllowedApplicationsOrBuilder( + int index) { + if (allowedApplicationsBuilder_ == null) { + return allowedApplications_.get(index); + } else { + return allowedApplicationsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public java.util.List + getAllowedApplicationsOrBuilderList() { + if (allowedApplicationsBuilder_ != null) { + return allowedApplicationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(allowedApplications_); + } + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public com.google.api.apikeys.v2.AndroidApplication.Builder addAllowedApplicationsBuilder() { + return getAllowedApplicationsFieldBuilder() + .addBuilder(com.google.api.apikeys.v2.AndroidApplication.getDefaultInstance()); + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public com.google.api.apikeys.v2.AndroidApplication.Builder addAllowedApplicationsBuilder( + int index) { + return getAllowedApplicationsFieldBuilder() + .addBuilder(index, com.google.api.apikeys.v2.AndroidApplication.getDefaultInstance()); + } + /** + * + * + *
+     * A list of Android applications that are allowed to make API calls with
+     * this key.
+     * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + public java.util.List + getAllowedApplicationsBuilderList() { + return getAllowedApplicationsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.AndroidApplication, + com.google.api.apikeys.v2.AndroidApplication.Builder, + com.google.api.apikeys.v2.AndroidApplicationOrBuilder> + getAllowedApplicationsFieldBuilder() { + if (allowedApplicationsBuilder_ == null) { + allowedApplicationsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.AndroidApplication, + com.google.api.apikeys.v2.AndroidApplication.Builder, + com.google.api.apikeys.v2.AndroidApplicationOrBuilder>( + allowedApplications_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + allowedApplications_ = null; + } + return allowedApplicationsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.AndroidKeyRestrictions) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.AndroidKeyRestrictions) + private static final com.google.api.apikeys.v2.AndroidKeyRestrictions DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.AndroidKeyRestrictions(); + } + + public static com.google.api.apikeys.v2.AndroidKeyRestrictions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AndroidKeyRestrictions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AndroidKeyRestrictions(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.AndroidKeyRestrictions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictionsOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictionsOrBuilder.java new file mode 100644 index 0000000..59ffa54 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictionsOrBuilder.java @@ -0,0 +1,82 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public interface AndroidKeyRestrictionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.AndroidKeyRestrictions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + java.util.List getAllowedApplicationsList(); + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + com.google.api.apikeys.v2.AndroidApplication getAllowedApplications(int index); + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + int getAllowedApplicationsCount(); + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + java.util.List + getAllowedApplicationsOrBuilderList(); + /** + * + * + *
+   * A list of Android applications that are allowed to make API calls with
+   * this key.
+   * 
+ * + * repeated .google.api.apikeys.v2.AndroidApplication allowed_applications = 1; + */ + com.google.api.apikeys.v2.AndroidApplicationOrBuilder getAllowedApplicationsOrBuilder(int index); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysProto.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysProto.java new file mode 100644 index 0000000..dfd77c5 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysProto.java @@ -0,0 +1,278 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public final class ApiKeysProto { + private ApiKeysProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_CreateKeyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_CreateKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_ListKeysRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_ListKeysRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_ListKeysResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_ListKeysResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_GetKeyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_GetKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_GetKeyStringRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_GetKeyStringRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_GetKeyStringResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_GetKeyStringResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_UpdateKeyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_UpdateKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_DeleteKeyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_DeleteKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_UndeleteKeyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_UndeleteKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_LookupKeyRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_LookupKeyRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_LookupKeyResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_LookupKeyResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n#google/api/apikeys/v2/apikeys.proto\022\025g" + + "oogle.api.apikeys.v2\032\034google/api/annotat" + + "ions.proto\032%google/api/apikeys/v2/resour" + + "ces.proto\032\027google/api/client.proto\032\037goog" + + "le/api/field_behavior.proto\032\031google/api/" + + "resource.proto\032#google/longrunning/opera" + + "tions.proto\032 google/protobuf/field_mask." + + "proto\"\204\001\n\020CreateKeyRequest\0222\n\006parent\030\001 \001" + + "(\tB\"\340A\002\372A\034\022\032apikeys.googleapis.com/Key\022," + + "\n\003key\030\002 \001(\0132\032.google.api.apikeys.v2.KeyB" + + "\003\340A\002\022\016\n\006key_id\030\003 \001(\t\"\221\001\n\017ListKeysRequest" + + "\0222\n\006parent\030\001 \001(\tB\"\340A\002\372A\034\022\032apikeys.google" + + "apis.com/Key\022\026\n\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\n" + + "page_token\030\003 \001(\tB\003\340A\001\022\031\n\014show_deleted\030\006 " + + "\001(\010B\003\340A\001\"U\n\020ListKeysResponse\022(\n\004keys\030\001 \003" + + "(\0132\032.google.api.apikeys.v2.Key\022\027\n\017next_p" + + "age_token\030\002 \001(\t\"A\n\rGetKeyRequest\0220\n\004name" + + "\030\001 \001(\tB\"\340A\002\372A\034\n\032apikeys.googleapis.com/K" + + "ey\"G\n\023GetKeyStringRequest\0220\n\004name\030\001 \001(\tB" + + "\"\340A\002\372A\034\n\032apikeys.googleapis.com/Key\"*\n\024G" + + "etKeyStringResponse\022\022\n\nkey_string\030\001 \001(\t\"" + + "q\n\020UpdateKeyRequest\022,\n\003key\030\001 \001(\0132\032.googl" + + "e.api.apikeys.v2.KeyB\003\340A\002\022/\n\013update_mask" + + "\030\002 \001(\0132\032.google.protobuf.FieldMask\"W\n\020De" + + "leteKeyRequest\0220\n\004name\030\001 \001(\tB\"\340A\002\372A\034\n\032ap" + + "ikeys.googleapis.com/Key\022\021\n\004etag\030\002 \001(\tB\003" + + "\340A\001\"F\n\022UndeleteKeyRequest\0220\n\004name\030\001 \001(\tB" + + "\"\340A\002\372A\034\n\032apikeys.googleapis.com/Key\"+\n\020L" + + "ookupKeyRequest\022\027\n\nkey_string\030\001 \001(\tB\003\340A\002" + + "\"1\n\021LookupKeyResponse\022\016\n\006parent\030\001 \001(\t\022\014\n" + + "\004name\030\002 \001(\t2\276\013\n\007ApiKeys\022\275\001\n\tCreateKey\022\'." + + "google.api.apikeys.v2.CreateKeyRequest\032\035" + + ".google.longrunning.Operation\"h\202\323\344\223\002/\"(/" + + "v2/{parent=projects/*/locations/*}/keys:" + + "\003key\332A\021parent,key,key_id\312A\034\n\003Key\022\025google" + + ".protobuf.Empty\022\226\001\n\010ListKeys\022&.google.ap" + + "i.apikeys.v2.ListKeysRequest\032\'.google.ap" + + "i.apikeys.v2.ListKeysResponse\"9\202\323\344\223\002*\022(/" + + "v2/{parent=projects/*/locations/*}/keys\332" + + "A\006parent\022\203\001\n\006GetKey\022$.google.api.apikeys" + + ".v2.GetKeyRequest\032\032.google.api.apikeys.v" + + "2.Key\"7\202\323\344\223\002*\022(/v2/{name=projects/*/loca" + + "tions/*/keys/*}\332A\004name\022\252\001\n\014GetKeyString\022" + + "*.google.api.apikeys.v2.GetKeyStringRequ" + + "est\032+.google.api.apikeys.v2.GetKeyString" + + "Response\"A\202\323\344\223\0024\0222/v2/{name=projects/*/l" + + "ocations/*/keys/*}/keyString\332A\004name\022\277\001\n\t" + + "UpdateKey\022\'.google.api.apikeys.v2.Update" + + "KeyRequest\032\035.google.longrunning.Operatio" + + "n\"j\202\323\344\223\00232,/v2/{key.name=projects/*/loca" + + "tions/*/keys/*}:\003key\332A\017key,update_mask\312A" + + "\034\n\003Key\022\025google.protobuf.Empty\022\253\001\n\tDelete" + + "Key\022\'.google.api.apikeys.v2.DeleteKeyReq" + + "uest\032\035.google.longrunning.Operation\"V\202\323\344" + + "\223\002**(/v2/{name=projects/*/locations/*/ke" + + "ys/*}\332A\004name\312A\034\n\003Key\022\025google.protobuf.Em" + + "pty\022\264\001\n\013UndeleteKey\022).google.api.apikeys" + + ".v2.UndeleteKeyRequest\032\035.google.longrunn" + + "ing.Operation\"[\202\323\344\223\0026\"1/v2/{name=project" + + "s/*/locations/*/keys/*}:undelete:\001*\312A\034\n\003" + + "Key\022\025google.protobuf.Empty\022z\n\tLookupKey\022" + + "\'.google.api.apikeys.v2.LookupKeyRequest" + + "\032(.google.api.apikeys.v2.LookupKeyRespon" + + "se\"\032\202\323\344\223\002\024\022\022/v2/keys:lookupKey\032\203\001\312A\026apik" + + "eys.googleapis.com\322Aghttps://www.googlea" + + "pis.com/auth/cloud-platform,https://www." + + "googleapis.com/auth/cloud-platform.read-" + + "onlyB\272\001\n\031com.google.api.apikeys.v2B\014ApiK" + + "eysProtoP\001Z + * A restriction for a specific service and optionally one or multiple + * specific methods. Both fields are case insensitive. + * + * + * Protobuf type {@code google.api.apikeys.v2.ApiTarget} + */ +public final class ApiTarget extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.ApiTarget) + ApiTargetOrBuilder { + private static final long serialVersionUID = 0L; + // Use ApiTarget.newBuilder() to construct. + private ApiTarget(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ApiTarget() { + service_ = ""; + methods_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ApiTarget(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ApiTarget( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + service_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + methods_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + methods_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + methods_ = methods_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ApiTarget_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ApiTarget_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.ApiTarget.class, + com.google.api.apikeys.v2.ApiTarget.Builder.class); + } + + public static final int SERVICE_FIELD_NUMBER = 1; + private volatile java.lang.Object service_; + /** + * + * + *
+   * The service for this restriction. It should be the canonical
+   * service name, for example: `translate.googleapis.com`.
+   * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+   * to get a list of services that are enabled in the project.
+   * 
+ * + * string service = 1; + * + * @return The service. + */ + @java.lang.Override + public java.lang.String getService() { + java.lang.Object ref = service_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + service_ = s; + return s; + } + } + /** + * + * + *
+   * The service for this restriction. It should be the canonical
+   * service name, for example: `translate.googleapis.com`.
+   * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+   * to get a list of services that are enabled in the project.
+   * 
+ * + * string service = 1; + * + * @return The bytes for service. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceBytes() { + java.lang.Object ref = service_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + service_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int METHODS_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList methods_; + /** + * + * + *
+   * Optional. List of one or more methods that can be called.
+   * If empty, all methods for the service are allowed. A wildcard
+   * (*) can be used as the last symbol.
+   * Valid examples:
+   *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+   *   `TranslateText`
+   *   `Get*`
+   *   `translate.googleapis.com.Get*`
+   * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the methods. + */ + public com.google.protobuf.ProtocolStringList getMethodsList() { + return methods_; + } + /** + * + * + *
+   * Optional. List of one or more methods that can be called.
+   * If empty, all methods for the service are allowed. A wildcard
+   * (*) can be used as the last symbol.
+   * Valid examples:
+   *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+   *   `TranslateText`
+   *   `Get*`
+   *   `translate.googleapis.com.Get*`
+   * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of methods. + */ + public int getMethodsCount() { + return methods_.size(); + } + /** + * + * + *
+   * Optional. List of one or more methods that can be called.
+   * If empty, all methods for the service are allowed. A wildcard
+   * (*) can be used as the last symbol.
+   * Valid examples:
+   *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+   *   `TranslateText`
+   *   `Get*`
+   *   `translate.googleapis.com.Get*`
+   * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The methods at the given index. + */ + public java.lang.String getMethods(int index) { + return methods_.get(index); + } + /** + * + * + *
+   * Optional. List of one or more methods that can be called.
+   * If empty, all methods for the service are allowed. A wildcard
+   * (*) can be used as the last symbol.
+   * Valid examples:
+   *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+   *   `TranslateText`
+   *   `Get*`
+   *   `translate.googleapis.com.Get*`
+   * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the methods at the given index. + */ + public com.google.protobuf.ByteString getMethodsBytes(int index) { + return methods_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(service_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, service_); + } + for (int i = 0; i < methods_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, methods_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(service_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, service_); + } + { + int dataSize = 0; + for (int i = 0; i < methods_.size(); i++) { + dataSize += computeStringSizeNoTag(methods_.getRaw(i)); + } + size += dataSize; + size += 1 * getMethodsList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.ApiTarget)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.ApiTarget other = (com.google.api.apikeys.v2.ApiTarget) obj; + + if (!getService().equals(other.getService())) return false; + if (!getMethodsList().equals(other.getMethodsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SERVICE_FIELD_NUMBER; + hash = (53 * hash) + getService().hashCode(); + if (getMethodsCount() > 0) { + hash = (37 * hash) + METHODS_FIELD_NUMBER; + hash = (53 * hash) + getMethodsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ApiTarget parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ApiTarget parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ApiTarget parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.ApiTarget prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A restriction for a specific service and optionally one or multiple
+   * specific methods. Both fields are case insensitive.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.ApiTarget} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.ApiTarget) + com.google.api.apikeys.v2.ApiTargetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ApiTarget_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ApiTarget_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.ApiTarget.class, + com.google.api.apikeys.v2.ApiTarget.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.ApiTarget.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + service_ = ""; + + methods_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ApiTarget_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ApiTarget getDefaultInstanceForType() { + return com.google.api.apikeys.v2.ApiTarget.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.ApiTarget build() { + com.google.api.apikeys.v2.ApiTarget result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ApiTarget buildPartial() { + com.google.api.apikeys.v2.ApiTarget result = new com.google.api.apikeys.v2.ApiTarget(this); + int from_bitField0_ = bitField0_; + result.service_ = service_; + if (((bitField0_ & 0x00000001) != 0)) { + methods_ = methods_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.methods_ = methods_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.ApiTarget) { + return mergeFrom((com.google.api.apikeys.v2.ApiTarget) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.ApiTarget other) { + if (other == com.google.api.apikeys.v2.ApiTarget.getDefaultInstance()) return this; + if (!other.getService().isEmpty()) { + service_ = other.service_; + onChanged(); + } + if (!other.methods_.isEmpty()) { + if (methods_.isEmpty()) { + methods_ = other.methods_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureMethodsIsMutable(); + methods_.addAll(other.methods_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.ApiTarget parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.ApiTarget) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object service_ = ""; + /** + * + * + *
+     * The service for this restriction. It should be the canonical
+     * service name, for example: `translate.googleapis.com`.
+     * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+     * to get a list of services that are enabled in the project.
+     * 
+ * + * string service = 1; + * + * @return The service. + */ + public java.lang.String getService() { + java.lang.Object ref = service_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + service_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The service for this restriction. It should be the canonical
+     * service name, for example: `translate.googleapis.com`.
+     * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+     * to get a list of services that are enabled in the project.
+     * 
+ * + * string service = 1; + * + * @return The bytes for service. + */ + public com.google.protobuf.ByteString getServiceBytes() { + java.lang.Object ref = service_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + service_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The service for this restriction. It should be the canonical
+     * service name, for example: `translate.googleapis.com`.
+     * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+     * to get a list of services that are enabled in the project.
+     * 
+ * + * string service = 1; + * + * @param value The service to set. + * @return This builder for chaining. + */ + public Builder setService(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + service_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The service for this restriction. It should be the canonical
+     * service name, for example: `translate.googleapis.com`.
+     * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+     * to get a list of services that are enabled in the project.
+     * 
+ * + * string service = 1; + * + * @return This builder for chaining. + */ + public Builder clearService() { + + service_ = getDefaultInstance().getService(); + onChanged(); + return this; + } + /** + * + * + *
+     * The service for this restriction. It should be the canonical
+     * service name, for example: `translate.googleapis.com`.
+     * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+     * to get a list of services that are enabled in the project.
+     * 
+ * + * string service = 1; + * + * @param value The bytes for service to set. + * @return This builder for chaining. + */ + public Builder setServiceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + service_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList methods_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureMethodsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + methods_ = new com.google.protobuf.LazyStringArrayList(methods_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the methods. + */ + public com.google.protobuf.ProtocolStringList getMethodsList() { + return methods_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of methods. + */ + public int getMethodsCount() { + return methods_.size(); + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The methods at the given index. + */ + public java.lang.String getMethods(int index) { + return methods_.get(index); + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the methods at the given index. + */ + public com.google.protobuf.ByteString getMethodsBytes(int index) { + return methods_.getByteString(index); + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index to set the value at. + * @param value The methods to set. + * @return This builder for chaining. + */ + public Builder setMethods(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMethodsIsMutable(); + methods_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The methods to add. + * @return This builder for chaining. + */ + public Builder addMethods(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureMethodsIsMutable(); + methods_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param values The methods to add. + * @return This builder for chaining. + */ + public Builder addAllMethods(java.lang.Iterable values) { + ensureMethodsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, methods_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearMethods() { + methods_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. List of one or more methods that can be called.
+     * If empty, all methods for the service are allowed. A wildcard
+     * (*) can be used as the last symbol.
+     * Valid examples:
+     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+     *   `TranslateText`
+     *   `Get*`
+     *   `translate.googleapis.com.Get*`
+     * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes of the methods to add. + * @return This builder for chaining. + */ + public Builder addMethodsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureMethodsIsMutable(); + methods_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.ApiTarget) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.ApiTarget) + private static final com.google.api.apikeys.v2.ApiTarget DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.ApiTarget(); + } + + public static com.google.api.apikeys.v2.ApiTarget getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ApiTarget parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ApiTarget(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ApiTarget getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTargetOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTargetOrBuilder.java new file mode 100644 index 0000000..4a8e9a0 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTargetOrBuilder.java @@ -0,0 +1,135 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public interface ApiTargetOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.ApiTarget) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The service for this restriction. It should be the canonical
+   * service name, for example: `translate.googleapis.com`.
+   * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+   * to get a list of services that are enabled in the project.
+   * 
+ * + * string service = 1; + * + * @return The service. + */ + java.lang.String getService(); + /** + * + * + *
+   * The service for this restriction. It should be the canonical
+   * service name, for example: `translate.googleapis.com`.
+   * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
+   * to get a list of services that are enabled in the project.
+   * 
+ * + * string service = 1; + * + * @return The bytes for service. + */ + com.google.protobuf.ByteString getServiceBytes(); + + /** + * + * + *
+   * Optional. List of one or more methods that can be called.
+   * If empty, all methods for the service are allowed. A wildcard
+   * (*) can be used as the last symbol.
+   * Valid examples:
+   *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+   *   `TranslateText`
+   *   `Get*`
+   *   `translate.googleapis.com.Get*`
+   * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return A list containing the methods. + */ + java.util.List getMethodsList(); + /** + * + * + *
+   * Optional. List of one or more methods that can be called.
+   * If empty, all methods for the service are allowed. A wildcard
+   * (*) can be used as the last symbol.
+   * Valid examples:
+   *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+   *   `TranslateText`
+   *   `Get*`
+   *   `translate.googleapis.com.Get*`
+   * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The count of methods. + */ + int getMethodsCount(); + /** + * + * + *
+   * Optional. List of one or more methods that can be called.
+   * If empty, all methods for the service are allowed. A wildcard
+   * (*) can be used as the last symbol.
+   * Valid examples:
+   *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+   *   `TranslateText`
+   *   `Get*`
+   *   `translate.googleapis.com.Get*`
+   * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the element to return. + * @return The methods at the given index. + */ + java.lang.String getMethods(int index); + /** + * + * + *
+   * Optional. List of one or more methods that can be called.
+   * If empty, all methods for the service are allowed. A wildcard
+   * (*) can be used as the last symbol.
+   * Valid examples:
+   *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
+   *   `TranslateText`
+   *   `Get*`
+   *   `translate.googleapis.com.Get*`
+   * 
+ * + * repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param index The index of the value to return. + * @return The bytes of the methods at the given index. + */ + com.google.protobuf.ByteString getMethodsBytes(int index); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictions.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictions.java new file mode 100644 index 0000000..fa64403 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictions.java @@ -0,0 +1,751 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * The HTTP referrers (websites) that are allowed to use the key.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.BrowserKeyRestrictions} + */ +public final class BrowserKeyRestrictions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.BrowserKeyRestrictions) + BrowserKeyRestrictionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use BrowserKeyRestrictions.newBuilder() to construct. + private BrowserKeyRestrictions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BrowserKeyRestrictions() { + allowedReferrers_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BrowserKeyRestrictions(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BrowserKeyRestrictions( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + allowedReferrers_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + allowedReferrers_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + allowedReferrers_ = allowedReferrers_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_BrowserKeyRestrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_BrowserKeyRestrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.BrowserKeyRestrictions.class, + com.google.api.apikeys.v2.BrowserKeyRestrictions.Builder.class); + } + + public static final int ALLOWED_REFERRERS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList allowedReferrers_; + /** + * + * + *
+   * A list of regular expressions for the referrer URLs that are allowed
+   * to make API calls with this key.
+   * 
+ * + * repeated string allowed_referrers = 1; + * + * @return A list containing the allowedReferrers. + */ + public com.google.protobuf.ProtocolStringList getAllowedReferrersList() { + return allowedReferrers_; + } + /** + * + * + *
+   * A list of regular expressions for the referrer URLs that are allowed
+   * to make API calls with this key.
+   * 
+ * + * repeated string allowed_referrers = 1; + * + * @return The count of allowedReferrers. + */ + public int getAllowedReferrersCount() { + return allowedReferrers_.size(); + } + /** + * + * + *
+   * A list of regular expressions for the referrer URLs that are allowed
+   * to make API calls with this key.
+   * 
+ * + * repeated string allowed_referrers = 1; + * + * @param index The index of the element to return. + * @return The allowedReferrers at the given index. + */ + public java.lang.String getAllowedReferrers(int index) { + return allowedReferrers_.get(index); + } + /** + * + * + *
+   * A list of regular expressions for the referrer URLs that are allowed
+   * to make API calls with this key.
+   * 
+ * + * repeated string allowed_referrers = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedReferrers at the given index. + */ + public com.google.protobuf.ByteString getAllowedReferrersBytes(int index) { + return allowedReferrers_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < allowedReferrers_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, allowedReferrers_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < allowedReferrers_.size(); i++) { + dataSize += computeStringSizeNoTag(allowedReferrers_.getRaw(i)); + } + size += dataSize; + size += 1 * getAllowedReferrersList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.BrowserKeyRestrictions)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.BrowserKeyRestrictions other = + (com.google.api.apikeys.v2.BrowserKeyRestrictions) obj; + + if (!getAllowedReferrersList().equals(other.getAllowedReferrersList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAllowedReferrersCount() > 0) { + hash = (37 * hash) + ALLOWED_REFERRERS_FIELD_NUMBER; + hash = (53 * hash) + getAllowedReferrersList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.BrowserKeyRestrictions prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The HTTP referrers (websites) that are allowed to use the key.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.BrowserKeyRestrictions} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.BrowserKeyRestrictions) + com.google.api.apikeys.v2.BrowserKeyRestrictionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_BrowserKeyRestrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_BrowserKeyRestrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.BrowserKeyRestrictions.class, + com.google.api.apikeys.v2.BrowserKeyRestrictions.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.BrowserKeyRestrictions.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + allowedReferrers_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_BrowserKeyRestrictions_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.BrowserKeyRestrictions getDefaultInstanceForType() { + return com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.BrowserKeyRestrictions build() { + com.google.api.apikeys.v2.BrowserKeyRestrictions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.BrowserKeyRestrictions buildPartial() { + com.google.api.apikeys.v2.BrowserKeyRestrictions result = + new com.google.api.apikeys.v2.BrowserKeyRestrictions(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + allowedReferrers_ = allowedReferrers_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.allowedReferrers_ = allowedReferrers_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.BrowserKeyRestrictions) { + return mergeFrom((com.google.api.apikeys.v2.BrowserKeyRestrictions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.BrowserKeyRestrictions other) { + if (other == com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance()) + return this; + if (!other.allowedReferrers_.isEmpty()) { + if (allowedReferrers_.isEmpty()) { + allowedReferrers_ = other.allowedReferrers_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAllowedReferrersIsMutable(); + allowedReferrers_.addAll(other.allowedReferrers_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.BrowserKeyRestrictions parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.BrowserKeyRestrictions) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList allowedReferrers_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureAllowedReferrersIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + allowedReferrers_ = new com.google.protobuf.LazyStringArrayList(allowedReferrers_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @return A list containing the allowedReferrers. + */ + public com.google.protobuf.ProtocolStringList getAllowedReferrersList() { + return allowedReferrers_.getUnmodifiableView(); + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @return The count of allowedReferrers. + */ + public int getAllowedReferrersCount() { + return allowedReferrers_.size(); + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @param index The index of the element to return. + * @return The allowedReferrers at the given index. + */ + public java.lang.String getAllowedReferrers(int index) { + return allowedReferrers_.get(index); + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedReferrers at the given index. + */ + public com.google.protobuf.ByteString getAllowedReferrersBytes(int index) { + return allowedReferrers_.getByteString(index); + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @param index The index to set the value at. + * @param value The allowedReferrers to set. + * @return This builder for chaining. + */ + public Builder setAllowedReferrers(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedReferrersIsMutable(); + allowedReferrers_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @param value The allowedReferrers to add. + * @return This builder for chaining. + */ + public Builder addAllowedReferrers(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedReferrersIsMutable(); + allowedReferrers_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @param values The allowedReferrers to add. + * @return This builder for chaining. + */ + public Builder addAllAllowedReferrers(java.lang.Iterable values) { + ensureAllowedReferrersIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, allowedReferrers_); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @return This builder for chaining. + */ + public Builder clearAllowedReferrers() { + allowedReferrers_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of regular expressions for the referrer URLs that are allowed
+     * to make API calls with this key.
+     * 
+ * + * repeated string allowed_referrers = 1; + * + * @param value The bytes of the allowedReferrers to add. + * @return This builder for chaining. + */ + public Builder addAllowedReferrersBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAllowedReferrersIsMutable(); + allowedReferrers_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.BrowserKeyRestrictions) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.BrowserKeyRestrictions) + private static final com.google.api.apikeys.v2.BrowserKeyRestrictions DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.BrowserKeyRestrictions(); + } + + public static com.google.api.apikeys.v2.BrowserKeyRestrictions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BrowserKeyRestrictions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BrowserKeyRestrictions(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.BrowserKeyRestrictions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictionsOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictionsOrBuilder.java new file mode 100644 index 0000000..daaba08 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictionsOrBuilder.java @@ -0,0 +1,80 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public interface BrowserKeyRestrictionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.BrowserKeyRestrictions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of regular expressions for the referrer URLs that are allowed
+   * to make API calls with this key.
+   * 
+ * + * repeated string allowed_referrers = 1; + * + * @return A list containing the allowedReferrers. + */ + java.util.List getAllowedReferrersList(); + /** + * + * + *
+   * A list of regular expressions for the referrer URLs that are allowed
+   * to make API calls with this key.
+   * 
+ * + * repeated string allowed_referrers = 1; + * + * @return The count of allowedReferrers. + */ + int getAllowedReferrersCount(); + /** + * + * + *
+   * A list of regular expressions for the referrer URLs that are allowed
+   * to make API calls with this key.
+   * 
+ * + * repeated string allowed_referrers = 1; + * + * @param index The index of the element to return. + * @return The allowedReferrers at the given index. + */ + java.lang.String getAllowedReferrers(int index); + /** + * + * + *
+   * A list of regular expressions for the referrer URLs that are allowed
+   * to make API calls with this key.
+   * 
+ * + * repeated string allowed_referrers = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedReferrers at the given index. + */ + com.google.protobuf.ByteString getAllowedReferrersBytes(int index); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequest.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequest.java new file mode 100644 index 0000000..86facde --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequest.java @@ -0,0 +1,1161 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Request message for `CreateKey` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.CreateKeyRequest} + */ +public final class CreateKeyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.CreateKeyRequest) + CreateKeyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateKeyRequest.newBuilder() to construct. + private CreateKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateKeyRequest() { + parent_ = ""; + keyId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateKeyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.api.apikeys.v2.Key.Builder subBuilder = null; + if (key_ != null) { + subBuilder = key_.toBuilder(); + } + key_ = input.readMessage(com.google.api.apikeys.v2.Key.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(key_); + key_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + keyId_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_CreateKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_CreateKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.CreateKeyRequest.class, + com.google.api.apikeys.v2.CreateKeyRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The project in which the API key is created.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The project in which the API key is created.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KEY_FIELD_NUMBER = 2; + private com.google.api.apikeys.v2.Key key_; + /** + * + * + *
+   * Required. The API key fields to set at creation time.
+   * You can configure only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the key field is set. + */ + @java.lang.Override + public boolean hasKey() { + return key_ != null; + } + /** + * + * + *
+   * Required. The API key fields to set at creation time.
+   * You can configure only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + @java.lang.Override + public com.google.api.apikeys.v2.Key getKey() { + return key_ == null ? com.google.api.apikeys.v2.Key.getDefaultInstance() : key_; + } + /** + * + * + *
+   * Required. The API key fields to set at creation time.
+   * You can configure only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.api.apikeys.v2.KeyOrBuilder getKeyOrBuilder() { + return getKey(); + } + + public static final int KEY_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object keyId_; + /** + * + * + *
+   * User specified key id (optional). If specified, it will become the final
+   * component of the key resource name.
+   * The id must be unique within the project, must conform with RFC-1034,
+   * is restricted to lower-cased letters, and has a maximum length of 63
+   * characters. In another word, the id must match the regular
+   * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+   * The id must NOT be a UUID-like string.
+   * 
+ * + * string key_id = 3; + * + * @return The keyId. + */ + @java.lang.Override + public java.lang.String getKeyId() { + java.lang.Object ref = keyId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyId_ = s; + return s; + } + } + /** + * + * + *
+   * User specified key id (optional). If specified, it will become the final
+   * component of the key resource name.
+   * The id must be unique within the project, must conform with RFC-1034,
+   * is restricted to lower-cased letters, and has a maximum length of 63
+   * characters. In another word, the id must match the regular
+   * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+   * The id must NOT be a UUID-like string.
+   * 
+ * + * string key_id = 3; + * + * @return The bytes for keyId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKeyIdBytes() { + java.lang.Object ref = keyId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + keyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (key_ != null) { + output.writeMessage(2, getKey()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(keyId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, keyId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (key_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getKey()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(keyId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, keyId_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.CreateKeyRequest)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.CreateKeyRequest other = + (com.google.api.apikeys.v2.CreateKeyRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasKey() != other.hasKey()) return false; + if (hasKey()) { + if (!getKey().equals(other.getKey())) return false; + } + if (!getKeyId().equals(other.getKeyId())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasKey()) { + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + } + hash = (37 * hash) + KEY_ID_FIELD_NUMBER; + hash = (53 * hash) + getKeyId().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.CreateKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `CreateKey` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.CreateKeyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.CreateKeyRequest) + com.google.api.apikeys.v2.CreateKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_CreateKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_CreateKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.CreateKeyRequest.class, + com.google.api.apikeys.v2.CreateKeyRequest.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.CreateKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (keyBuilder_ == null) { + key_ = null; + } else { + key_ = null; + keyBuilder_ = null; + } + keyId_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_CreateKeyRequest_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.CreateKeyRequest getDefaultInstanceForType() { + return com.google.api.apikeys.v2.CreateKeyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.CreateKeyRequest build() { + com.google.api.apikeys.v2.CreateKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.CreateKeyRequest buildPartial() { + com.google.api.apikeys.v2.CreateKeyRequest result = + new com.google.api.apikeys.v2.CreateKeyRequest(this); + result.parent_ = parent_; + if (keyBuilder_ == null) { + result.key_ = key_; + } else { + result.key_ = keyBuilder_.build(); + } + result.keyId_ = keyId_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.CreateKeyRequest) { + return mergeFrom((com.google.api.apikeys.v2.CreateKeyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.CreateKeyRequest other) { + if (other == com.google.api.apikeys.v2.CreateKeyRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasKey()) { + mergeKey(other.getKey()); + } + if (!other.getKeyId().isEmpty()) { + keyId_ = other.keyId_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.CreateKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.CreateKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The project in which the API key is created.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The project in which the API key is created.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The project in which the API key is created.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project in which the API key is created.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The project in which the API key is created.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.api.apikeys.v2.Key key_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder> + keyBuilder_; + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the key field is set. + */ + public boolean hasKey() { + return keyBuilder_ != null || key_ != null; + } + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + public com.google.api.apikeys.v2.Key getKey() { + if (keyBuilder_ == null) { + return key_ == null ? com.google.api.apikeys.v2.Key.getDefaultInstance() : key_; + } else { + return keyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setKey(com.google.api.apikeys.v2.Key value) { + if (keyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + key_ = value; + onChanged(); + } else { + keyBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setKey(com.google.api.apikeys.v2.Key.Builder builderForValue) { + if (keyBuilder_ == null) { + key_ = builderForValue.build(); + onChanged(); + } else { + keyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeKey(com.google.api.apikeys.v2.Key value) { + if (keyBuilder_ == null) { + if (key_ != null) { + key_ = com.google.api.apikeys.v2.Key.newBuilder(key_).mergeFrom(value).buildPartial(); + } else { + key_ = value; + } + onChanged(); + } else { + keyBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearKey() { + if (keyBuilder_ == null) { + key_ = null; + onChanged(); + } else { + key_ = null; + keyBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.api.apikeys.v2.Key.Builder getKeyBuilder() { + + onChanged(); + return getKeyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.api.apikeys.v2.KeyOrBuilder getKeyOrBuilder() { + if (keyBuilder_ != null) { + return keyBuilder_.getMessageOrBuilder(); + } else { + return key_ == null ? com.google.api.apikeys.v2.Key.getDefaultInstance() : key_; + } + } + /** + * + * + *
+     * Required. The API key fields to set at creation time.
+     * You can configure only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder> + getKeyFieldBuilder() { + if (keyBuilder_ == null) { + keyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder>( + getKey(), getParentForChildren(), isClean()); + key_ = null; + } + return keyBuilder_; + } + + private java.lang.Object keyId_ = ""; + /** + * + * + *
+     * User specified key id (optional). If specified, it will become the final
+     * component of the key resource name.
+     * The id must be unique within the project, must conform with RFC-1034,
+     * is restricted to lower-cased letters, and has a maximum length of 63
+     * characters. In another word, the id must match the regular
+     * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+     * The id must NOT be a UUID-like string.
+     * 
+ * + * string key_id = 3; + * + * @return The keyId. + */ + public java.lang.String getKeyId() { + java.lang.Object ref = keyId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * User specified key id (optional). If specified, it will become the final
+     * component of the key resource name.
+     * The id must be unique within the project, must conform with RFC-1034,
+     * is restricted to lower-cased letters, and has a maximum length of 63
+     * characters. In another word, the id must match the regular
+     * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+     * The id must NOT be a UUID-like string.
+     * 
+ * + * string key_id = 3; + * + * @return The bytes for keyId. + */ + public com.google.protobuf.ByteString getKeyIdBytes() { + java.lang.Object ref = keyId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + keyId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * User specified key id (optional). If specified, it will become the final
+     * component of the key resource name.
+     * The id must be unique within the project, must conform with RFC-1034,
+     * is restricted to lower-cased letters, and has a maximum length of 63
+     * characters. In another word, the id must match the regular
+     * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+     * The id must NOT be a UUID-like string.
+     * 
+ * + * string key_id = 3; + * + * @param value The keyId to set. + * @return This builder for chaining. + */ + public Builder setKeyId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + keyId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * User specified key id (optional). If specified, it will become the final
+     * component of the key resource name.
+     * The id must be unique within the project, must conform with RFC-1034,
+     * is restricted to lower-cased letters, and has a maximum length of 63
+     * characters. In another word, the id must match the regular
+     * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+     * The id must NOT be a UUID-like string.
+     * 
+ * + * string key_id = 3; + * + * @return This builder for chaining. + */ + public Builder clearKeyId() { + + keyId_ = getDefaultInstance().getKeyId(); + onChanged(); + return this; + } + /** + * + * + *
+     * User specified key id (optional). If specified, it will become the final
+     * component of the key resource name.
+     * The id must be unique within the project, must conform with RFC-1034,
+     * is restricted to lower-cased letters, and has a maximum length of 63
+     * characters. In another word, the id must match the regular
+     * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+     * The id must NOT be a UUID-like string.
+     * 
+ * + * string key_id = 3; + * + * @param value The bytes for keyId to set. + * @return This builder for chaining. + */ + public Builder setKeyIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + keyId_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.CreateKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.CreateKeyRequest) + private static final com.google.api.apikeys.v2.CreateKeyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.CreateKeyRequest(); + } + + public static com.google.api.apikeys.v2.CreateKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.CreateKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequestOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequestOrBuilder.java new file mode 100644 index 0000000..e81ac4f --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequestOrBuilder.java @@ -0,0 +1,132 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface CreateKeyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.CreateKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The project in which the API key is created.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The project in which the API key is created.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The API key fields to set at creation time.
+   * You can configure only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the key field is set. + */ + boolean hasKey(); + /** + * + * + *
+   * Required. The API key fields to set at creation time.
+   * You can configure only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + com.google.api.apikeys.v2.Key getKey(); + /** + * + * + *
+   * Required. The API key fields to set at creation time.
+   * You can configure only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.api.apikeys.v2.KeyOrBuilder getKeyOrBuilder(); + + /** + * + * + *
+   * User specified key id (optional). If specified, it will become the final
+   * component of the key resource name.
+   * The id must be unique within the project, must conform with RFC-1034,
+   * is restricted to lower-cased letters, and has a maximum length of 63
+   * characters. In another word, the id must match the regular
+   * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+   * The id must NOT be a UUID-like string.
+   * 
+ * + * string key_id = 3; + * + * @return The keyId. + */ + java.lang.String getKeyId(); + /** + * + * + *
+   * User specified key id (optional). If specified, it will become the final
+   * component of the key resource name.
+   * The id must be unique within the project, must conform with RFC-1034,
+   * is restricted to lower-cased letters, and has a maximum length of 63
+   * characters. In another word, the id must match the regular
+   * expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`.
+   * The id must NOT be a UUID-like string.
+   * 
+ * + * string key_id = 3; + * + * @return The bytes for keyId. + */ + com.google.protobuf.ByteString getKeyIdBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequest.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequest.java new file mode 100644 index 0000000..55ef7b1 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequest.java @@ -0,0 +1,836 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Request message for `DeleteKey` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.DeleteKeyRequest} + */ +public final class DeleteKeyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.DeleteKeyRequest) + DeleteKeyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteKeyRequest.newBuilder() to construct. + private DeleteKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteKeyRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteKeyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_DeleteKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_DeleteKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.DeleteKeyRequest.class, + com.google.api.apikeys.v2.DeleteKeyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the API key to be deleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the API key to be deleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ETAG_FIELD_NUMBER = 2; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Optional. The etag known to the client for the expected state of the key.
+   * This is to be used for optimistic concurrency.
+   * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The etag known to the client for the expected state of the key.
+   * This is to be used for optimistic concurrency.
+   * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, etag_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, etag_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.DeleteKeyRequest)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.DeleteKeyRequest other = + (com.google.api.apikeys.v2.DeleteKeyRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.DeleteKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `DeleteKey` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.DeleteKeyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.DeleteKeyRequest) + com.google.api.apikeys.v2.DeleteKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_DeleteKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_DeleteKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.DeleteKeyRequest.class, + com.google.api.apikeys.v2.DeleteKeyRequest.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.DeleteKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_DeleteKeyRequest_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.DeleteKeyRequest getDefaultInstanceForType() { + return com.google.api.apikeys.v2.DeleteKeyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.DeleteKeyRequest build() { + com.google.api.apikeys.v2.DeleteKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.DeleteKeyRequest buildPartial() { + com.google.api.apikeys.v2.DeleteKeyRequest result = + new com.google.api.apikeys.v2.DeleteKeyRequest(this); + result.name_ = name_; + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.DeleteKeyRequest) { + return mergeFrom((com.google.api.apikeys.v2.DeleteKeyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.DeleteKeyRequest other) { + if (other == com.google.api.apikeys.v2.DeleteKeyRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.DeleteKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.DeleteKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the API key to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the API key to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the API key to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the API key to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the API key to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Optional. The etag known to the client for the expected state of the key.
+     * This is to be used for optimistic concurrency.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The etag known to the client for the expected state of the key.
+     * This is to be used for optimistic concurrency.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The etag known to the client for the expected state of the key.
+     * This is to be used for optimistic concurrency.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The etag known to the client for the expected state of the key.
+     * This is to be used for optimistic concurrency.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The etag known to the client for the expected state of the key.
+     * This is to be used for optimistic concurrency.
+     * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.DeleteKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.DeleteKeyRequest) + private static final com.google.api.apikeys.v2.DeleteKeyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.DeleteKeyRequest(); + } + + public static com.google.api.apikeys.v2.DeleteKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.DeleteKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequestOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequestOrBuilder.java new file mode 100644 index 0000000..e64c8bd --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequestOrBuilder.java @@ -0,0 +1,81 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface DeleteKeyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.DeleteKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the API key to be deleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the API key to be deleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Optional. The etag known to the client for the expected state of the key.
+   * This is to be used for optimistic concurrency.
+   * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Optional. The etag known to the client for the expected state of the key.
+   * This is to be used for optimistic concurrency.
+   * 
+ * + * string etag = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequest.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequest.java new file mode 100644 index 0000000..e3fb962 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequest.java @@ -0,0 +1,649 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Request message for `GetKey` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.GetKeyRequest} + */ +public final class GetKeyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.GetKeyRequest) + GetKeyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetKeyRequest.newBuilder() to construct. + private GetKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetKeyRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetKeyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.GetKeyRequest.class, + com.google.api.apikeys.v2.GetKeyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the API key to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the API key to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.GetKeyRequest)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.GetKeyRequest other = (com.google.api.apikeys.v2.GetKeyRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.GetKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `GetKey` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.GetKeyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.GetKeyRequest) + com.google.api.apikeys.v2.GetKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.GetKeyRequest.class, + com.google.api.apikeys.v2.GetKeyRequest.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.GetKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyRequest_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyRequest getDefaultInstanceForType() { + return com.google.api.apikeys.v2.GetKeyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyRequest build() { + com.google.api.apikeys.v2.GetKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyRequest buildPartial() { + com.google.api.apikeys.v2.GetKeyRequest result = + new com.google.api.apikeys.v2.GetKeyRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.GetKeyRequest) { + return mergeFrom((com.google.api.apikeys.v2.GetKeyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.GetKeyRequest other) { + if (other == com.google.api.apikeys.v2.GetKeyRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.GetKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.GetKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the API key to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the API key to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the API key to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the API key to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the API key to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.GetKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.GetKeyRequest) + private static final com.google.api.apikeys.v2.GetKeyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.GetKeyRequest(); + } + + public static com.google.api.apikeys.v2.GetKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequestOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequestOrBuilder.java new file mode 100644 index 0000000..7c60373 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequestOrBuilder.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface GetKeyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.GetKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the API key to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the API key to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequest.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequest.java new file mode 100644 index 0000000..15d510b --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequest.java @@ -0,0 +1,650 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Request message for `GetKeyString` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.GetKeyStringRequest} + */ +public final class GetKeyStringRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.GetKeyStringRequest) + GetKeyStringRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetKeyStringRequest.newBuilder() to construct. + private GetKeyStringRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetKeyStringRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetKeyStringRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetKeyStringRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.GetKeyStringRequest.class, + com.google.api.apikeys.v2.GetKeyStringRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the API key to be retrieved.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the API key to be retrieved.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.GetKeyStringRequest)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.GetKeyStringRequest other = + (com.google.api.apikeys.v2.GetKeyStringRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.GetKeyStringRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `GetKeyString` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.GetKeyStringRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.GetKeyStringRequest) + com.google.api.apikeys.v2.GetKeyStringRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.GetKeyStringRequest.class, + com.google.api.apikeys.v2.GetKeyStringRequest.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.GetKeyStringRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringRequest_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyStringRequest getDefaultInstanceForType() { + return com.google.api.apikeys.v2.GetKeyStringRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyStringRequest build() { + com.google.api.apikeys.v2.GetKeyStringRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyStringRequest buildPartial() { + com.google.api.apikeys.v2.GetKeyStringRequest result = + new com.google.api.apikeys.v2.GetKeyStringRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.GetKeyStringRequest) { + return mergeFrom((com.google.api.apikeys.v2.GetKeyStringRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.GetKeyStringRequest other) { + if (other == com.google.api.apikeys.v2.GetKeyStringRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.GetKeyStringRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.GetKeyStringRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the API key to be retrieved.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the API key to be retrieved.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the API key to be retrieved.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the API key to be retrieved.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the API key to be retrieved.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.GetKeyStringRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.GetKeyStringRequest) + private static final com.google.api.apikeys.v2.GetKeyStringRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.GetKeyStringRequest(); + } + + public static com.google.api.apikeys.v2.GetKeyStringRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetKeyStringRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetKeyStringRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyStringRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequestOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequestOrBuilder.java new file mode 100644 index 0000000..8bc4300 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequestOrBuilder.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface GetKeyStringRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.GetKeyStringRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the API key to be retrieved.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the API key to be retrieved.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponse.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponse.java new file mode 100644 index 0000000..7bc3508 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponse.java @@ -0,0 +1,636 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Response message for `GetKeyString` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.GetKeyStringResponse} + */ +public final class GetKeyStringResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.GetKeyStringResponse) + GetKeyStringResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetKeyStringResponse.newBuilder() to construct. + private GetKeyStringResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetKeyStringResponse() { + keyString_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetKeyStringResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetKeyStringResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + keyString_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.GetKeyStringResponse.class, + com.google.api.apikeys.v2.GetKeyStringResponse.Builder.class); + } + + public static final int KEY_STRING_FIELD_NUMBER = 1; + private volatile java.lang.Object keyString_; + /** + * + * + *
+   * An encrypted and signed value of the key.
+   * 
+ * + * string key_string = 1; + * + * @return The keyString. + */ + @java.lang.Override + public java.lang.String getKeyString() { + java.lang.Object ref = keyString_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyString_ = s; + return s; + } + } + /** + * + * + *
+   * An encrypted and signed value of the key.
+   * 
+ * + * string key_string = 1; + * + * @return The bytes for keyString. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKeyStringBytes() { + java.lang.Object ref = keyString_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + keyString_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(keyString_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, keyString_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(keyString_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, keyString_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.GetKeyStringResponse)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.GetKeyStringResponse other = + (com.google.api.apikeys.v2.GetKeyStringResponse) obj; + + if (!getKeyString().equals(other.getKeyString())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_STRING_FIELD_NUMBER; + hash = (53 * hash) + getKeyString().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.GetKeyStringResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for `GetKeyString` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.GetKeyStringResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.GetKeyStringResponse) + com.google.api.apikeys.v2.GetKeyStringResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.GetKeyStringResponse.class, + com.google.api.apikeys.v2.GetKeyStringResponse.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.GetKeyStringResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + keyString_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_GetKeyStringResponse_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyStringResponse getDefaultInstanceForType() { + return com.google.api.apikeys.v2.GetKeyStringResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyStringResponse build() { + com.google.api.apikeys.v2.GetKeyStringResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyStringResponse buildPartial() { + com.google.api.apikeys.v2.GetKeyStringResponse result = + new com.google.api.apikeys.v2.GetKeyStringResponse(this); + result.keyString_ = keyString_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.GetKeyStringResponse) { + return mergeFrom((com.google.api.apikeys.v2.GetKeyStringResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.GetKeyStringResponse other) { + if (other == com.google.api.apikeys.v2.GetKeyStringResponse.getDefaultInstance()) return this; + if (!other.getKeyString().isEmpty()) { + keyString_ = other.keyString_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.GetKeyStringResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.GetKeyStringResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object keyString_ = ""; + /** + * + * + *
+     * An encrypted and signed value of the key.
+     * 
+ * + * string key_string = 1; + * + * @return The keyString. + */ + public java.lang.String getKeyString() { + java.lang.Object ref = keyString_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyString_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * An encrypted and signed value of the key.
+     * 
+ * + * string key_string = 1; + * + * @return The bytes for keyString. + */ + public com.google.protobuf.ByteString getKeyStringBytes() { + java.lang.Object ref = keyString_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + keyString_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * An encrypted and signed value of the key.
+     * 
+ * + * string key_string = 1; + * + * @param value The keyString to set. + * @return This builder for chaining. + */ + public Builder setKeyString(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + keyString_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * An encrypted and signed value of the key.
+     * 
+ * + * string key_string = 1; + * + * @return This builder for chaining. + */ + public Builder clearKeyString() { + + keyString_ = getDefaultInstance().getKeyString(); + onChanged(); + return this; + } + /** + * + * + *
+     * An encrypted and signed value of the key.
+     * 
+ * + * string key_string = 1; + * + * @param value The bytes for keyString to set. + * @return This builder for chaining. + */ + public Builder setKeyStringBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + keyString_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.GetKeyStringResponse) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.GetKeyStringResponse) + private static final com.google.api.apikeys.v2.GetKeyStringResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.GetKeyStringResponse(); + } + + public static com.google.api.apikeys.v2.GetKeyStringResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetKeyStringResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetKeyStringResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.GetKeyStringResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponseOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponseOrBuilder.java new file mode 100644 index 0000000..0eb9452 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponseOrBuilder.java @@ -0,0 +1,50 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface GetKeyStringResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.GetKeyStringResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * An encrypted and signed value of the key.
+   * 
+ * + * string key_string = 1; + * + * @return The keyString. + */ + java.lang.String getKeyString(); + /** + * + * + *
+   * An encrypted and signed value of the key.
+   * 
+ * + * string key_string = 1; + * + * @return The bytes for keyString. + */ + com.google.protobuf.ByteString getKeyStringBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictions.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictions.java new file mode 100644 index 0000000..abf81d5 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictions.java @@ -0,0 +1,737 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * The iOS apps that are allowed to use the key.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.IosKeyRestrictions} + */ +public final class IosKeyRestrictions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.IosKeyRestrictions) + IosKeyRestrictionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use IosKeyRestrictions.newBuilder() to construct. + private IosKeyRestrictions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private IosKeyRestrictions() { + allowedBundleIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new IosKeyRestrictions(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private IosKeyRestrictions( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + allowedBundleIds_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + allowedBundleIds_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + allowedBundleIds_ = allowedBundleIds_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_IosKeyRestrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_IosKeyRestrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.IosKeyRestrictions.class, + com.google.api.apikeys.v2.IosKeyRestrictions.Builder.class); + } + + public static final int ALLOWED_BUNDLE_IDS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList allowedBundleIds_; + /** + * + * + *
+   * A list of bundle IDs that are allowed when making API calls with this key.
+   * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @return A list containing the allowedBundleIds. + */ + public com.google.protobuf.ProtocolStringList getAllowedBundleIdsList() { + return allowedBundleIds_; + } + /** + * + * + *
+   * A list of bundle IDs that are allowed when making API calls with this key.
+   * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @return The count of allowedBundleIds. + */ + public int getAllowedBundleIdsCount() { + return allowedBundleIds_.size(); + } + /** + * + * + *
+   * A list of bundle IDs that are allowed when making API calls with this key.
+   * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param index The index of the element to return. + * @return The allowedBundleIds at the given index. + */ + public java.lang.String getAllowedBundleIds(int index) { + return allowedBundleIds_.get(index); + } + /** + * + * + *
+   * A list of bundle IDs that are allowed when making API calls with this key.
+   * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedBundleIds at the given index. + */ + public com.google.protobuf.ByteString getAllowedBundleIdsBytes(int index) { + return allowedBundleIds_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < allowedBundleIds_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, allowedBundleIds_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < allowedBundleIds_.size(); i++) { + dataSize += computeStringSizeNoTag(allowedBundleIds_.getRaw(i)); + } + size += dataSize; + size += 1 * getAllowedBundleIdsList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.IosKeyRestrictions)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.IosKeyRestrictions other = + (com.google.api.apikeys.v2.IosKeyRestrictions) obj; + + if (!getAllowedBundleIdsList().equals(other.getAllowedBundleIdsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAllowedBundleIdsCount() > 0) { + hash = (37 * hash) + ALLOWED_BUNDLE_IDS_FIELD_NUMBER; + hash = (53 * hash) + getAllowedBundleIdsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.IosKeyRestrictions prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The iOS apps that are allowed to use the key.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.IosKeyRestrictions} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.IosKeyRestrictions) + com.google.api.apikeys.v2.IosKeyRestrictionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_IosKeyRestrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_IosKeyRestrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.IosKeyRestrictions.class, + com.google.api.apikeys.v2.IosKeyRestrictions.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.IosKeyRestrictions.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + allowedBundleIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_IosKeyRestrictions_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.IosKeyRestrictions getDefaultInstanceForType() { + return com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.IosKeyRestrictions build() { + com.google.api.apikeys.v2.IosKeyRestrictions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.IosKeyRestrictions buildPartial() { + com.google.api.apikeys.v2.IosKeyRestrictions result = + new com.google.api.apikeys.v2.IosKeyRestrictions(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + allowedBundleIds_ = allowedBundleIds_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.allowedBundleIds_ = allowedBundleIds_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.IosKeyRestrictions) { + return mergeFrom((com.google.api.apikeys.v2.IosKeyRestrictions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.IosKeyRestrictions other) { + if (other == com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance()) return this; + if (!other.allowedBundleIds_.isEmpty()) { + if (allowedBundleIds_.isEmpty()) { + allowedBundleIds_ = other.allowedBundleIds_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAllowedBundleIdsIsMutable(); + allowedBundleIds_.addAll(other.allowedBundleIds_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.IosKeyRestrictions parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.IosKeyRestrictions) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList allowedBundleIds_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureAllowedBundleIdsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + allowedBundleIds_ = new com.google.protobuf.LazyStringArrayList(allowedBundleIds_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @return A list containing the allowedBundleIds. + */ + public com.google.protobuf.ProtocolStringList getAllowedBundleIdsList() { + return allowedBundleIds_.getUnmodifiableView(); + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @return The count of allowedBundleIds. + */ + public int getAllowedBundleIdsCount() { + return allowedBundleIds_.size(); + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param index The index of the element to return. + * @return The allowedBundleIds at the given index. + */ + public java.lang.String getAllowedBundleIds(int index) { + return allowedBundleIds_.get(index); + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedBundleIds at the given index. + */ + public com.google.protobuf.ByteString getAllowedBundleIdsBytes(int index) { + return allowedBundleIds_.getByteString(index); + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param index The index to set the value at. + * @param value The allowedBundleIds to set. + * @return This builder for chaining. + */ + public Builder setAllowedBundleIds(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedBundleIdsIsMutable(); + allowedBundleIds_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param value The allowedBundleIds to add. + * @return This builder for chaining. + */ + public Builder addAllowedBundleIds(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedBundleIdsIsMutable(); + allowedBundleIds_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param values The allowedBundleIds to add. + * @return This builder for chaining. + */ + public Builder addAllAllowedBundleIds(java.lang.Iterable values) { + ensureAllowedBundleIdsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, allowedBundleIds_); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @return This builder for chaining. + */ + public Builder clearAllowedBundleIds() { + allowedBundleIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of bundle IDs that are allowed when making API calls with this key.
+     * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param value The bytes of the allowedBundleIds to add. + * @return This builder for chaining. + */ + public Builder addAllowedBundleIdsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAllowedBundleIdsIsMutable(); + allowedBundleIds_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.IosKeyRestrictions) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.IosKeyRestrictions) + private static final com.google.api.apikeys.v2.IosKeyRestrictions DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.IosKeyRestrictions(); + } + + public static com.google.api.apikeys.v2.IosKeyRestrictions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public IosKeyRestrictions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new IosKeyRestrictions(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.IosKeyRestrictions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictionsOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictionsOrBuilder.java new file mode 100644 index 0000000..ca39266 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictionsOrBuilder.java @@ -0,0 +1,76 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public interface IosKeyRestrictionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.IosKeyRestrictions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of bundle IDs that are allowed when making API calls with this key.
+   * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @return A list containing the allowedBundleIds. + */ + java.util.List getAllowedBundleIdsList(); + /** + * + * + *
+   * A list of bundle IDs that are allowed when making API calls with this key.
+   * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @return The count of allowedBundleIds. + */ + int getAllowedBundleIdsCount(); + /** + * + * + *
+   * A list of bundle IDs that are allowed when making API calls with this key.
+   * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param index The index of the element to return. + * @return The allowedBundleIds at the given index. + */ + java.lang.String getAllowedBundleIds(int index); + /** + * + * + *
+   * A list of bundle IDs that are allowed when making API calls with this key.
+   * 
+ * + * repeated string allowed_bundle_ids = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedBundleIds at the given index. + */ + com.google.protobuf.ByteString getAllowedBundleIdsBytes(int index); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Key.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Key.java new file mode 100644 index 0000000..efc6d96 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Key.java @@ -0,0 +1,2970 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * The representation of a key managed by the API Keys API.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.Key} + */ +public final class Key extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.Key) + KeyOrBuilder { + private static final long serialVersionUID = 0L; + // Use Key.newBuilder() to construct. + private Key(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Key() { + name_ = ""; + uid_ = ""; + displayName_ = ""; + keyString_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Key(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Key( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + keyString_ = s; + break; + } + case 34: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + uid_ = s; + break; + } + case 50: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (deleteTime_ != null) { + subBuilder = deleteTime_.toBuilder(); + } + deleteTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(deleteTime_); + deleteTime_ = subBuilder.buildPartial(); + } + + break; + } + case 66: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + annotations_ = + com.google.protobuf.MapField.newMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000001; + } + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + annotations_.getMutableMap().put(annotations__.getKey(), annotations__.getValue()); + break; + } + case 74: + { + com.google.api.apikeys.v2.Restrictions.Builder subBuilder = null; + if (restrictions_ != null) { + subBuilder = restrictions_.toBuilder(); + } + restrictions_ = + input.readMessage( + com.google.api.apikeys.v2.Restrictions.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(restrictions_); + restrictions_ = subBuilder.buildPartial(); + } + + break; + } + case 90: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Key_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 8: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Key_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.Key.class, com.google.api.apikeys.v2.Key.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. The resource name of the key.
+   * The `name` has the form:
+   * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+   * For example:
+   * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+   * NOTE: Key is a global resource; hence the only supported value for
+   * location is `global`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The resource name of the key.
+   * The `name` has the form:
+   * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+   * For example:
+   * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+   * NOTE: Key is a global resource; hence the only supported value for
+   * location is `global`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 5; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Output only. Unique id in UUID4 format.
+   * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Unique id in UUID4 format.
+   * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * Human-readable display name of this key that you can modify.
+   * The maximum length is 63 characters.
+   * 
+ * + * string display_name = 2; + * + * @return The displayName. + */ + @java.lang.Override + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * Human-readable display name of this key that you can modify.
+   * The maximum length is 63 characters.
+   * 
+ * + * string display_name = 2; + * + * @return The bytes for displayName. + */ + @java.lang.Override + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int KEY_STRING_FIELD_NUMBER = 3; + private volatile java.lang.Object keyString_; + /** + * + * + *
+   * Output only. An encrypted and signed value held by this key.
+   * This field can be accessed only through the `GetKeyString` method.
+   * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The keyString. + */ + @java.lang.Override + public java.lang.String getKeyString() { + java.lang.Object ref = keyString_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyString_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. An encrypted and signed value held by this key.
+   * This field can be accessed only through the `GetKeyString` method.
+   * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for keyString. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKeyStringBytes() { + java.lang.Object ref = keyString_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + keyString_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was originally
+   * created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was originally
+   * created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was originally
+   * created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was last
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was last
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was last
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int DELETE_TIME_FIELD_NUMBER = 7; + private com.google.protobuf.Timestamp deleteTime_; + /** + * + * + *
+   * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+   * this must be empty.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + @java.lang.Override + public boolean hasDeleteTime() { + return deleteTime_ != null; + } + /** + * + * + *
+   * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+   * this must be empty.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getDeleteTime() { + return deleteTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : deleteTime_; + } + /** + * + * + *
+   * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+   * this must be empty.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + return getDeleteTime(); + } + + public static final int ANNOTATIONS_FIELD_NUMBER = 8; + + private static final class AnnotationsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Key_AnnotationsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int RESTRICTIONS_FIELD_NUMBER = 9; + private com.google.api.apikeys.v2.Restrictions restrictions_; + /** + * + * + *
+   * Key restrictions.
+   * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + * + * @return Whether the restrictions field is set. + */ + @java.lang.Override + public boolean hasRestrictions() { + return restrictions_ != null; + } + /** + * + * + *
+   * Key restrictions.
+   * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + * + * @return The restrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.Restrictions getRestrictions() { + return restrictions_ == null + ? com.google.api.apikeys.v2.Restrictions.getDefaultInstance() + : restrictions_; + } + /** + * + * + *
+   * Key restrictions.
+   * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + @java.lang.Override + public com.google.api.apikeys.v2.RestrictionsOrBuilder getRestrictionsOrBuilder() { + return getRestrictions(); + } + + public static final int ETAG_FIELD_NUMBER = 11; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Output only. A checksum computed by the server based on the current value of the Key
+   * resource. This may be sent on update and delete requests to ensure the
+   * client has an up-to-date value before proceeding.
+   * See https://google.aip.dev/154.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. A checksum computed by the server based on the current value of the Key
+   * resource. This may be sent on update and delete requests to ensure the
+   * client has an up-to-date value before proceeding.
+   * See https://google.aip.dev/154.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(keyString_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, keyString_); + } + if (createTime_ != null) { + output.writeMessage(4, getCreateTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, uid_); + } + if (updateTime_ != null) { + output.writeMessage(6, getUpdateTime()); + } + if (deleteTime_ != null) { + output.writeMessage(7, getDeleteTime()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetAnnotations(), AnnotationsDefaultEntryHolder.defaultEntry, 8); + if (restrictions_ != null) { + output.writeMessage(9, getRestrictions()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 11, etag_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(displayName_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(keyString_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, keyString_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getCreateTime()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, uid_); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getUpdateTime()); + } + if (deleteTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getDeleteTime()); + } + for (java.util.Map.Entry entry : + internalGetAnnotations().getMap().entrySet()) { + com.google.protobuf.MapEntry annotations__ = + AnnotationsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, annotations__); + } + if (restrictions_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getRestrictions()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(etag_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(11, etag_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.Key)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.Key other = (com.google.api.apikeys.v2.Key) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!getKeyString().equals(other.getKeyString())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (hasDeleteTime() != other.hasDeleteTime()) return false; + if (hasDeleteTime()) { + if (!getDeleteTime().equals(other.getDeleteTime())) return false; + } + if (!internalGetAnnotations().equals(other.internalGetAnnotations())) return false; + if (hasRestrictions() != other.hasRestrictions()) return false; + if (hasRestrictions()) { + if (!getRestrictions().equals(other.getRestrictions())) return false; + } + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + KEY_STRING_FIELD_NUMBER; + hash = (53 * hash) + getKeyString().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (hasDeleteTime()) { + hash = (37 * hash) + DELETE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getDeleteTime().hashCode(); + } + if (!internalGetAnnotations().getMap().isEmpty()) { + hash = (37 * hash) + ANNOTATIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetAnnotations().hashCode(); + } + if (hasRestrictions()) { + hash = (37 * hash) + RESTRICTIONS_FIELD_NUMBER; + hash = (53 * hash) + getRestrictions().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.Key parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.Key parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Key parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.Key parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Key parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.Key parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Key parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.Key parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Key parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.Key parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Key parseFrom(com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.Key parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.Key prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The representation of a key managed by the API Keys API.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.Key} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.Key) + com.google.api.apikeys.v2.KeyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Key_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 8: + return internalGetAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 8: + return internalGetMutableAnnotations(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Key_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.Key.class, com.google.api.apikeys.v2.Key.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.Key.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + displayName_ = ""; + + keyString_ = ""; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + internalGetMutableAnnotations().clear(); + if (restrictionsBuilder_ == null) { + restrictions_ = null; + } else { + restrictions_ = null; + restrictionsBuilder_ = null; + } + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Key_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.Key getDefaultInstanceForType() { + return com.google.api.apikeys.v2.Key.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.Key build() { + com.google.api.apikeys.v2.Key result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.Key buildPartial() { + com.google.api.apikeys.v2.Key result = new com.google.api.apikeys.v2.Key(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + result.displayName_ = displayName_; + result.keyString_ = keyString_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (deleteTimeBuilder_ == null) { + result.deleteTime_ = deleteTime_; + } else { + result.deleteTime_ = deleteTimeBuilder_.build(); + } + result.annotations_ = internalGetAnnotations(); + result.annotations_.makeImmutable(); + if (restrictionsBuilder_ == null) { + result.restrictions_ = restrictions_; + } else { + result.restrictions_ = restrictionsBuilder_.build(); + } + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.Key) { + return mergeFrom((com.google.api.apikeys.v2.Key) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.Key other) { + if (other == com.google.api.apikeys.v2.Key.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (!other.getKeyString().isEmpty()) { + keyString_ = other.keyString_; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (other.hasDeleteTime()) { + mergeDeleteTime(other.getDeleteTime()); + } + internalGetMutableAnnotations().mergeFrom(other.internalGetAnnotations()); + if (other.hasRestrictions()) { + mergeRestrictions(other.getRestrictions()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.Key parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.Key) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. The resource name of the key.
+     * The `name` has the form:
+     * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+     * For example:
+     * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the key.
+     * The `name` has the form:
+     * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+     * For example:
+     * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The resource name of the key.
+     * The `name` has the form:
+     * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+     * For example:
+     * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the key.
+     * The `name` has the form:
+     * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+     * For example:
+     * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The resource name of the key.
+     * The `name` has the form:
+     * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+     * For example:
+     * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+     * NOTE: Key is a global resource; hence the only supported value for
+     * location is `global`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. Unique id in UUID4 format.
+     * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Unique id in UUID4 format.
+     * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Unique id in UUID4 format.
+     * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Unique id in UUID4 format.
+     * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Unique id in UUID4 format.
+     * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * Human-readable display name of this key that you can modify.
+     * The maximum length is 63 characters.
+     * 
+ * + * string display_name = 2; + * + * @return The displayName. + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Human-readable display name of this key that you can modify.
+     * The maximum length is 63 characters.
+     * 
+ * + * string display_name = 2; + * + * @return The bytes for displayName. + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Human-readable display name of this key that you can modify.
+     * The maximum length is 63 characters.
+     * 
+ * + * string display_name = 2; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Human-readable display name of this key that you can modify.
+     * The maximum length is 63 characters.
+     * 
+ * + * string display_name = 2; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Human-readable display name of this key that you can modify.
+     * The maximum length is 63 characters.
+     * 
+ * + * string display_name = 2; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private java.lang.Object keyString_ = ""; + /** + * + * + *
+     * Output only. An encrypted and signed value held by this key.
+     * This field can be accessed only through the `GetKeyString` method.
+     * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The keyString. + */ + public java.lang.String getKeyString() { + java.lang.Object ref = keyString_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyString_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. An encrypted and signed value held by this key.
+     * This field can be accessed only through the `GetKeyString` method.
+     * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for keyString. + */ + public com.google.protobuf.ByteString getKeyStringBytes() { + java.lang.Object ref = keyString_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + keyString_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. An encrypted and signed value held by this key.
+     * This field can be accessed only through the `GetKeyString` method.
+     * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The keyString to set. + * @return This builder for chaining. + */ + public Builder setKeyString(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + keyString_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. An encrypted and signed value held by this key.
+     * This field can be accessed only through the `GetKeyString` method.
+     * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearKeyString() { + + keyString_ = getDefaultInstance().getKeyString(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. An encrypted and signed value held by this key.
+     * This field can be accessed only through the `GetKeyString` method.
+     * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for keyString to set. + * @return This builder for chaining. + */ + public Builder setKeyStringBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + keyString_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was originally
+     * created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. A timestamp identifying the time this key was last
+     * updated.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.Timestamp deleteTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + deleteTimeBuilder_; + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + public boolean hasDeleteTime() { + return deleteTimeBuilder_ != null || deleteTime_ != null; + } + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + public com.google.protobuf.Timestamp getDeleteTime() { + if (deleteTimeBuilder_ == null) { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } else { + return deleteTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deleteTime_ = value; + onChanged(); + } else { + deleteTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setDeleteTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (deleteTimeBuilder_ == null) { + deleteTime_ = builderForValue.build(); + onChanged(); + } else { + deleteTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeDeleteTime(com.google.protobuf.Timestamp value) { + if (deleteTimeBuilder_ == null) { + if (deleteTime_ != null) { + deleteTime_ = + com.google.protobuf.Timestamp.newBuilder(deleteTime_).mergeFrom(value).buildPartial(); + } else { + deleteTime_ = value; + } + onChanged(); + } else { + deleteTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearDeleteTime() { + if (deleteTimeBuilder_ == null) { + deleteTime_ = null; + onChanged(); + } else { + deleteTime_ = null; + deleteTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getDeleteTimeBuilder() { + + onChanged(); + return getDeleteTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder() { + if (deleteTimeBuilder_ != null) { + return deleteTimeBuilder_.getMessageOrBuilder(); + } else { + return deleteTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : deleteTime_; + } + } + /** + * + * + *
+     * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+     * this must be empty.
+     * 
+ * + * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getDeleteTimeFieldBuilder() { + if (deleteTimeBuilder_ == null) { + deleteTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getDeleteTime(), getParentForChildren(), isClean()); + deleteTime_ = null; + } + return deleteTimeBuilder_; + } + + private com.google.protobuf.MapField annotations_; + + private com.google.protobuf.MapField + internalGetAnnotations() { + if (annotations_ == null) { + return com.google.protobuf.MapField.emptyMapField( + AnnotationsDefaultEntryHolder.defaultEntry); + } + return annotations_; + } + + private com.google.protobuf.MapField + internalGetMutableAnnotations() { + onChanged(); + ; + if (annotations_ == null) { + annotations_ = + com.google.protobuf.MapField.newMapField(AnnotationsDefaultEntryHolder.defaultEntry); + } + if (!annotations_.isMutable()) { + annotations_ = annotations_.copy(); + } + return annotations_; + } + + public int getAnnotationsCount() { + return internalGetAnnotations().getMap().size(); + } + /** + * + * + *
+     * Annotations is an unstructured key-value map stored with a policy that
+     * may be set by external tools to store and retrieve arbitrary metadata.
+     * They are not queryable and should be preserved when modifying objects.
+     * 
+ * + * map<string, string> annotations = 8; + */ + @java.lang.Override + public boolean containsAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetAnnotations().getMap().containsKey(key); + } + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getAnnotations() { + return getAnnotationsMap(); + } + /** + * + * + *
+     * Annotations is an unstructured key-value map stored with a policy that
+     * may be set by external tools to store and retrieve arbitrary metadata.
+     * They are not queryable and should be preserved when modifying objects.
+     * 
+ * + * map<string, string> annotations = 8; + */ + @java.lang.Override + public java.util.Map getAnnotationsMap() { + return internalGetAnnotations().getMap(); + } + /** + * + * + *
+     * Annotations is an unstructured key-value map stored with a policy that
+     * may be set by external tools to store and retrieve arbitrary metadata.
+     * They are not queryable and should be preserved when modifying objects.
+     * 
+ * + * map<string, string> annotations = 8; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Annotations is an unstructured key-value map stored with a policy that
+     * may be set by external tools to store and retrieve arbitrary metadata.
+     * They are not queryable and should be preserved when modifying objects.
+     * 
+ * + * map<string, string> annotations = 8; + */ + @java.lang.Override + public java.lang.String getAnnotationsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetAnnotations().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearAnnotations() { + internalGetMutableAnnotations().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Annotations is an unstructured key-value map stored with a policy that
+     * may be set by external tools to store and retrieve arbitrary metadata.
+     * They are not queryable and should be preserved when modifying objects.
+     * 
+ * + * map<string, string> annotations = 8; + */ + public Builder removeAnnotations(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableAnnotations().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableAnnotations() { + return internalGetMutableAnnotations().getMutableMap(); + } + /** + * + * + *
+     * Annotations is an unstructured key-value map stored with a policy that
+     * may be set by external tools to store and retrieve arbitrary metadata.
+     * They are not queryable and should be preserved when modifying objects.
+     * 
+ * + * map<string, string> annotations = 8; + */ + public Builder putAnnotations(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + + internalGetMutableAnnotations().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Annotations is an unstructured key-value map stored with a policy that
+     * may be set by external tools to store and retrieve arbitrary metadata.
+     * They are not queryable and should be preserved when modifying objects.
+     * 
+ * + * map<string, string> annotations = 8; + */ + public Builder putAllAnnotations(java.util.Map values) { + internalGetMutableAnnotations().getMutableMap().putAll(values); + return this; + } + + private com.google.api.apikeys.v2.Restrictions restrictions_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Restrictions, + com.google.api.apikeys.v2.Restrictions.Builder, + com.google.api.apikeys.v2.RestrictionsOrBuilder> + restrictionsBuilder_; + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + * + * @return Whether the restrictions field is set. + */ + public boolean hasRestrictions() { + return restrictionsBuilder_ != null || restrictions_ != null; + } + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + * + * @return The restrictions. + */ + public com.google.api.apikeys.v2.Restrictions getRestrictions() { + if (restrictionsBuilder_ == null) { + return restrictions_ == null + ? com.google.api.apikeys.v2.Restrictions.getDefaultInstance() + : restrictions_; + } else { + return restrictionsBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + public Builder setRestrictions(com.google.api.apikeys.v2.Restrictions value) { + if (restrictionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + restrictions_ = value; + onChanged(); + } else { + restrictionsBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + public Builder setRestrictions(com.google.api.apikeys.v2.Restrictions.Builder builderForValue) { + if (restrictionsBuilder_ == null) { + restrictions_ = builderForValue.build(); + onChanged(); + } else { + restrictionsBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + public Builder mergeRestrictions(com.google.api.apikeys.v2.Restrictions value) { + if (restrictionsBuilder_ == null) { + if (restrictions_ != null) { + restrictions_ = + com.google.api.apikeys.v2.Restrictions.newBuilder(restrictions_) + .mergeFrom(value) + .buildPartial(); + } else { + restrictions_ = value; + } + onChanged(); + } else { + restrictionsBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + public Builder clearRestrictions() { + if (restrictionsBuilder_ == null) { + restrictions_ = null; + onChanged(); + } else { + restrictions_ = null; + restrictionsBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + public com.google.api.apikeys.v2.Restrictions.Builder getRestrictionsBuilder() { + + onChanged(); + return getRestrictionsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + public com.google.api.apikeys.v2.RestrictionsOrBuilder getRestrictionsOrBuilder() { + if (restrictionsBuilder_ != null) { + return restrictionsBuilder_.getMessageOrBuilder(); + } else { + return restrictions_ == null + ? com.google.api.apikeys.v2.Restrictions.getDefaultInstance() + : restrictions_; + } + } + /** + * + * + *
+     * Key restrictions.
+     * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Restrictions, + com.google.api.apikeys.v2.Restrictions.Builder, + com.google.api.apikeys.v2.RestrictionsOrBuilder> + getRestrictionsFieldBuilder() { + if (restrictionsBuilder_ == null) { + restrictionsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Restrictions, + com.google.api.apikeys.v2.Restrictions.Builder, + com.google.api.apikeys.v2.RestrictionsOrBuilder>( + getRestrictions(), getParentForChildren(), isClean()); + restrictions_ = null; + } + return restrictionsBuilder_; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Output only. A checksum computed by the server based on the current value of the Key
+     * resource. This may be sent on update and delete requests to ensure the
+     * client has an up-to-date value before proceeding.
+     * See https://google.aip.dev/154.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. A checksum computed by the server based on the current value of the Key
+     * resource. This may be sent on update and delete requests to ensure the
+     * client has an up-to-date value before proceeding.
+     * See https://google.aip.dev/154.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. A checksum computed by the server based on the current value of the Key
+     * resource. This may be sent on update and delete requests to ensure the
+     * client has an up-to-date value before proceeding.
+     * See https://google.aip.dev/154.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A checksum computed by the server based on the current value of the Key
+     * resource. This may be sent on update and delete requests to ensure the
+     * client has an up-to-date value before proceeding.
+     * See https://google.aip.dev/154.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A checksum computed by the server based on the current value of the Key
+     * resource. This may be sent on update and delete requests to ensure the
+     * client has an up-to-date value before proceeding.
+     * See https://google.aip.dev/154.
+     * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.Key) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.Key) + private static final com.google.api.apikeys.v2.Key DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.Key(); + } + + public static com.google.api.apikeys.v2.Key getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Key parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Key(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.Key getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyName.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyName.java new file mode 100644 index 0000000..04ac83e --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyName.java @@ -0,0 +1,216 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class KeyName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_KEY = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/keys/{key}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String key; + + @Deprecated + protected KeyName() { + project = null; + location = null; + key = null; + } + + private KeyName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + key = Preconditions.checkNotNull(builder.getKey()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKey() { + return key; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static KeyName of(String project, String location, String key) { + return newBuilder().setProject(project).setLocation(location).setKey(key).build(); + } + + public static String format(String project, String location, String key) { + return newBuilder().setProject(project).setLocation(location).setKey(key).build().toString(); + } + + public static KeyName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_KEY.validatedMatch( + formattedString, "KeyName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("key")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (KeyName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_KEY.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (key != null) { + fieldMapBuilder.put("key", key); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_KEY.instantiate("project", project, "location", location, "key", key); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + KeyName that = ((KeyName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.key, that.key); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(key); + return h; + } + + /** Builder for projects/{project}/locations/{location}/keys/{key}. */ + public static class Builder { + private String project; + private String location; + private String key; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getKey() { + return key; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + private Builder(KeyName keyName) { + this.project = keyName.project; + this.location = keyName.location; + this.key = keyName.key; + } + + public KeyName build() { + return new KeyName(this); + } + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyOrBuilder.java new file mode 100644 index 0000000..ba79f1a --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyOrBuilder.java @@ -0,0 +1,399 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public interface KeyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.Key) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The resource name of the key.
+   * The `name` has the form:
+   * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+   * For example:
+   * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+   * NOTE: Key is a global resource; hence the only supported value for
+   * location is `global`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. The resource name of the key.
+   * The `name` has the form:
+   * `projects/<PROJECT_NUMBER>/locations/global/keys/<KEY_ID>`.
+   * For example:
+   * `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2`
+   * NOTE: Key is a global resource; hence the only supported value for
+   * location is `global`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. Unique id in UUID4 format.
+   * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. Unique id in UUID4 format.
+   * 
+ * + * string uid = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * Human-readable display name of this key that you can modify.
+   * The maximum length is 63 characters.
+   * 
+ * + * string display_name = 2; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * Human-readable display name of this key that you can modify.
+   * The maximum length is 63 characters.
+   * 
+ * + * string display_name = 2; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Output only. An encrypted and signed value held by this key.
+   * This field can be accessed only through the `GetKeyString` method.
+   * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The keyString. + */ + java.lang.String getKeyString(); + /** + * + * + *
+   * Output only. An encrypted and signed value held by this key.
+   * This field can be accessed only through the `GetKeyString` method.
+   * 
+ * + * string key_string = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for keyString. + */ + com.google.protobuf.ByteString getKeyStringBytes(); + + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was originally
+   * created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was originally
+   * created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was originally
+   * created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was last
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was last
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. A timestamp identifying the time this key was last
+   * updated.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+   * this must be empty.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the deleteTime field is set. + */ + boolean hasDeleteTime(); + /** + * + * + *
+   * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+   * this must be empty.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The deleteTime. + */ + com.google.protobuf.Timestamp getDeleteTime(); + /** + * + * + *
+   * Output only. A timestamp when this key was deleted. If the resource is not deleted,
+   * this must be empty.
+   * 
+ * + * .google.protobuf.Timestamp delete_time = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getDeleteTimeOrBuilder(); + + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + int getAnnotationsCount(); + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + boolean containsAnnotations(java.lang.String key); + /** Use {@link #getAnnotationsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getAnnotations(); + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + java.util.Map getAnnotationsMap(); + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + + /* nullable */ + java.lang.String getAnnotationsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * Annotations is an unstructured key-value map stored with a policy that
+   * may be set by external tools to store and retrieve arbitrary metadata.
+   * They are not queryable and should be preserved when modifying objects.
+   * 
+ * + * map<string, string> annotations = 8; + */ + java.lang.String getAnnotationsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Key restrictions.
+   * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + * + * @return Whether the restrictions field is set. + */ + boolean hasRestrictions(); + /** + * + * + *
+   * Key restrictions.
+   * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + * + * @return The restrictions. + */ + com.google.api.apikeys.v2.Restrictions getRestrictions(); + /** + * + * + *
+   * Key restrictions.
+   * 
+ * + * .google.api.apikeys.v2.Restrictions restrictions = 9; + */ + com.google.api.apikeys.v2.RestrictionsOrBuilder getRestrictionsOrBuilder(); + + /** + * + * + *
+   * Output only. A checksum computed by the server based on the current value of the Key
+   * resource. This may be sent on update and delete requests to ensure the
+   * client has an up-to-date value before proceeding.
+   * See https://google.aip.dev/154.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Output only. A checksum computed by the server based on the current value of the Key
+   * resource. This may be sent on update and delete requests to ensure the
+   * client has an up-to-date value before proceeding.
+   * See https://google.aip.dev/154.
+   * 
+ * + * string etag = 11 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequest.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequest.java new file mode 100644 index 0000000..dd59dfe --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequest.java @@ -0,0 +1,1013 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Request message for `ListKeys` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.ListKeysRequest} + */ +public final class ListKeysRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.ListKeysRequest) + ListKeysRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListKeysRequest.newBuilder() to construct. + private ListKeysRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListKeysRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListKeysRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListKeysRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 48: + { + showDeleted_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.ListKeysRequest.class, + com.google.api.apikeys.v2.ListKeysRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Lists all API keys associated with this project.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Lists all API keys associated with this project.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Optional. Specifies the maximum number of results to be returned at a time.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. Requests a specific page of results.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Requests a specific page of results.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SHOW_DELETED_FIELD_NUMBER = 6; + private boolean showDeleted_; + /** + * + * + *
+   * Optional. Indicate that keys deleted in the past 30 days should also be
+   * returned.
+   * 
+ * + * bool show_deleted = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + if (showDeleted_ != false) { + output.writeBool(6, showDeleted_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + if (showDeleted_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, showDeleted_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.ListKeysRequest)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.ListKeysRequest other = + (com.google.api.apikeys.v2.ListKeysRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (getShowDeleted() != other.getShowDeleted()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + SHOW_DELETED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getShowDeleted()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ListKeysRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.ListKeysRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `ListKeys` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.ListKeysRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.ListKeysRequest) + com.google.api.apikeys.v2.ListKeysRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.ListKeysRequest.class, + com.google.api.apikeys.v2.ListKeysRequest.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.ListKeysRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + showDeleted_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysRequest_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ListKeysRequest getDefaultInstanceForType() { + return com.google.api.apikeys.v2.ListKeysRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.ListKeysRequest build() { + com.google.api.apikeys.v2.ListKeysRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ListKeysRequest buildPartial() { + com.google.api.apikeys.v2.ListKeysRequest result = + new com.google.api.apikeys.v2.ListKeysRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.showDeleted_ = showDeleted_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.ListKeysRequest) { + return mergeFrom((com.google.api.apikeys.v2.ListKeysRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.ListKeysRequest other) { + if (other == com.google.api.apikeys.v2.ListKeysRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (other.getShowDeleted() != false) { + setShowDeleted(other.getShowDeleted()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.ListKeysRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.ListKeysRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Lists all API keys associated with this project.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Lists all API keys associated with this project.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Lists all API keys associated with this project.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Lists all API keys associated with this project.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Lists all API keys associated with this project.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. Specifies the maximum number of results to be returned at a time.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. Specifies the maximum number of results to be returned at a time.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Specifies the maximum number of results to be returned at a time.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. Requests a specific page of results.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Requests a specific page of results.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Requests a specific page of results.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Requests a specific page of results.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Requests a specific page of results.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private boolean showDeleted_; + /** + * + * + *
+     * Optional. Indicate that keys deleted in the past 30 days should also be
+     * returned.
+     * 
+ * + * bool show_deleted = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The showDeleted. + */ + @java.lang.Override + public boolean getShowDeleted() { + return showDeleted_; + } + /** + * + * + *
+     * Optional. Indicate that keys deleted in the past 30 days should also be
+     * returned.
+     * 
+ * + * bool show_deleted = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The showDeleted to set. + * @return This builder for chaining. + */ + public Builder setShowDeleted(boolean value) { + + showDeleted_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Indicate that keys deleted in the past 30 days should also be
+     * returned.
+     * 
+ * + * bool show_deleted = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearShowDeleted() { + + showDeleted_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.ListKeysRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.ListKeysRequest) + private static final com.google.api.apikeys.v2.ListKeysRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.ListKeysRequest(); + } + + public static com.google.api.apikeys.v2.ListKeysRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListKeysRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListKeysRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ListKeysRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequestOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequestOrBuilder.java new file mode 100644 index 0000000..60b7057 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequestOrBuilder.java @@ -0,0 +1,106 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface ListKeysRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.ListKeysRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Lists all API keys associated with this project.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Lists all API keys associated with this project.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. Specifies the maximum number of results to be returned at a time.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. Requests a specific page of results.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. Requests a specific page of results.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Optional. Indicate that keys deleted in the past 30 days should also be
+   * returned.
+   * 
+ * + * bool show_deleted = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The showDeleted. + */ + boolean getShowDeleted(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponse.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponse.java new file mode 100644 index 0000000..7f6e406 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponse.java @@ -0,0 +1,1119 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Response message for `ListKeys` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.ListKeysResponse} + */ +public final class ListKeysResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.ListKeysResponse) + ListKeysResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListKeysResponse.newBuilder() to construct. + private ListKeysResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListKeysResponse() { + keys_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListKeysResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListKeysResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + keys_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + keys_.add( + input.readMessage(com.google.api.apikeys.v2.Key.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + keys_ = java.util.Collections.unmodifiableList(keys_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.ListKeysResponse.class, + com.google.api.apikeys.v2.ListKeysResponse.Builder.class); + } + + public static final int KEYS_FIELD_NUMBER = 1; + private java.util.List keys_; + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + @java.lang.Override + public java.util.List getKeysList() { + return keys_; + } + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + @java.lang.Override + public java.util.List getKeysOrBuilderList() { + return keys_; + } + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + @java.lang.Override + public int getKeysCount() { + return keys_.size(); + } + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + @java.lang.Override + public com.google.api.apikeys.v2.Key getKeys(int index) { + return keys_.get(index); + } + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + @java.lang.Override + public com.google.api.apikeys.v2.KeyOrBuilder getKeysOrBuilder(int index) { + return keys_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * The pagination token for the next page of results.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * The pagination token for the next page of results.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < keys_.size(); i++) { + output.writeMessage(1, keys_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < keys_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, keys_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.ListKeysResponse)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.ListKeysResponse other = + (com.google.api.apikeys.v2.ListKeysResponse) obj; + + if (!getKeysList().equals(other.getKeysList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getKeysCount() > 0) { + hash = (37 * hash) + KEYS_FIELD_NUMBER; + hash = (53 * hash) + getKeysList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ListKeysResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.ListKeysResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for `ListKeys` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.ListKeysResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.ListKeysResponse) + com.google.api.apikeys.v2.ListKeysResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.ListKeysResponse.class, + com.google.api.apikeys.v2.ListKeysResponse.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.ListKeysResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getKeysFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (keysBuilder_ == null) { + keys_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + keysBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_ListKeysResponse_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ListKeysResponse getDefaultInstanceForType() { + return com.google.api.apikeys.v2.ListKeysResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.ListKeysResponse build() { + com.google.api.apikeys.v2.ListKeysResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ListKeysResponse buildPartial() { + com.google.api.apikeys.v2.ListKeysResponse result = + new com.google.api.apikeys.v2.ListKeysResponse(this); + int from_bitField0_ = bitField0_; + if (keysBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + keys_ = java.util.Collections.unmodifiableList(keys_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.keys_ = keys_; + } else { + result.keys_ = keysBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.ListKeysResponse) { + return mergeFrom((com.google.api.apikeys.v2.ListKeysResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.ListKeysResponse other) { + if (other == com.google.api.apikeys.v2.ListKeysResponse.getDefaultInstance()) return this; + if (keysBuilder_ == null) { + if (!other.keys_.isEmpty()) { + if (keys_.isEmpty()) { + keys_ = other.keys_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureKeysIsMutable(); + keys_.addAll(other.keys_); + } + onChanged(); + } + } else { + if (!other.keys_.isEmpty()) { + if (keysBuilder_.isEmpty()) { + keysBuilder_.dispose(); + keysBuilder_ = null; + keys_ = other.keys_; + bitField0_ = (bitField0_ & ~0x00000001); + keysBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getKeysFieldBuilder() + : null; + } else { + keysBuilder_.addAllMessages(other.keys_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.ListKeysResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.ListKeysResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List keys_ = java.util.Collections.emptyList(); + + private void ensureKeysIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + keys_ = new java.util.ArrayList(keys_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder> + keysBuilder_; + + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public java.util.List getKeysList() { + if (keysBuilder_ == null) { + return java.util.Collections.unmodifiableList(keys_); + } else { + return keysBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public int getKeysCount() { + if (keysBuilder_ == null) { + return keys_.size(); + } else { + return keysBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public com.google.api.apikeys.v2.Key getKeys(int index) { + if (keysBuilder_ == null) { + return keys_.get(index); + } else { + return keysBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder setKeys(int index, com.google.api.apikeys.v2.Key value) { + if (keysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.set(index, value); + onChanged(); + } else { + keysBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder setKeys(int index, com.google.api.apikeys.v2.Key.Builder builderForValue) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.set(index, builderForValue.build()); + onChanged(); + } else { + keysBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder addKeys(com.google.api.apikeys.v2.Key value) { + if (keysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.add(value); + onChanged(); + } else { + keysBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder addKeys(int index, com.google.api.apikeys.v2.Key value) { + if (keysBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureKeysIsMutable(); + keys_.add(index, value); + onChanged(); + } else { + keysBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder addKeys(com.google.api.apikeys.v2.Key.Builder builderForValue) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.add(builderForValue.build()); + onChanged(); + } else { + keysBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder addKeys(int index, com.google.api.apikeys.v2.Key.Builder builderForValue) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.add(index, builderForValue.build()); + onChanged(); + } else { + keysBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder addAllKeys(java.lang.Iterable values) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, keys_); + onChanged(); + } else { + keysBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder clearKeys() { + if (keysBuilder_ == null) { + keys_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + keysBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public Builder removeKeys(int index) { + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.remove(index); + onChanged(); + } else { + keysBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public com.google.api.apikeys.v2.Key.Builder getKeysBuilder(int index) { + return getKeysFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public com.google.api.apikeys.v2.KeyOrBuilder getKeysOrBuilder(int index) { + if (keysBuilder_ == null) { + return keys_.get(index); + } else { + return keysBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public java.util.List getKeysOrBuilderList() { + if (keysBuilder_ != null) { + return keysBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(keys_); + } + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public com.google.api.apikeys.v2.Key.Builder addKeysBuilder() { + return getKeysFieldBuilder().addBuilder(com.google.api.apikeys.v2.Key.getDefaultInstance()); + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public com.google.api.apikeys.v2.Key.Builder addKeysBuilder(int index) { + return getKeysFieldBuilder() + .addBuilder(index, com.google.api.apikeys.v2.Key.getDefaultInstance()); + } + /** + * + * + *
+     * A list of API keys.
+     * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + public java.util.List getKeysBuilderList() { + return getKeysFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder> + getKeysFieldBuilder() { + if (keysBuilder_ == null) { + keysBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder>( + keys_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + keys_ = null; + } + return keysBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * The pagination token for the next page of results.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The pagination token for the next page of results.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The pagination token for the next page of results.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The pagination token for the next page of results.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * The pagination token for the next page of results.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.ListKeysResponse) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.ListKeysResponse) + private static final com.google.api.apikeys.v2.ListKeysResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.ListKeysResponse(); + } + + public static com.google.api.apikeys.v2.ListKeysResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListKeysResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListKeysResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ListKeysResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponseOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponseOrBuilder.java new file mode 100644 index 0000000..bd4c16c --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponseOrBuilder.java @@ -0,0 +1,101 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface ListKeysResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.ListKeysResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + java.util.List getKeysList(); + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + com.google.api.apikeys.v2.Key getKeys(int index); + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + int getKeysCount(); + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + java.util.List getKeysOrBuilderList(); + /** + * + * + *
+   * A list of API keys.
+   * 
+ * + * repeated .google.api.apikeys.v2.Key keys = 1; + */ + com.google.api.apikeys.v2.KeyOrBuilder getKeysOrBuilder(int index); + + /** + * + * + *
+   * The pagination token for the next page of results.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * The pagination token for the next page of results.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LocationName.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LocationName.java new file mode 100644 index 0000000..8f4192f --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LocationName.java @@ -0,0 +1,192 @@ +/* + * Copyright 2022 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 + * + * https://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.api.apikeys.v2; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class LocationName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static LocationName of(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static LocationName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION.validatedMatch( + formattedString, "LocationName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (LocationName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION.instantiate("project", project, "location", location); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { + private String project; + private String location; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder(LocationName locationName) { + this.project = locationName.project; + this.location = locationName.location; + } + + public LocationName build() { + return new LocationName(this); + } + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequest.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequest.java new file mode 100644 index 0000000..75f2112 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequest.java @@ -0,0 +1,636 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Request message for `LookupKey` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.LookupKeyRequest} + */ +public final class LookupKeyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.LookupKeyRequest) + LookupKeyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use LookupKeyRequest.newBuilder() to construct. + private LookupKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private LookupKeyRequest() { + keyString_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new LookupKeyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private LookupKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + keyString_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.LookupKeyRequest.class, + com.google.api.apikeys.v2.LookupKeyRequest.Builder.class); + } + + public static final int KEY_STRING_FIELD_NUMBER = 1; + private volatile java.lang.Object keyString_; + /** + * + * + *
+   * Required. Finds the project that owns the key string value.
+   * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The keyString. + */ + @java.lang.Override + public java.lang.String getKeyString() { + java.lang.Object ref = keyString_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyString_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Finds the project that owns the key string value.
+   * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for keyString. + */ + @java.lang.Override + public com.google.protobuf.ByteString getKeyStringBytes() { + java.lang.Object ref = keyString_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + keyString_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(keyString_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, keyString_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(keyString_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, keyString_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.LookupKeyRequest)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.LookupKeyRequest other = + (com.google.api.apikeys.v2.LookupKeyRequest) obj; + + if (!getKeyString().equals(other.getKeyString())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + KEY_STRING_FIELD_NUMBER; + hash = (53 * hash) + getKeyString().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.LookupKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `LookupKey` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.LookupKeyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.LookupKeyRequest) + com.google.api.apikeys.v2.LookupKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.LookupKeyRequest.class, + com.google.api.apikeys.v2.LookupKeyRequest.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.LookupKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + keyString_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyRequest_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.LookupKeyRequest getDefaultInstanceForType() { + return com.google.api.apikeys.v2.LookupKeyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.LookupKeyRequest build() { + com.google.api.apikeys.v2.LookupKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.LookupKeyRequest buildPartial() { + com.google.api.apikeys.v2.LookupKeyRequest result = + new com.google.api.apikeys.v2.LookupKeyRequest(this); + result.keyString_ = keyString_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.LookupKeyRequest) { + return mergeFrom((com.google.api.apikeys.v2.LookupKeyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.LookupKeyRequest other) { + if (other == com.google.api.apikeys.v2.LookupKeyRequest.getDefaultInstance()) return this; + if (!other.getKeyString().isEmpty()) { + keyString_ = other.keyString_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.LookupKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.LookupKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object keyString_ = ""; + /** + * + * + *
+     * Required. Finds the project that owns the key string value.
+     * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The keyString. + */ + public java.lang.String getKeyString() { + java.lang.Object ref = keyString_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + keyString_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Finds the project that owns the key string value.
+     * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for keyString. + */ + public com.google.protobuf.ByteString getKeyStringBytes() { + java.lang.Object ref = keyString_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + keyString_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Finds the project that owns the key string value.
+     * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The keyString to set. + * @return This builder for chaining. + */ + public Builder setKeyString(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + keyString_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Finds the project that owns the key string value.
+     * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearKeyString() { + + keyString_ = getDefaultInstance().getKeyString(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Finds the project that owns the key string value.
+     * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for keyString to set. + * @return This builder for chaining. + */ + public Builder setKeyStringBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + keyString_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.LookupKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.LookupKeyRequest) + private static final com.google.api.apikeys.v2.LookupKeyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.LookupKeyRequest(); + } + + public static com.google.api.apikeys.v2.LookupKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LookupKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LookupKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.LookupKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequestOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequestOrBuilder.java new file mode 100644 index 0000000..df8452b --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequestOrBuilder.java @@ -0,0 +1,50 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface LookupKeyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.LookupKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Finds the project that owns the key string value.
+   * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The keyString. + */ + java.lang.String getKeyString(); + /** + * + * + *
+   * Required. Finds the project that owns the key string value.
+   * 
+ * + * string key_string = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for keyString. + */ + com.google.protobuf.ByteString getKeyStringBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponse.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponse.java new file mode 100644 index 0000000..86af6d1 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponse.java @@ -0,0 +1,822 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Response message for `LookupKey` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.LookupKeyResponse} + */ +public final class LookupKeyResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.LookupKeyResponse) + LookupKeyResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use LookupKeyResponse.newBuilder() to construct. + private LookupKeyResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private LookupKeyResponse() { + parent_ = ""; + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new LookupKeyResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private LookupKeyResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.LookupKeyResponse.class, + com.google.api.apikeys.v2.LookupKeyResponse.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * The project that owns the key with the value specified in the request.
+   * 
+ * + * string parent = 1; + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * The project that owns the key with the value specified in the request.
+   * 
+ * + * string parent = 1; + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The resource name of the API key. If the API key has been purged,
+   * resource name is empty.
+   * 
+ * + * string name = 2; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The resource name of the API key. If the API key has been purged,
+   * resource name is empty.
+   * 
+ * + * string name = 2; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.LookupKeyResponse)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.LookupKeyResponse other = + (com.google.api.apikeys.v2.LookupKeyResponse) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.LookupKeyResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for `LookupKey` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.LookupKeyResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.LookupKeyResponse) + com.google.api.apikeys.v2.LookupKeyResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.LookupKeyResponse.class, + com.google.api.apikeys.v2.LookupKeyResponse.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.LookupKeyResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_LookupKeyResponse_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.LookupKeyResponse getDefaultInstanceForType() { + return com.google.api.apikeys.v2.LookupKeyResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.LookupKeyResponse build() { + com.google.api.apikeys.v2.LookupKeyResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.LookupKeyResponse buildPartial() { + com.google.api.apikeys.v2.LookupKeyResponse result = + new com.google.api.apikeys.v2.LookupKeyResponse(this); + result.parent_ = parent_; + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.LookupKeyResponse) { + return mergeFrom((com.google.api.apikeys.v2.LookupKeyResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.LookupKeyResponse other) { + if (other == com.google.api.apikeys.v2.LookupKeyResponse.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.LookupKeyResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.LookupKeyResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * The project that owns the key with the value specified in the request.
+     * 
+ * + * string parent = 1; + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The project that owns the key with the value specified in the request.
+     * 
+ * + * string parent = 1; + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The project that owns the key with the value specified in the request.
+     * 
+ * + * string parent = 1; + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The project that owns the key with the value specified in the request.
+     * 
+ * + * string parent = 1; + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * The project that owns the key with the value specified in the request.
+     * 
+ * + * string parent = 1; + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The resource name of the API key. If the API key has been purged,
+     * resource name is empty.
+     * 
+ * + * string name = 2; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource name of the API key. If the API key has been purged,
+     * resource name is empty.
+     * 
+ * + * string name = 2; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource name of the API key. If the API key has been purged,
+     * resource name is empty.
+     * 
+ * + * string name = 2; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name of the API key. If the API key has been purged,
+     * resource name is empty.
+     * 
+ * + * string name = 2; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name of the API key. If the API key has been purged,
+     * resource name is empty.
+     * 
+ * + * string name = 2; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.LookupKeyResponse) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.LookupKeyResponse) + private static final com.google.api.apikeys.v2.LookupKeyResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.LookupKeyResponse(); + } + + public static com.google.api.apikeys.v2.LookupKeyResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LookupKeyResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LookupKeyResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.LookupKeyResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponseOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponseOrBuilder.java new file mode 100644 index 0000000..7870f6c --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponseOrBuilder.java @@ -0,0 +1,77 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface LookupKeyResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.LookupKeyResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The project that owns the key with the value specified in the request.
+   * 
+ * + * string parent = 1; + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * The project that owns the key with the value specified in the request.
+   * 
+ * + * string parent = 1; + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The resource name of the API key. If the API key has been purged,
+   * resource name is empty.
+   * 
+ * + * string name = 2; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The resource name of the API key. If the API key has been purged,
+   * resource name is empty.
+   * 
+ * + * string name = 2; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ResourcesProto.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ResourcesProto.java new file mode 100644 index 0000000..73ebcdc --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ResourcesProto.java @@ -0,0 +1,224 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public final class ResourcesProto { + private ResourcesProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_Key_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_Key_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_Key_AnnotationsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_Key_AnnotationsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_Restrictions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_Restrictions_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_BrowserKeyRestrictions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_BrowserKeyRestrictions_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_ServerKeyRestrictions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_ServerKeyRestrictions_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_AndroidKeyRestrictions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_AndroidKeyRestrictions_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_AndroidApplication_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_AndroidApplication_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_IosKeyRestrictions_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_IosKeyRestrictions_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_api_apikeys_v2_ApiTarget_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_api_apikeys_v2_ApiTarget_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n%google/api/apikeys/v2/resources.proto\022" + + "\025google.api.apikeys.v2\032\037google/api/field" + + "_behavior.proto\032\031google/api/resource.pro" + + "to\032\037google/protobuf/timestamp.proto\"\242\004\n\003" + + "Key\022\021\n\004name\030\001 \001(\tB\003\340A\003\022\020\n\003uid\030\005 \001(\tB\003\340A\003" + + "\022\024\n\014display_name\030\002 \001(\t\022\027\n\nkey_string\030\003 \001" + + "(\tB\003\340A\003\0224\n\013create_time\030\004 \001(\0132\032.google.pr" + + "otobuf.TimestampB\003\340A\003\0224\n\013update_time\030\006 \001" + + "(\0132\032.google.protobuf.TimestampB\003\340A\003\0224\n\013d" + + "elete_time\030\007 \001(\0132\032.google.protobuf.Times" + + "tampB\003\340A\003\022@\n\013annotations\030\010 \003(\0132+.google." + + "api.apikeys.v2.Key.AnnotationsEntry\0229\n\014r" + + "estrictions\030\t \001(\0132#.google.api.apikeys.v" + + "2.Restrictions\022\021\n\004etag\030\013 \001(\tB\003\340A\003\0322\n\020Ann" + + "otationsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(" + + "\t:\0028\001:a\352A^\n\032apikeys.googleapis.com/Key\0222" + + "projects/{project}/locations/{location}/" + + "keys/{key}*\004keys2\003keyR\001\001\"\236\003\n\014Restriction" + + "s\022Q\n\030browser_key_restrictions\030\001 \001(\0132-.go" + + "ogle.api.apikeys.v2.BrowserKeyRestrictio" + + "nsH\000\022O\n\027server_key_restrictions\030\002 \001(\0132,." + + "google.api.apikeys.v2.ServerKeyRestricti" + + "onsH\000\022Q\n\030android_key_restrictions\030\003 \001(\0132" + + "-.google.api.apikeys.v2.AndroidKeyRestri" + + "ctionsH\000\022I\n\024ios_key_restrictions\030\004 \001(\0132)" + + ".google.api.apikeys.v2.IosKeyRestriction" + + "sH\000\0225\n\013api_targets\030\005 \003(\0132 .google.api.ap" + + "ikeys.v2.ApiTargetB\025\n\023client_restriction" + + "s\"3\n\026BrowserKeyRestrictions\022\031\n\021allowed_r" + + "eferrers\030\001 \003(\t\",\n\025ServerKeyRestrictions\022" + + "\023\n\013allowed_ips\030\001 \003(\t\"a\n\026AndroidKeyRestri" + + "ctions\022G\n\024allowed_applications\030\001 \003(\0132).g" + + "oogle.api.apikeys.v2.AndroidApplication\"" + + "D\n\022AndroidApplication\022\030\n\020sha1_fingerprin" + + "t\030\001 \001(\t\022\024\n\014package_name\030\002 \001(\t\"0\n\022IosKeyR" + + "estrictions\022\032\n\022allowed_bundle_ids\030\001 \003(\t\"" + + "2\n\tApiTarget\022\017\n\007service\030\001 \001(\t\022\024\n\007methods" + + "\030\002 \003(\tB\003\340A\001B\274\001\n\031com.google.api.apikeys.v" + + "2B\016ResourcesProtoP\001Z + * Describes the restrictions on the key. + * + * + * Protobuf type {@code google.api.apikeys.v2.Restrictions} + */ +public final class Restrictions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.Restrictions) + RestrictionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use Restrictions.newBuilder() to construct. + private Restrictions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Restrictions() { + apiTargets_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Restrictions(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Restrictions( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.api.apikeys.v2.BrowserKeyRestrictions.Builder subBuilder = null; + if (clientRestrictionsCase_ == 1) { + subBuilder = + ((com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_) + .toBuilder(); + } + clientRestrictions_ = + input.readMessage( + com.google.api.apikeys.v2.BrowserKeyRestrictions.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_); + clientRestrictions_ = subBuilder.buildPartial(); + } + clientRestrictionsCase_ = 1; + break; + } + case 18: + { + com.google.api.apikeys.v2.ServerKeyRestrictions.Builder subBuilder = null; + if (clientRestrictionsCase_ == 2) { + subBuilder = + ((com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_) + .toBuilder(); + } + clientRestrictions_ = + input.readMessage( + com.google.api.apikeys.v2.ServerKeyRestrictions.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_); + clientRestrictions_ = subBuilder.buildPartial(); + } + clientRestrictionsCase_ = 2; + break; + } + case 26: + { + com.google.api.apikeys.v2.AndroidKeyRestrictions.Builder subBuilder = null; + if (clientRestrictionsCase_ == 3) { + subBuilder = + ((com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_) + .toBuilder(); + } + clientRestrictions_ = + input.readMessage( + com.google.api.apikeys.v2.AndroidKeyRestrictions.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_); + clientRestrictions_ = subBuilder.buildPartial(); + } + clientRestrictionsCase_ = 3; + break; + } + case 34: + { + com.google.api.apikeys.v2.IosKeyRestrictions.Builder subBuilder = null; + if (clientRestrictionsCase_ == 4) { + subBuilder = + ((com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_) + .toBuilder(); + } + clientRestrictions_ = + input.readMessage( + com.google.api.apikeys.v2.IosKeyRestrictions.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_); + clientRestrictions_ = subBuilder.buildPartial(); + } + clientRestrictionsCase_ = 4; + break; + } + case 42: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + apiTargets_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + apiTargets_.add( + input.readMessage( + com.google.api.apikeys.v2.ApiTarget.parser(), extensionRegistry)); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + apiTargets_ = java.util.Collections.unmodifiableList(apiTargets_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Restrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Restrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.Restrictions.class, + com.google.api.apikeys.v2.Restrictions.Builder.class); + } + + private int clientRestrictionsCase_ = 0; + private java.lang.Object clientRestrictions_; + + public enum ClientRestrictionsCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + BROWSER_KEY_RESTRICTIONS(1), + SERVER_KEY_RESTRICTIONS(2), + ANDROID_KEY_RESTRICTIONS(3), + IOS_KEY_RESTRICTIONS(4), + CLIENTRESTRICTIONS_NOT_SET(0); + private final int value; + + private ClientRestrictionsCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ClientRestrictionsCase valueOf(int value) { + return forNumber(value); + } + + public static ClientRestrictionsCase forNumber(int value) { + switch (value) { + case 1: + return BROWSER_KEY_RESTRICTIONS; + case 2: + return SERVER_KEY_RESTRICTIONS; + case 3: + return ANDROID_KEY_RESTRICTIONS; + case 4: + return IOS_KEY_RESTRICTIONS; + case 0: + return CLIENTRESTRICTIONS_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ClientRestrictionsCase getClientRestrictionsCase() { + return ClientRestrictionsCase.forNumber(clientRestrictionsCase_); + } + + public static final int BROWSER_KEY_RESTRICTIONS_FIELD_NUMBER = 1; + /** + * + * + *
+   * The HTTP referrers (websites) that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + * + * @return Whether the browserKeyRestrictions field is set. + */ + @java.lang.Override + public boolean hasBrowserKeyRestrictions() { + return clientRestrictionsCase_ == 1; + } + /** + * + * + *
+   * The HTTP referrers (websites) that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + * + * @return The browserKeyRestrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.BrowserKeyRestrictions getBrowserKeyRestrictions() { + if (clientRestrictionsCase_ == 1) { + return (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance(); + } + /** + * + * + *
+   * The HTTP referrers (websites) that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + @java.lang.Override + public com.google.api.apikeys.v2.BrowserKeyRestrictionsOrBuilder + getBrowserKeyRestrictionsOrBuilder() { + if (clientRestrictionsCase_ == 1) { + return (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance(); + } + + public static final int SERVER_KEY_RESTRICTIONS_FIELD_NUMBER = 2; + /** + * + * + *
+   * The IP addresses of callers that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + * + * @return Whether the serverKeyRestrictions field is set. + */ + @java.lang.Override + public boolean hasServerKeyRestrictions() { + return clientRestrictionsCase_ == 2; + } + /** + * + * + *
+   * The IP addresses of callers that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + * + * @return The serverKeyRestrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.ServerKeyRestrictions getServerKeyRestrictions() { + if (clientRestrictionsCase_ == 2) { + return (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance(); + } + /** + * + * + *
+   * The IP addresses of callers that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + @java.lang.Override + public com.google.api.apikeys.v2.ServerKeyRestrictionsOrBuilder + getServerKeyRestrictionsOrBuilder() { + if (clientRestrictionsCase_ == 2) { + return (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance(); + } + + public static final int ANDROID_KEY_RESTRICTIONS_FIELD_NUMBER = 3; + /** + * + * + *
+   * The Android apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + * + * @return Whether the androidKeyRestrictions field is set. + */ + @java.lang.Override + public boolean hasAndroidKeyRestrictions() { + return clientRestrictionsCase_ == 3; + } + /** + * + * + *
+   * The Android apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + * + * @return The androidKeyRestrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.AndroidKeyRestrictions getAndroidKeyRestrictions() { + if (clientRestrictionsCase_ == 3) { + return (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance(); + } + /** + * + * + *
+   * The Android apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + @java.lang.Override + public com.google.api.apikeys.v2.AndroidKeyRestrictionsOrBuilder + getAndroidKeyRestrictionsOrBuilder() { + if (clientRestrictionsCase_ == 3) { + return (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance(); + } + + public static final int IOS_KEY_RESTRICTIONS_FIELD_NUMBER = 4; + /** + * + * + *
+   * The iOS apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + * + * @return Whether the iosKeyRestrictions field is set. + */ + @java.lang.Override + public boolean hasIosKeyRestrictions() { + return clientRestrictionsCase_ == 4; + } + /** + * + * + *
+   * The iOS apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + * + * @return The iosKeyRestrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.IosKeyRestrictions getIosKeyRestrictions() { + if (clientRestrictionsCase_ == 4) { + return (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance(); + } + /** + * + * + *
+   * The iOS apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + @java.lang.Override + public com.google.api.apikeys.v2.IosKeyRestrictionsOrBuilder getIosKeyRestrictionsOrBuilder() { + if (clientRestrictionsCase_ == 4) { + return (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance(); + } + + public static final int API_TARGETS_FIELD_NUMBER = 5; + private java.util.List apiTargets_; + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + @java.lang.Override + public java.util.List getApiTargetsList() { + return apiTargets_; + } + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + @java.lang.Override + public java.util.List + getApiTargetsOrBuilderList() { + return apiTargets_; + } + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + @java.lang.Override + public int getApiTargetsCount() { + return apiTargets_.size(); + } + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + @java.lang.Override + public com.google.api.apikeys.v2.ApiTarget getApiTargets(int index) { + return apiTargets_.get(index); + } + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + @java.lang.Override + public com.google.api.apikeys.v2.ApiTargetOrBuilder getApiTargetsOrBuilder(int index) { + return apiTargets_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (clientRestrictionsCase_ == 1) { + output.writeMessage( + 1, (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_); + } + if (clientRestrictionsCase_ == 2) { + output.writeMessage(2, (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_); + } + if (clientRestrictionsCase_ == 3) { + output.writeMessage( + 3, (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_); + } + if (clientRestrictionsCase_ == 4) { + output.writeMessage(4, (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_); + } + for (int i = 0; i < apiTargets_.size(); i++) { + output.writeMessage(5, apiTargets_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (clientRestrictionsCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_); + } + if (clientRestrictionsCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_); + } + if (clientRestrictionsCase_ == 3) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 3, (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_); + } + if (clientRestrictionsCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_); + } + for (int i = 0; i < apiTargets_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, apiTargets_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.Restrictions)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.Restrictions other = (com.google.api.apikeys.v2.Restrictions) obj; + + if (!getApiTargetsList().equals(other.getApiTargetsList())) return false; + if (!getClientRestrictionsCase().equals(other.getClientRestrictionsCase())) return false; + switch (clientRestrictionsCase_) { + case 1: + if (!getBrowserKeyRestrictions().equals(other.getBrowserKeyRestrictions())) return false; + break; + case 2: + if (!getServerKeyRestrictions().equals(other.getServerKeyRestrictions())) return false; + break; + case 3: + if (!getAndroidKeyRestrictions().equals(other.getAndroidKeyRestrictions())) return false; + break; + case 4: + if (!getIosKeyRestrictions().equals(other.getIosKeyRestrictions())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getApiTargetsCount() > 0) { + hash = (37 * hash) + API_TARGETS_FIELD_NUMBER; + hash = (53 * hash) + getApiTargetsList().hashCode(); + } + switch (clientRestrictionsCase_) { + case 1: + hash = (37 * hash) + BROWSER_KEY_RESTRICTIONS_FIELD_NUMBER; + hash = (53 * hash) + getBrowserKeyRestrictions().hashCode(); + break; + case 2: + hash = (37 * hash) + SERVER_KEY_RESTRICTIONS_FIELD_NUMBER; + hash = (53 * hash) + getServerKeyRestrictions().hashCode(); + break; + case 3: + hash = (37 * hash) + ANDROID_KEY_RESTRICTIONS_FIELD_NUMBER; + hash = (53 * hash) + getAndroidKeyRestrictions().hashCode(); + break; + case 4: + hash = (37 * hash) + IOS_KEY_RESTRICTIONS_FIELD_NUMBER; + hash = (53 * hash) + getIosKeyRestrictions().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Restrictions parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.Restrictions parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.Restrictions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.Restrictions prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Describes the restrictions on the key.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.Restrictions} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.Restrictions) + com.google.api.apikeys.v2.RestrictionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Restrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Restrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.Restrictions.class, + com.google.api.apikeys.v2.Restrictions.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.Restrictions.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getApiTargetsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (apiTargetsBuilder_ == null) { + apiTargets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + apiTargetsBuilder_.clear(); + } + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_Restrictions_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.Restrictions getDefaultInstanceForType() { + return com.google.api.apikeys.v2.Restrictions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.Restrictions build() { + com.google.api.apikeys.v2.Restrictions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.Restrictions buildPartial() { + com.google.api.apikeys.v2.Restrictions result = + new com.google.api.apikeys.v2.Restrictions(this); + int from_bitField0_ = bitField0_; + if (clientRestrictionsCase_ == 1) { + if (browserKeyRestrictionsBuilder_ == null) { + result.clientRestrictions_ = clientRestrictions_; + } else { + result.clientRestrictions_ = browserKeyRestrictionsBuilder_.build(); + } + } + if (clientRestrictionsCase_ == 2) { + if (serverKeyRestrictionsBuilder_ == null) { + result.clientRestrictions_ = clientRestrictions_; + } else { + result.clientRestrictions_ = serverKeyRestrictionsBuilder_.build(); + } + } + if (clientRestrictionsCase_ == 3) { + if (androidKeyRestrictionsBuilder_ == null) { + result.clientRestrictions_ = clientRestrictions_; + } else { + result.clientRestrictions_ = androidKeyRestrictionsBuilder_.build(); + } + } + if (clientRestrictionsCase_ == 4) { + if (iosKeyRestrictionsBuilder_ == null) { + result.clientRestrictions_ = clientRestrictions_; + } else { + result.clientRestrictions_ = iosKeyRestrictionsBuilder_.build(); + } + } + if (apiTargetsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + apiTargets_ = java.util.Collections.unmodifiableList(apiTargets_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.apiTargets_ = apiTargets_; + } else { + result.apiTargets_ = apiTargetsBuilder_.build(); + } + result.clientRestrictionsCase_ = clientRestrictionsCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.Restrictions) { + return mergeFrom((com.google.api.apikeys.v2.Restrictions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.Restrictions other) { + if (other == com.google.api.apikeys.v2.Restrictions.getDefaultInstance()) return this; + if (apiTargetsBuilder_ == null) { + if (!other.apiTargets_.isEmpty()) { + if (apiTargets_.isEmpty()) { + apiTargets_ = other.apiTargets_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureApiTargetsIsMutable(); + apiTargets_.addAll(other.apiTargets_); + } + onChanged(); + } + } else { + if (!other.apiTargets_.isEmpty()) { + if (apiTargetsBuilder_.isEmpty()) { + apiTargetsBuilder_.dispose(); + apiTargetsBuilder_ = null; + apiTargets_ = other.apiTargets_; + bitField0_ = (bitField0_ & ~0x00000001); + apiTargetsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getApiTargetsFieldBuilder() + : null; + } else { + apiTargetsBuilder_.addAllMessages(other.apiTargets_); + } + } + } + switch (other.getClientRestrictionsCase()) { + case BROWSER_KEY_RESTRICTIONS: + { + mergeBrowserKeyRestrictions(other.getBrowserKeyRestrictions()); + break; + } + case SERVER_KEY_RESTRICTIONS: + { + mergeServerKeyRestrictions(other.getServerKeyRestrictions()); + break; + } + case ANDROID_KEY_RESTRICTIONS: + { + mergeAndroidKeyRestrictions(other.getAndroidKeyRestrictions()); + break; + } + case IOS_KEY_RESTRICTIONS: + { + mergeIosKeyRestrictions(other.getIosKeyRestrictions()); + break; + } + case CLIENTRESTRICTIONS_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.Restrictions parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.Restrictions) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int clientRestrictionsCase_ = 0; + private java.lang.Object clientRestrictions_; + + public ClientRestrictionsCase getClientRestrictionsCase() { + return ClientRestrictionsCase.forNumber(clientRestrictionsCase_); + } + + public Builder clearClientRestrictions() { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.BrowserKeyRestrictions, + com.google.api.apikeys.v2.BrowserKeyRestrictions.Builder, + com.google.api.apikeys.v2.BrowserKeyRestrictionsOrBuilder> + browserKeyRestrictionsBuilder_; + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + * + * @return Whether the browserKeyRestrictions field is set. + */ + @java.lang.Override + public boolean hasBrowserKeyRestrictions() { + return clientRestrictionsCase_ == 1; + } + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + * + * @return The browserKeyRestrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.BrowserKeyRestrictions getBrowserKeyRestrictions() { + if (browserKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 1) { + return (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance(); + } else { + if (clientRestrictionsCase_ == 1) { + return browserKeyRestrictionsBuilder_.getMessage(); + } + return com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance(); + } + } + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + public Builder setBrowserKeyRestrictions( + com.google.api.apikeys.v2.BrowserKeyRestrictions value) { + if (browserKeyRestrictionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + clientRestrictions_ = value; + onChanged(); + } else { + browserKeyRestrictionsBuilder_.setMessage(value); + } + clientRestrictionsCase_ = 1; + return this; + } + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + public Builder setBrowserKeyRestrictions( + com.google.api.apikeys.v2.BrowserKeyRestrictions.Builder builderForValue) { + if (browserKeyRestrictionsBuilder_ == null) { + clientRestrictions_ = builderForValue.build(); + onChanged(); + } else { + browserKeyRestrictionsBuilder_.setMessage(builderForValue.build()); + } + clientRestrictionsCase_ = 1; + return this; + } + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + public Builder mergeBrowserKeyRestrictions( + com.google.api.apikeys.v2.BrowserKeyRestrictions value) { + if (browserKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 1 + && clientRestrictions_ + != com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance()) { + clientRestrictions_ = + com.google.api.apikeys.v2.BrowserKeyRestrictions.newBuilder( + (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_) + .mergeFrom(value) + .buildPartial(); + } else { + clientRestrictions_ = value; + } + onChanged(); + } else { + if (clientRestrictionsCase_ == 1) { + browserKeyRestrictionsBuilder_.mergeFrom(value); + } else { + browserKeyRestrictionsBuilder_.setMessage(value); + } + } + clientRestrictionsCase_ = 1; + return this; + } + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + public Builder clearBrowserKeyRestrictions() { + if (browserKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 1) { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + onChanged(); + } + } else { + if (clientRestrictionsCase_ == 1) { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + } + browserKeyRestrictionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + public com.google.api.apikeys.v2.BrowserKeyRestrictions.Builder + getBrowserKeyRestrictionsBuilder() { + return getBrowserKeyRestrictionsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + @java.lang.Override + public com.google.api.apikeys.v2.BrowserKeyRestrictionsOrBuilder + getBrowserKeyRestrictionsOrBuilder() { + if ((clientRestrictionsCase_ == 1) && (browserKeyRestrictionsBuilder_ != null)) { + return browserKeyRestrictionsBuilder_.getMessageOrBuilder(); + } else { + if (clientRestrictionsCase_ == 1) { + return (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance(); + } + } + /** + * + * + *
+     * The HTTP referrers (websites) that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.BrowserKeyRestrictions, + com.google.api.apikeys.v2.BrowserKeyRestrictions.Builder, + com.google.api.apikeys.v2.BrowserKeyRestrictionsOrBuilder> + getBrowserKeyRestrictionsFieldBuilder() { + if (browserKeyRestrictionsBuilder_ == null) { + if (!(clientRestrictionsCase_ == 1)) { + clientRestrictions_ = + com.google.api.apikeys.v2.BrowserKeyRestrictions.getDefaultInstance(); + } + browserKeyRestrictionsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.BrowserKeyRestrictions, + com.google.api.apikeys.v2.BrowserKeyRestrictions.Builder, + com.google.api.apikeys.v2.BrowserKeyRestrictionsOrBuilder>( + (com.google.api.apikeys.v2.BrowserKeyRestrictions) clientRestrictions_, + getParentForChildren(), + isClean()); + clientRestrictions_ = null; + } + clientRestrictionsCase_ = 1; + onChanged(); + ; + return browserKeyRestrictionsBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.ServerKeyRestrictions, + com.google.api.apikeys.v2.ServerKeyRestrictions.Builder, + com.google.api.apikeys.v2.ServerKeyRestrictionsOrBuilder> + serverKeyRestrictionsBuilder_; + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + * + * @return Whether the serverKeyRestrictions field is set. + */ + @java.lang.Override + public boolean hasServerKeyRestrictions() { + return clientRestrictionsCase_ == 2; + } + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + * + * @return The serverKeyRestrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.ServerKeyRestrictions getServerKeyRestrictions() { + if (serverKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 2) { + return (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance(); + } else { + if (clientRestrictionsCase_ == 2) { + return serverKeyRestrictionsBuilder_.getMessage(); + } + return com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance(); + } + } + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + public Builder setServerKeyRestrictions(com.google.api.apikeys.v2.ServerKeyRestrictions value) { + if (serverKeyRestrictionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + clientRestrictions_ = value; + onChanged(); + } else { + serverKeyRestrictionsBuilder_.setMessage(value); + } + clientRestrictionsCase_ = 2; + return this; + } + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + public Builder setServerKeyRestrictions( + com.google.api.apikeys.v2.ServerKeyRestrictions.Builder builderForValue) { + if (serverKeyRestrictionsBuilder_ == null) { + clientRestrictions_ = builderForValue.build(); + onChanged(); + } else { + serverKeyRestrictionsBuilder_.setMessage(builderForValue.build()); + } + clientRestrictionsCase_ = 2; + return this; + } + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + public Builder mergeServerKeyRestrictions( + com.google.api.apikeys.v2.ServerKeyRestrictions value) { + if (serverKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 2 + && clientRestrictions_ + != com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance()) { + clientRestrictions_ = + com.google.api.apikeys.v2.ServerKeyRestrictions.newBuilder( + (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_) + .mergeFrom(value) + .buildPartial(); + } else { + clientRestrictions_ = value; + } + onChanged(); + } else { + if (clientRestrictionsCase_ == 2) { + serverKeyRestrictionsBuilder_.mergeFrom(value); + } else { + serverKeyRestrictionsBuilder_.setMessage(value); + } + } + clientRestrictionsCase_ = 2; + return this; + } + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + public Builder clearServerKeyRestrictions() { + if (serverKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 2) { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + onChanged(); + } + } else { + if (clientRestrictionsCase_ == 2) { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + } + serverKeyRestrictionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + public com.google.api.apikeys.v2.ServerKeyRestrictions.Builder + getServerKeyRestrictionsBuilder() { + return getServerKeyRestrictionsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + @java.lang.Override + public com.google.api.apikeys.v2.ServerKeyRestrictionsOrBuilder + getServerKeyRestrictionsOrBuilder() { + if ((clientRestrictionsCase_ == 2) && (serverKeyRestrictionsBuilder_ != null)) { + return serverKeyRestrictionsBuilder_.getMessageOrBuilder(); + } else { + if (clientRestrictionsCase_ == 2) { + return (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance(); + } + } + /** + * + * + *
+     * The IP addresses of callers that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.ServerKeyRestrictions, + com.google.api.apikeys.v2.ServerKeyRestrictions.Builder, + com.google.api.apikeys.v2.ServerKeyRestrictionsOrBuilder> + getServerKeyRestrictionsFieldBuilder() { + if (serverKeyRestrictionsBuilder_ == null) { + if (!(clientRestrictionsCase_ == 2)) { + clientRestrictions_ = + com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance(); + } + serverKeyRestrictionsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.ServerKeyRestrictions, + com.google.api.apikeys.v2.ServerKeyRestrictions.Builder, + com.google.api.apikeys.v2.ServerKeyRestrictionsOrBuilder>( + (com.google.api.apikeys.v2.ServerKeyRestrictions) clientRestrictions_, + getParentForChildren(), + isClean()); + clientRestrictions_ = null; + } + clientRestrictionsCase_ = 2; + onChanged(); + ; + return serverKeyRestrictionsBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.AndroidKeyRestrictions, + com.google.api.apikeys.v2.AndroidKeyRestrictions.Builder, + com.google.api.apikeys.v2.AndroidKeyRestrictionsOrBuilder> + androidKeyRestrictionsBuilder_; + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + * + * @return Whether the androidKeyRestrictions field is set. + */ + @java.lang.Override + public boolean hasAndroidKeyRestrictions() { + return clientRestrictionsCase_ == 3; + } + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + * + * @return The androidKeyRestrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.AndroidKeyRestrictions getAndroidKeyRestrictions() { + if (androidKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 3) { + return (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance(); + } else { + if (clientRestrictionsCase_ == 3) { + return androidKeyRestrictionsBuilder_.getMessage(); + } + return com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance(); + } + } + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + public Builder setAndroidKeyRestrictions( + com.google.api.apikeys.v2.AndroidKeyRestrictions value) { + if (androidKeyRestrictionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + clientRestrictions_ = value; + onChanged(); + } else { + androidKeyRestrictionsBuilder_.setMessage(value); + } + clientRestrictionsCase_ = 3; + return this; + } + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + public Builder setAndroidKeyRestrictions( + com.google.api.apikeys.v2.AndroidKeyRestrictions.Builder builderForValue) { + if (androidKeyRestrictionsBuilder_ == null) { + clientRestrictions_ = builderForValue.build(); + onChanged(); + } else { + androidKeyRestrictionsBuilder_.setMessage(builderForValue.build()); + } + clientRestrictionsCase_ = 3; + return this; + } + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + public Builder mergeAndroidKeyRestrictions( + com.google.api.apikeys.v2.AndroidKeyRestrictions value) { + if (androidKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 3 + && clientRestrictions_ + != com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance()) { + clientRestrictions_ = + com.google.api.apikeys.v2.AndroidKeyRestrictions.newBuilder( + (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_) + .mergeFrom(value) + .buildPartial(); + } else { + clientRestrictions_ = value; + } + onChanged(); + } else { + if (clientRestrictionsCase_ == 3) { + androidKeyRestrictionsBuilder_.mergeFrom(value); + } else { + androidKeyRestrictionsBuilder_.setMessage(value); + } + } + clientRestrictionsCase_ = 3; + return this; + } + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + public Builder clearAndroidKeyRestrictions() { + if (androidKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 3) { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + onChanged(); + } + } else { + if (clientRestrictionsCase_ == 3) { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + } + androidKeyRestrictionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + public com.google.api.apikeys.v2.AndroidKeyRestrictions.Builder + getAndroidKeyRestrictionsBuilder() { + return getAndroidKeyRestrictionsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + @java.lang.Override + public com.google.api.apikeys.v2.AndroidKeyRestrictionsOrBuilder + getAndroidKeyRestrictionsOrBuilder() { + if ((clientRestrictionsCase_ == 3) && (androidKeyRestrictionsBuilder_ != null)) { + return androidKeyRestrictionsBuilder_.getMessageOrBuilder(); + } else { + if (clientRestrictionsCase_ == 3) { + return (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance(); + } + } + /** + * + * + *
+     * The Android apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.AndroidKeyRestrictions, + com.google.api.apikeys.v2.AndroidKeyRestrictions.Builder, + com.google.api.apikeys.v2.AndroidKeyRestrictionsOrBuilder> + getAndroidKeyRestrictionsFieldBuilder() { + if (androidKeyRestrictionsBuilder_ == null) { + if (!(clientRestrictionsCase_ == 3)) { + clientRestrictions_ = + com.google.api.apikeys.v2.AndroidKeyRestrictions.getDefaultInstance(); + } + androidKeyRestrictionsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.AndroidKeyRestrictions, + com.google.api.apikeys.v2.AndroidKeyRestrictions.Builder, + com.google.api.apikeys.v2.AndroidKeyRestrictionsOrBuilder>( + (com.google.api.apikeys.v2.AndroidKeyRestrictions) clientRestrictions_, + getParentForChildren(), + isClean()); + clientRestrictions_ = null; + } + clientRestrictionsCase_ = 3; + onChanged(); + ; + return androidKeyRestrictionsBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.IosKeyRestrictions, + com.google.api.apikeys.v2.IosKeyRestrictions.Builder, + com.google.api.apikeys.v2.IosKeyRestrictionsOrBuilder> + iosKeyRestrictionsBuilder_; + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + * + * @return Whether the iosKeyRestrictions field is set. + */ + @java.lang.Override + public boolean hasIosKeyRestrictions() { + return clientRestrictionsCase_ == 4; + } + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + * + * @return The iosKeyRestrictions. + */ + @java.lang.Override + public com.google.api.apikeys.v2.IosKeyRestrictions getIosKeyRestrictions() { + if (iosKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 4) { + return (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance(); + } else { + if (clientRestrictionsCase_ == 4) { + return iosKeyRestrictionsBuilder_.getMessage(); + } + return com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance(); + } + } + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + public Builder setIosKeyRestrictions(com.google.api.apikeys.v2.IosKeyRestrictions value) { + if (iosKeyRestrictionsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + clientRestrictions_ = value; + onChanged(); + } else { + iosKeyRestrictionsBuilder_.setMessage(value); + } + clientRestrictionsCase_ = 4; + return this; + } + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + public Builder setIosKeyRestrictions( + com.google.api.apikeys.v2.IosKeyRestrictions.Builder builderForValue) { + if (iosKeyRestrictionsBuilder_ == null) { + clientRestrictions_ = builderForValue.build(); + onChanged(); + } else { + iosKeyRestrictionsBuilder_.setMessage(builderForValue.build()); + } + clientRestrictionsCase_ = 4; + return this; + } + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + public Builder mergeIosKeyRestrictions(com.google.api.apikeys.v2.IosKeyRestrictions value) { + if (iosKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 4 + && clientRestrictions_ + != com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance()) { + clientRestrictions_ = + com.google.api.apikeys.v2.IosKeyRestrictions.newBuilder( + (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_) + .mergeFrom(value) + .buildPartial(); + } else { + clientRestrictions_ = value; + } + onChanged(); + } else { + if (clientRestrictionsCase_ == 4) { + iosKeyRestrictionsBuilder_.mergeFrom(value); + } else { + iosKeyRestrictionsBuilder_.setMessage(value); + } + } + clientRestrictionsCase_ = 4; + return this; + } + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + public Builder clearIosKeyRestrictions() { + if (iosKeyRestrictionsBuilder_ == null) { + if (clientRestrictionsCase_ == 4) { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + onChanged(); + } + } else { + if (clientRestrictionsCase_ == 4) { + clientRestrictionsCase_ = 0; + clientRestrictions_ = null; + } + iosKeyRestrictionsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + public com.google.api.apikeys.v2.IosKeyRestrictions.Builder getIosKeyRestrictionsBuilder() { + return getIosKeyRestrictionsFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + @java.lang.Override + public com.google.api.apikeys.v2.IosKeyRestrictionsOrBuilder getIosKeyRestrictionsOrBuilder() { + if ((clientRestrictionsCase_ == 4) && (iosKeyRestrictionsBuilder_ != null)) { + return iosKeyRestrictionsBuilder_.getMessageOrBuilder(); + } else { + if (clientRestrictionsCase_ == 4) { + return (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_; + } + return com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance(); + } + } + /** + * + * + *
+     * The iOS apps that are allowed to use the key.
+     * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.IosKeyRestrictions, + com.google.api.apikeys.v2.IosKeyRestrictions.Builder, + com.google.api.apikeys.v2.IosKeyRestrictionsOrBuilder> + getIosKeyRestrictionsFieldBuilder() { + if (iosKeyRestrictionsBuilder_ == null) { + if (!(clientRestrictionsCase_ == 4)) { + clientRestrictions_ = com.google.api.apikeys.v2.IosKeyRestrictions.getDefaultInstance(); + } + iosKeyRestrictionsBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.IosKeyRestrictions, + com.google.api.apikeys.v2.IosKeyRestrictions.Builder, + com.google.api.apikeys.v2.IosKeyRestrictionsOrBuilder>( + (com.google.api.apikeys.v2.IosKeyRestrictions) clientRestrictions_, + getParentForChildren(), + isClean()); + clientRestrictions_ = null; + } + clientRestrictionsCase_ = 4; + onChanged(); + ; + return iosKeyRestrictionsBuilder_; + } + + private java.util.List apiTargets_ = + java.util.Collections.emptyList(); + + private void ensureApiTargetsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + apiTargets_ = new java.util.ArrayList(apiTargets_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.ApiTarget, + com.google.api.apikeys.v2.ApiTarget.Builder, + com.google.api.apikeys.v2.ApiTargetOrBuilder> + apiTargetsBuilder_; + + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public java.util.List getApiTargetsList() { + if (apiTargetsBuilder_ == null) { + return java.util.Collections.unmodifiableList(apiTargets_); + } else { + return apiTargetsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public int getApiTargetsCount() { + if (apiTargetsBuilder_ == null) { + return apiTargets_.size(); + } else { + return apiTargetsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public com.google.api.apikeys.v2.ApiTarget getApiTargets(int index) { + if (apiTargetsBuilder_ == null) { + return apiTargets_.get(index); + } else { + return apiTargetsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder setApiTargets(int index, com.google.api.apikeys.v2.ApiTarget value) { + if (apiTargetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureApiTargetsIsMutable(); + apiTargets_.set(index, value); + onChanged(); + } else { + apiTargetsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder setApiTargets( + int index, com.google.api.apikeys.v2.ApiTarget.Builder builderForValue) { + if (apiTargetsBuilder_ == null) { + ensureApiTargetsIsMutable(); + apiTargets_.set(index, builderForValue.build()); + onChanged(); + } else { + apiTargetsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder addApiTargets(com.google.api.apikeys.v2.ApiTarget value) { + if (apiTargetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureApiTargetsIsMutable(); + apiTargets_.add(value); + onChanged(); + } else { + apiTargetsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder addApiTargets(int index, com.google.api.apikeys.v2.ApiTarget value) { + if (apiTargetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureApiTargetsIsMutable(); + apiTargets_.add(index, value); + onChanged(); + } else { + apiTargetsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder addApiTargets(com.google.api.apikeys.v2.ApiTarget.Builder builderForValue) { + if (apiTargetsBuilder_ == null) { + ensureApiTargetsIsMutable(); + apiTargets_.add(builderForValue.build()); + onChanged(); + } else { + apiTargetsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder addApiTargets( + int index, com.google.api.apikeys.v2.ApiTarget.Builder builderForValue) { + if (apiTargetsBuilder_ == null) { + ensureApiTargetsIsMutable(); + apiTargets_.add(index, builderForValue.build()); + onChanged(); + } else { + apiTargetsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder addAllApiTargets( + java.lang.Iterable values) { + if (apiTargetsBuilder_ == null) { + ensureApiTargetsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, apiTargets_); + onChanged(); + } else { + apiTargetsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder clearApiTargets() { + if (apiTargetsBuilder_ == null) { + apiTargets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + apiTargetsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public Builder removeApiTargets(int index) { + if (apiTargetsBuilder_ == null) { + ensureApiTargetsIsMutable(); + apiTargets_.remove(index); + onChanged(); + } else { + apiTargetsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public com.google.api.apikeys.v2.ApiTarget.Builder getApiTargetsBuilder(int index) { + return getApiTargetsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public com.google.api.apikeys.v2.ApiTargetOrBuilder getApiTargetsOrBuilder(int index) { + if (apiTargetsBuilder_ == null) { + return apiTargets_.get(index); + } else { + return apiTargetsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public java.util.List + getApiTargetsOrBuilderList() { + if (apiTargetsBuilder_ != null) { + return apiTargetsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(apiTargets_); + } + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public com.google.api.apikeys.v2.ApiTarget.Builder addApiTargetsBuilder() { + return getApiTargetsFieldBuilder() + .addBuilder(com.google.api.apikeys.v2.ApiTarget.getDefaultInstance()); + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public com.google.api.apikeys.v2.ApiTarget.Builder addApiTargetsBuilder(int index) { + return getApiTargetsFieldBuilder() + .addBuilder(index, com.google.api.apikeys.v2.ApiTarget.getDefaultInstance()); + } + /** + * + * + *
+     * A restriction for a specific service and optionally one or
+     * more specific methods. Requests are allowed if they
+     * match any of these restrictions. If no restrictions are
+     * specified, all targets are allowed.
+     * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + public java.util.List getApiTargetsBuilderList() { + return getApiTargetsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.ApiTarget, + com.google.api.apikeys.v2.ApiTarget.Builder, + com.google.api.apikeys.v2.ApiTargetOrBuilder> + getApiTargetsFieldBuilder() { + if (apiTargetsBuilder_ == null) { + apiTargetsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.api.apikeys.v2.ApiTarget, + com.google.api.apikeys.v2.ApiTarget.Builder, + com.google.api.apikeys.v2.ApiTargetOrBuilder>( + apiTargets_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + apiTargets_ = null; + } + return apiTargetsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.Restrictions) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.Restrictions) + private static final com.google.api.apikeys.v2.Restrictions DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.Restrictions(); + } + + public static com.google.api.apikeys.v2.Restrictions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Restrictions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Restrictions(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.Restrictions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/RestrictionsOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/RestrictionsOrBuilder.java new file mode 100644 index 0000000..4cd5594 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/RestrictionsOrBuilder.java @@ -0,0 +1,234 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public interface RestrictionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.Restrictions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The HTTP referrers (websites) that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + * + * @return Whether the browserKeyRestrictions field is set. + */ + boolean hasBrowserKeyRestrictions(); + /** + * + * + *
+   * The HTTP referrers (websites) that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + * + * @return The browserKeyRestrictions. + */ + com.google.api.apikeys.v2.BrowserKeyRestrictions getBrowserKeyRestrictions(); + /** + * + * + *
+   * The HTTP referrers (websites) that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.BrowserKeyRestrictions browser_key_restrictions = 1; + */ + com.google.api.apikeys.v2.BrowserKeyRestrictionsOrBuilder getBrowserKeyRestrictionsOrBuilder(); + + /** + * + * + *
+   * The IP addresses of callers that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + * + * @return Whether the serverKeyRestrictions field is set. + */ + boolean hasServerKeyRestrictions(); + /** + * + * + *
+   * The IP addresses of callers that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + * + * @return The serverKeyRestrictions. + */ + com.google.api.apikeys.v2.ServerKeyRestrictions getServerKeyRestrictions(); + /** + * + * + *
+   * The IP addresses of callers that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.ServerKeyRestrictions server_key_restrictions = 2; + */ + com.google.api.apikeys.v2.ServerKeyRestrictionsOrBuilder getServerKeyRestrictionsOrBuilder(); + + /** + * + * + *
+   * The Android apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + * + * @return Whether the androidKeyRestrictions field is set. + */ + boolean hasAndroidKeyRestrictions(); + /** + * + * + *
+   * The Android apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + * + * @return The androidKeyRestrictions. + */ + com.google.api.apikeys.v2.AndroidKeyRestrictions getAndroidKeyRestrictions(); + /** + * + * + *
+   * The Android apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.AndroidKeyRestrictions android_key_restrictions = 3; + */ + com.google.api.apikeys.v2.AndroidKeyRestrictionsOrBuilder getAndroidKeyRestrictionsOrBuilder(); + + /** + * + * + *
+   * The iOS apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + * + * @return Whether the iosKeyRestrictions field is set. + */ + boolean hasIosKeyRestrictions(); + /** + * + * + *
+   * The iOS apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + * + * @return The iosKeyRestrictions. + */ + com.google.api.apikeys.v2.IosKeyRestrictions getIosKeyRestrictions(); + /** + * + * + *
+   * The iOS apps that are allowed to use the key.
+   * 
+ * + * .google.api.apikeys.v2.IosKeyRestrictions ios_key_restrictions = 4; + */ + com.google.api.apikeys.v2.IosKeyRestrictionsOrBuilder getIosKeyRestrictionsOrBuilder(); + + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + java.util.List getApiTargetsList(); + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + com.google.api.apikeys.v2.ApiTarget getApiTargets(int index); + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + int getApiTargetsCount(); + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + java.util.List + getApiTargetsOrBuilderList(); + /** + * + * + *
+   * A restriction for a specific service and optionally one or
+   * more specific methods. Requests are allowed if they
+   * match any of these restrictions. If no restrictions are
+   * specified, all targets are allowed.
+   * 
+ * + * repeated .google.api.apikeys.v2.ApiTarget api_targets = 5; + */ + com.google.api.apikeys.v2.ApiTargetOrBuilder getApiTargetsOrBuilder(int index); + + public com.google.api.apikeys.v2.Restrictions.ClientRestrictionsCase getClientRestrictionsCase(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictions.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictions.java new file mode 100644 index 0000000..3cd0162 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictions.java @@ -0,0 +1,751 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * The IP addresses of callers that are allowed to use the key.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.ServerKeyRestrictions} + */ +public final class ServerKeyRestrictions extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.ServerKeyRestrictions) + ServerKeyRestrictionsOrBuilder { + private static final long serialVersionUID = 0L; + // Use ServerKeyRestrictions.newBuilder() to construct. + private ServerKeyRestrictions(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ServerKeyRestrictions() { + allowedIps_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ServerKeyRestrictions(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ServerKeyRestrictions( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + allowedIps_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + allowedIps_.add(s); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + allowedIps_ = allowedIps_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ServerKeyRestrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ServerKeyRestrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.ServerKeyRestrictions.class, + com.google.api.apikeys.v2.ServerKeyRestrictions.Builder.class); + } + + public static final int ALLOWED_IPS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList allowedIps_; + /** + * + * + *
+   * A list of the caller IP addresses that are allowed to make API calls
+   * with this key.
+   * 
+ * + * repeated string allowed_ips = 1; + * + * @return A list containing the allowedIps. + */ + public com.google.protobuf.ProtocolStringList getAllowedIpsList() { + return allowedIps_; + } + /** + * + * + *
+   * A list of the caller IP addresses that are allowed to make API calls
+   * with this key.
+   * 
+ * + * repeated string allowed_ips = 1; + * + * @return The count of allowedIps. + */ + public int getAllowedIpsCount() { + return allowedIps_.size(); + } + /** + * + * + *
+   * A list of the caller IP addresses that are allowed to make API calls
+   * with this key.
+   * 
+ * + * repeated string allowed_ips = 1; + * + * @param index The index of the element to return. + * @return The allowedIps at the given index. + */ + public java.lang.String getAllowedIps(int index) { + return allowedIps_.get(index); + } + /** + * + * + *
+   * A list of the caller IP addresses that are allowed to make API calls
+   * with this key.
+   * 
+ * + * repeated string allowed_ips = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedIps at the given index. + */ + public com.google.protobuf.ByteString getAllowedIpsBytes(int index) { + return allowedIps_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < allowedIps_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, allowedIps_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < allowedIps_.size(); i++) { + dataSize += computeStringSizeNoTag(allowedIps_.getRaw(i)); + } + size += dataSize; + size += 1 * getAllowedIpsList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.ServerKeyRestrictions)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.ServerKeyRestrictions other = + (com.google.api.apikeys.v2.ServerKeyRestrictions) obj; + + if (!getAllowedIpsList().equals(other.getAllowedIpsList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAllowedIpsCount() > 0) { + hash = (37 * hash) + ALLOWED_IPS_FIELD_NUMBER; + hash = (53 * hash) + getAllowedIpsList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.ServerKeyRestrictions prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The IP addresses of callers that are allowed to use the key.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.ServerKeyRestrictions} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.ServerKeyRestrictions) + com.google.api.apikeys.v2.ServerKeyRestrictionsOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ServerKeyRestrictions_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ServerKeyRestrictions_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.ServerKeyRestrictions.class, + com.google.api.apikeys.v2.ServerKeyRestrictions.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.ServerKeyRestrictions.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + allowedIps_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ResourcesProto + .internal_static_google_api_apikeys_v2_ServerKeyRestrictions_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ServerKeyRestrictions getDefaultInstanceForType() { + return com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.ServerKeyRestrictions build() { + com.google.api.apikeys.v2.ServerKeyRestrictions result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ServerKeyRestrictions buildPartial() { + com.google.api.apikeys.v2.ServerKeyRestrictions result = + new com.google.api.apikeys.v2.ServerKeyRestrictions(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + allowedIps_ = allowedIps_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.allowedIps_ = allowedIps_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.ServerKeyRestrictions) { + return mergeFrom((com.google.api.apikeys.v2.ServerKeyRestrictions) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.ServerKeyRestrictions other) { + if (other == com.google.api.apikeys.v2.ServerKeyRestrictions.getDefaultInstance()) + return this; + if (!other.allowedIps_.isEmpty()) { + if (allowedIps_.isEmpty()) { + allowedIps_ = other.allowedIps_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAllowedIpsIsMutable(); + allowedIps_.addAll(other.allowedIps_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.ServerKeyRestrictions parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.ServerKeyRestrictions) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList allowedIps_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureAllowedIpsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + allowedIps_ = new com.google.protobuf.LazyStringArrayList(allowedIps_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @return A list containing the allowedIps. + */ + public com.google.protobuf.ProtocolStringList getAllowedIpsList() { + return allowedIps_.getUnmodifiableView(); + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @return The count of allowedIps. + */ + public int getAllowedIpsCount() { + return allowedIps_.size(); + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @param index The index of the element to return. + * @return The allowedIps at the given index. + */ + public java.lang.String getAllowedIps(int index) { + return allowedIps_.get(index); + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedIps at the given index. + */ + public com.google.protobuf.ByteString getAllowedIpsBytes(int index) { + return allowedIps_.getByteString(index); + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @param index The index to set the value at. + * @param value The allowedIps to set. + * @return This builder for chaining. + */ + public Builder setAllowedIps(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedIpsIsMutable(); + allowedIps_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @param value The allowedIps to add. + * @return This builder for chaining. + */ + public Builder addAllowedIps(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedIpsIsMutable(); + allowedIps_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @param values The allowedIps to add. + * @return This builder for chaining. + */ + public Builder addAllAllowedIps(java.lang.Iterable values) { + ensureAllowedIpsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, allowedIps_); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @return This builder for chaining. + */ + public Builder clearAllowedIps() { + allowedIps_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * A list of the caller IP addresses that are allowed to make API calls
+     * with this key.
+     * 
+ * + * repeated string allowed_ips = 1; + * + * @param value The bytes of the allowedIps to add. + * @return This builder for chaining. + */ + public Builder addAllowedIpsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAllowedIpsIsMutable(); + allowedIps_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.ServerKeyRestrictions) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.ServerKeyRestrictions) + private static final com.google.api.apikeys.v2.ServerKeyRestrictions DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.ServerKeyRestrictions(); + } + + public static com.google.api.apikeys.v2.ServerKeyRestrictions getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ServerKeyRestrictions parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ServerKeyRestrictions(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.ServerKeyRestrictions getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictionsOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictionsOrBuilder.java new file mode 100644 index 0000000..5296a33 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictionsOrBuilder.java @@ -0,0 +1,80 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/resources.proto + +package com.google.api.apikeys.v2; + +public interface ServerKeyRestrictionsOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.ServerKeyRestrictions) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of the caller IP addresses that are allowed to make API calls
+   * with this key.
+   * 
+ * + * repeated string allowed_ips = 1; + * + * @return A list containing the allowedIps. + */ + java.util.List getAllowedIpsList(); + /** + * + * + *
+   * A list of the caller IP addresses that are allowed to make API calls
+   * with this key.
+   * 
+ * + * repeated string allowed_ips = 1; + * + * @return The count of allowedIps. + */ + int getAllowedIpsCount(); + /** + * + * + *
+   * A list of the caller IP addresses that are allowed to make API calls
+   * with this key.
+   * 
+ * + * repeated string allowed_ips = 1; + * + * @param index The index of the element to return. + * @return The allowedIps at the given index. + */ + java.lang.String getAllowedIps(int index); + /** + * + * + *
+   * A list of the caller IP addresses that are allowed to make API calls
+   * with this key.
+   * 
+ * + * repeated string allowed_ips = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedIps at the given index. + */ + com.google.protobuf.ByteString getAllowedIpsBytes(int index); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequest.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequest.java new file mode 100644 index 0000000..b8631b4 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequest.java @@ -0,0 +1,650 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Request message for `UndeleteKey` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.UndeleteKeyRequest} + */ +public final class UndeleteKeyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.UndeleteKeyRequest) + UndeleteKeyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UndeleteKeyRequest.newBuilder() to construct. + private UndeleteKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UndeleteKeyRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UndeleteKeyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UndeleteKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UndeleteKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UndeleteKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.UndeleteKeyRequest.class, + com.google.api.apikeys.v2.UndeleteKeyRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the API key to be undeleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the API key to be undeleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.UndeleteKeyRequest)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.UndeleteKeyRequest other = + (com.google.api.apikeys.v2.UndeleteKeyRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.UndeleteKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `UndeleteKey` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.UndeleteKeyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.UndeleteKeyRequest) + com.google.api.apikeys.v2.UndeleteKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UndeleteKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UndeleteKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.UndeleteKeyRequest.class, + com.google.api.apikeys.v2.UndeleteKeyRequest.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.UndeleteKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UndeleteKeyRequest_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.UndeleteKeyRequest getDefaultInstanceForType() { + return com.google.api.apikeys.v2.UndeleteKeyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.UndeleteKeyRequest build() { + com.google.api.apikeys.v2.UndeleteKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.UndeleteKeyRequest buildPartial() { + com.google.api.apikeys.v2.UndeleteKeyRequest result = + new com.google.api.apikeys.v2.UndeleteKeyRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.UndeleteKeyRequest) { + return mergeFrom((com.google.api.apikeys.v2.UndeleteKeyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.UndeleteKeyRequest other) { + if (other == com.google.api.apikeys.v2.UndeleteKeyRequest.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.UndeleteKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.UndeleteKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the API key to be undeleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the API key to be undeleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the API key to be undeleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the API key to be undeleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the API key to be undeleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.UndeleteKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.UndeleteKeyRequest) + private static final com.google.api.apikeys.v2.UndeleteKeyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.UndeleteKeyRequest(); + } + + public static com.google.api.apikeys.v2.UndeleteKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UndeleteKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UndeleteKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.UndeleteKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequestOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequestOrBuilder.java new file mode 100644 index 0000000..6d5ffd2 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequestOrBuilder.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface UndeleteKeyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.UndeleteKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the API key to be undeleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the API key to be undeleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequest.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequest.java new file mode 100644 index 0000000..e8b3e90 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequest.java @@ -0,0 +1,1090 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +/** + * + * + *
+ * Request message for `UpdateKey` method.
+ * 
+ * + * Protobuf type {@code google.api.apikeys.v2.UpdateKeyRequest} + */ +public final class UpdateKeyRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.api.apikeys.v2.UpdateKeyRequest) + UpdateKeyRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateKeyRequest.newBuilder() to construct. + private UpdateKeyRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateKeyRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateKeyRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateKeyRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.api.apikeys.v2.Key.Builder subBuilder = null; + if (key_ != null) { + subBuilder = key_.toBuilder(); + } + key_ = input.readMessage(com.google.api.apikeys.v2.Key.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(key_); + key_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UpdateKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UpdateKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.UpdateKeyRequest.class, + com.google.api.apikeys.v2.UpdateKeyRequest.Builder.class); + } + + public static final int KEY_FIELD_NUMBER = 1; + private com.google.api.apikeys.v2.Key key_; + /** + * + * + *
+   * Required. Set the `name` field to the resource name of the API key to be
+   * updated. You can update only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the key field is set. + */ + @java.lang.Override + public boolean hasKey() { + return key_ != null; + } + /** + * + * + *
+   * Required. Set the `name` field to the resource name of the API key to be
+   * updated. You can update only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + @java.lang.Override + public com.google.api.apikeys.v2.Key getKey() { + return key_ == null ? com.google.api.apikeys.v2.Key.getDefaultInstance() : key_; + } + /** + * + * + *
+   * Required. Set the `name` field to the resource name of the API key to be
+   * updated. You can update only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + @java.lang.Override + public com.google.api.apikeys.v2.KeyOrBuilder getKeyOrBuilder() { + return getKey(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * The field mask specifies which fields to be updated as part of this
+   * request. All other fields are ignored.
+   * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+   * If an update mask is not provided, the service treats it as an implied mask
+   * equivalent to all allowed fields that are set on the wire. If the field
+   * mask has a special value "*", the service treats it equivalent to replace
+   * all allowed mutable fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * The field mask specifies which fields to be updated as part of this
+   * request. All other fields are ignored.
+   * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+   * If an update mask is not provided, the service treats it as an implied mask
+   * equivalent to all allowed fields that are set on the wire. If the field
+   * mask has a special value "*", the service treats it equivalent to replace
+   * all allowed mutable fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * The field mask specifies which fields to be updated as part of this
+   * request. All other fields are ignored.
+   * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+   * If an update mask is not provided, the service treats it as an implied mask
+   * equivalent to all allowed fields that are set on the wire. If the field
+   * mask has a special value "*", the service treats it equivalent to replace
+   * all allowed mutable fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (key_ != null) { + output.writeMessage(1, getKey()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (key_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getKey()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.api.apikeys.v2.UpdateKeyRequest)) { + return super.equals(obj); + } + com.google.api.apikeys.v2.UpdateKeyRequest other = + (com.google.api.apikeys.v2.UpdateKeyRequest) obj; + + if (hasKey() != other.hasKey()) return false; + if (hasKey()) { + if (!getKey().equals(other.getKey())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasKey()) { + hash = (37 * hash) + KEY_FIELD_NUMBER; + hash = (53 * hash) + getKey().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.api.apikeys.v2.UpdateKeyRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `UpdateKey` method.
+   * 
+ * + * Protobuf type {@code google.api.apikeys.v2.UpdateKeyRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.api.apikeys.v2.UpdateKeyRequest) + com.google.api.apikeys.v2.UpdateKeyRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UpdateKeyRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UpdateKeyRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.api.apikeys.v2.UpdateKeyRequest.class, + com.google.api.apikeys.v2.UpdateKeyRequest.Builder.class); + } + + // Construct using com.google.api.apikeys.v2.UpdateKeyRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (keyBuilder_ == null) { + key_ = null; + } else { + key_ = null; + keyBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.api.apikeys.v2.ApiKeysProto + .internal_static_google_api_apikeys_v2_UpdateKeyRequest_descriptor; + } + + @java.lang.Override + public com.google.api.apikeys.v2.UpdateKeyRequest getDefaultInstanceForType() { + return com.google.api.apikeys.v2.UpdateKeyRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.api.apikeys.v2.UpdateKeyRequest build() { + com.google.api.apikeys.v2.UpdateKeyRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.api.apikeys.v2.UpdateKeyRequest buildPartial() { + com.google.api.apikeys.v2.UpdateKeyRequest result = + new com.google.api.apikeys.v2.UpdateKeyRequest(this); + if (keyBuilder_ == null) { + result.key_ = key_; + } else { + result.key_ = keyBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.api.apikeys.v2.UpdateKeyRequest) { + return mergeFrom((com.google.api.apikeys.v2.UpdateKeyRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.api.apikeys.v2.UpdateKeyRequest other) { + if (other == com.google.api.apikeys.v2.UpdateKeyRequest.getDefaultInstance()) return this; + if (other.hasKey()) { + mergeKey(other.getKey()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.api.apikeys.v2.UpdateKeyRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.api.apikeys.v2.UpdateKeyRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.api.apikeys.v2.Key key_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder> + keyBuilder_; + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the key field is set. + */ + public boolean hasKey() { + return keyBuilder_ != null || key_ != null; + } + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + public com.google.api.apikeys.v2.Key getKey() { + if (keyBuilder_ == null) { + return key_ == null ? com.google.api.apikeys.v2.Key.getDefaultInstance() : key_; + } else { + return keyBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setKey(com.google.api.apikeys.v2.Key value) { + if (keyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + key_ = value; + onChanged(); + } else { + keyBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setKey(com.google.api.apikeys.v2.Key.Builder builderForValue) { + if (keyBuilder_ == null) { + key_ = builderForValue.build(); + onChanged(); + } else { + keyBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder mergeKey(com.google.api.apikeys.v2.Key value) { + if (keyBuilder_ == null) { + if (key_ != null) { + key_ = com.google.api.apikeys.v2.Key.newBuilder(key_).mergeFrom(value).buildPartial(); + } else { + key_ = value; + } + onChanged(); + } else { + keyBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearKey() { + if (keyBuilder_ == null) { + key_ = null; + onChanged(); + } else { + key_ = null; + keyBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.api.apikeys.v2.Key.Builder getKeyBuilder() { + + onChanged(); + return getKeyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.api.apikeys.v2.KeyOrBuilder getKeyOrBuilder() { + if (keyBuilder_ != null) { + return keyBuilder_.getMessageOrBuilder(); + } else { + return key_ == null ? com.google.api.apikeys.v2.Key.getDefaultInstance() : key_; + } + } + /** + * + * + *
+     * Required. Set the `name` field to the resource name of the API key to be
+     * updated. You can update only the `display_name`, `restrictions`, and
+     * `annotations` fields.
+     * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder> + getKeyFieldBuilder() { + if (keyBuilder_ == null) { + keyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.api.apikeys.v2.Key, + com.google.api.apikeys.v2.Key.Builder, + com.google.api.apikeys.v2.KeyOrBuilder>( + getKey(), getParentForChildren(), isClean()); + key_ = null; + } + return keyBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * The field mask specifies which fields to be updated as part of this
+     * request. All other fields are ignored.
+     * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+     * If an update mask is not provided, the service treats it as an implied mask
+     * equivalent to all allowed fields that are set on the wire. If the field
+     * mask has a special value "*", the service treats it equivalent to replace
+     * all allowed mutable fields.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.api.apikeys.v2.UpdateKeyRequest) + } + + // @@protoc_insertion_point(class_scope:google.api.apikeys.v2.UpdateKeyRequest) + private static final com.google.api.apikeys.v2.UpdateKeyRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.api.apikeys.v2.UpdateKeyRequest(); + } + + public static com.google.api.apikeys.v2.UpdateKeyRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateKeyRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateKeyRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.api.apikeys.v2.UpdateKeyRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequestOrBuilder.java b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequestOrBuilder.java new file mode 100644 index 0000000..aa8bb12 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequestOrBuilder.java @@ -0,0 +1,119 @@ +/* + * Copyright 2020 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 + * + * https://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. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/api/apikeys/v2/apikeys.proto + +package com.google.api.apikeys.v2; + +public interface UpdateKeyRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.api.apikeys.v2.UpdateKeyRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Set the `name` field to the resource name of the API key to be
+   * updated. You can update only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the key field is set. + */ + boolean hasKey(); + /** + * + * + *
+   * Required. Set the `name` field to the resource name of the API key to be
+   * updated. You can update only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The key. + */ + com.google.api.apikeys.v2.Key getKey(); + /** + * + * + *
+   * Required. Set the `name` field to the resource name of the API key to be
+   * updated. You can update only the `display_name`, `restrictions`, and
+   * `annotations` fields.
+   * 
+ * + * .google.api.apikeys.v2.Key key = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.api.apikeys.v2.KeyOrBuilder getKeyOrBuilder(); + + /** + * + * + *
+   * The field mask specifies which fields to be updated as part of this
+   * request. All other fields are ignored.
+   * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+   * If an update mask is not provided, the service treats it as an implied mask
+   * equivalent to all allowed fields that are set on the wire. If the field
+   * mask has a special value "*", the service treats it equivalent to replace
+   * all allowed mutable fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * The field mask specifies which fields to be updated as part of this
+   * request. All other fields are ignored.
+   * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+   * If an update mask is not provided, the service treats it as an implied mask
+   * equivalent to all allowed fields that are set on the wire. If the field
+   * mask has a special value "*", the service treats it equivalent to replace
+   * all allowed mutable fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * The field mask specifies which fields to be updated as part of this
+   * request. All other fields are ignored.
+   * Mutable fields are: `display_name`, `restrictions`, and `annotations`.
+   * If an update mask is not provided, the service treats it as an implied mask
+   * equivalent to all allowed fields that are set on the wire. If the field
+   * mask has a special value "*", the service treats it equivalent to replace
+   * all allowed mutable fields.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/apikeys.proto b/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/apikeys.proto new file mode 100644 index 0000000..4b0e08a --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/apikeys.proto @@ -0,0 +1,287 @@ +// Copyright 2022 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. + +syntax = "proto3"; + +package google.api.apikeys.v2; + +import "google/api/annotations.proto"; +import "google/api/apikeys/v2/resources.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; + +option csharp_namespace = "Google.Cloud.ApiKeys.V2"; +option go_package = "google.golang.org/genproto/googleapis/api/apikeys/v2;apikeys"; +option java_multiple_files = true; +option java_outer_classname = "ApiKeysProto"; +option java_package = "com.google.api.apikeys.v2"; +option php_namespace = "Google\\Cloud\\ApiKeys\\V2"; +option ruby_package = "Google::Cloud::ApiKeys::V2"; + +// Manages the API keys associated with projects. +service ApiKeys { + option (google.api.default_host) = "apikeys.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/cloud-platform.read-only"; + + // Creates a new API key. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + rpc CreateKey(CreateKeyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{parent=projects/*/locations/*}/keys" + body: "key" + }; + option (google.api.method_signature) = "parent,key,key_id"; + option (google.longrunning.operation_info) = { + response_type: "Key" + metadata_type: "google.protobuf.Empty" + }; + } + + // Lists the API keys owned by a project. The key string of the API key + // isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + rpc ListKeys(ListKeysRequest) returns (ListKeysResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*/locations/*}/keys" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets the metadata for an API key. The key string of the API key + // isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + rpc GetKey(GetKeyRequest) returns (Key) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/keys/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Get the key string for an API key. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + rpc GetKeyString(GetKeyStringRequest) returns (GetKeyStringResponse) { + option (google.api.http) = { + get: "/v2/{name=projects/*/locations/*/keys/*}/keyString" + }; + option (google.api.method_signature) = "name"; + } + + // Patches the modifiable fields of an API key. + // The key string of the API key isn't included in the response. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + rpc UpdateKey(UpdateKeyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v2/{key.name=projects/*/locations/*/keys/*}" + body: "key" + }; + option (google.api.method_signature) = "key,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Key" + metadata_type: "google.protobuf.Empty" + }; + } + + // Deletes an API key. Deleted key can be retrieved within 30 days of + // deletion. Afterward, key will be purged from the project. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + rpc DeleteKey(DeleteKeyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/locations/*/keys/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "Key" + metadata_type: "google.protobuf.Empty" + }; + } + + // Undeletes an API key which was deleted within 30 days. + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + rpc UndeleteKey(UndeleteKeyRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v2/{name=projects/*/locations/*/keys/*}:undelete" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "Key" + metadata_type: "google.protobuf.Empty" + }; + } + + // Find the parent project and resource name of the API + // key that matches the key string in the request. If the API key has been + // purged, resource name will not be set. + // The service account must have the `apikeys.keys.lookup` permission + // on the parent project. + rpc LookupKey(LookupKeyRequest) returns (LookupKeyResponse) { + option (google.api.http) = { + get: "/v2/keys:lookupKey" + }; + } +} + +// Request message for `CreateKey` method. +message CreateKeyRequest { + // Required. The project in which the API key is created. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apikeys.googleapis.com/Key" + } + ]; + + // Required. The API key fields to set at creation time. + // You can configure only the `display_name`, `restrictions`, and + // `annotations` fields. + Key key = 2 [(google.api.field_behavior) = REQUIRED]; + + // User specified key id (optional). If specified, it will become the final + // component of the key resource name. + // + // The id must be unique within the project, must conform with RFC-1034, + // is restricted to lower-cased letters, and has a maximum length of 63 + // characters. In another word, the id must match the regular + // expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. + // + // The id must NOT be a UUID-like string. + string key_id = 3; +} + +// Request message for `ListKeys` method. +message ListKeysRequest { + // Required. Lists all API keys associated with this project. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "apikeys.googleapis.com/Key" + } + ]; + + // Optional. Specifies the maximum number of results to be returned at a time. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Requests a specific page of results. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicate that keys deleted in the past 30 days should also be + // returned. + bool show_deleted = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for `ListKeys` method. +message ListKeysResponse { + // A list of API keys. + repeated Key keys = 1; + + // The pagination token for the next page of results. + string next_page_token = 2; +} + +// Request message for `GetKey` method. +message GetKeyRequest { + // Required. The resource name of the API key to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "apikeys.googleapis.com/Key" } + ]; +} + +// Request message for `GetKeyString` method. +message GetKeyStringRequest { + // Required. The resource name of the API key to be retrieved. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "apikeys.googleapis.com/Key" } + ]; +} + +// Response message for `GetKeyString` method. +message GetKeyStringResponse { + // An encrypted and signed value of the key. + string key_string = 1; +} + +// Request message for `UpdateKey` method. +message UpdateKeyRequest { + // Required. Set the `name` field to the resource name of the API key to be + // updated. You can update only the `display_name`, `restrictions`, and + // `annotations` fields. + Key key = 1 [(google.api.field_behavior) = REQUIRED]; + + // The field mask specifies which fields to be updated as part of this + // request. All other fields are ignored. + // Mutable fields are: `display_name`, `restrictions`, and `annotations`. + // If an update mask is not provided, the service treats it as an implied mask + // equivalent to all allowed fields that are set on the wire. If the field + // mask has a special value "*", the service treats it equivalent to replace + // all allowed mutable fields. + google.protobuf.FieldMask update_mask = 2; +} + +// Request message for `DeleteKey` method. +message DeleteKeyRequest { + // Required. The resource name of the API key to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "apikeys.googleapis.com/Key" } + ]; + + // Optional. The etag known to the client for the expected state of the key. + // This is to be used for optimistic concurrency. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for `UndeleteKey` method. +message UndeleteKeyRequest { + // Required. The resource name of the API key to be undeleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "apikeys.googleapis.com/Key" } + ]; +} + +// Request message for `LookupKey` method. +message LookupKeyRequest { + // Required. Finds the project that owns the key string value. + string key_string = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Response message for `LookupKey` method. +message LookupKeyResponse { + // The project that owns the key with the value specified in the request. + string parent = 1; + + // The resource name of the API key. If the API key has been purged, + // resource name is empty. + string name = 2; +} diff --git a/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/resources.proto b/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/resources.proto new file mode 100644 index 0000000..08e0b11 --- /dev/null +++ b/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/resources.proto @@ -0,0 +1,172 @@ +// Copyright 2022 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. + +syntax = "proto3"; + +package google.api.apikeys.v2; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.ApiKeys.V2"; +option go_package = "google.golang.org/genproto/googleapis/api/apikeys/v2;apikeys"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.api.apikeys.v2"; +option php_namespace = "Google\\Cloud\\ApiKeys\\V2"; +option ruby_package = "Google::Cloud::ApiKeys::V2"; + +// The representation of a key managed by the API Keys API. +message Key { + option (google.api.resource) = { + type: "apikeys.googleapis.com/Key" + pattern: "projects/{project}/locations/{location}/keys/{key}" + plural: "keys" + singular: "key" + style: DECLARATIVE_FRIENDLY + }; + + // Output only. The resource name of the key. + // The `name` has the form: + // `projects//locations/global/keys/`. + // For example: + // `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b5dd2` + // + // NOTE: Key is a global resource; hence the only supported value for + // location is `global`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Unique id in UUID4 format. + string uid = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Human-readable display name of this key that you can modify. + // The maximum length is 63 characters. + string display_name = 2; + + // Output only. An encrypted and signed value held by this key. + // This field can be accessed only through the `GetKeyString` method. + string key_string = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A timestamp identifying the time this key was originally + // created. + google.protobuf.Timestamp create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A timestamp identifying the time this key was last + // updated. + google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. A timestamp when this key was deleted. If the resource is not deleted, + // this must be empty. + google.protobuf.Timestamp delete_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Annotations is an unstructured key-value map stored with a policy that + // may be set by external tools to store and retrieve arbitrary metadata. + // They are not queryable and should be preserved when modifying objects. + map annotations = 8; + + // Key restrictions. + Restrictions restrictions = 9; + + // Output only. A checksum computed by the server based on the current value of the Key + // resource. This may be sent on update and delete requests to ensure the + // client has an up-to-date value before proceeding. + // See https://google.aip.dev/154. + string etag = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Describes the restrictions on the key. +message Restrictions { + // The websites, IP addresses, Android apps, or iOS apps (the clients) that + // are allowed to use the key. You can specify only one type of client + // restrictions per key. + oneof client_restrictions { + // The HTTP referrers (websites) that are allowed to use the key. + BrowserKeyRestrictions browser_key_restrictions = 1; + + // The IP addresses of callers that are allowed to use the key. + ServerKeyRestrictions server_key_restrictions = 2; + + // The Android apps that are allowed to use the key. + AndroidKeyRestrictions android_key_restrictions = 3; + + // The iOS apps that are allowed to use the key. + IosKeyRestrictions ios_key_restrictions = 4; + } + + // A restriction for a specific service and optionally one or + // more specific methods. Requests are allowed if they + // match any of these restrictions. If no restrictions are + // specified, all targets are allowed. + repeated ApiTarget api_targets = 5; +} + +// The HTTP referrers (websites) that are allowed to use the key. +message BrowserKeyRestrictions { + // A list of regular expressions for the referrer URLs that are allowed + // to make API calls with this key. + repeated string allowed_referrers = 1; +} + +// The IP addresses of callers that are allowed to use the key. +message ServerKeyRestrictions { + // A list of the caller IP addresses that are allowed to make API calls + // with this key. + repeated string allowed_ips = 1; +} + +// The Android apps that are allowed to use the key. +message AndroidKeyRestrictions { + // A list of Android applications that are allowed to make API calls with + // this key. + repeated AndroidApplication allowed_applications = 1; +} + +// Identifier of an Android application for key use. +message AndroidApplication { + // The SHA1 fingerprint of the application. For example, both sha1 formats are + // acceptable : DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or + // DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. + // Output format is the latter. + string sha1_fingerprint = 1; + + // The package name of the application. + string package_name = 2; +} + +// The iOS apps that are allowed to use the key. +message IosKeyRestrictions { + // A list of bundle IDs that are allowed when making API calls with this key. + repeated string allowed_bundle_ids = 1; +} + +// A restriction for a specific service and optionally one or multiple +// specific methods. Both fields are case insensitive. +message ApiTarget { + // The service for this restriction. It should be the canonical + // service name, for example: `translate.googleapis.com`. + // You can use [`gcloud services list`](/sdk/gcloud/reference/services/list) + // to get a list of services that are enabled in the project. + string service = 1; + + // Optional. List of one or more methods that can be called. + // If empty, all methods for the service are allowed. A wildcard + // (*) can be used as the last symbol. + // Valid examples: + // `google.cloud.translate.v2.TranslateService.GetSupportedLanguage` + // `TranslateText` + // `Get*` + // `translate.googleapis.com.Get*` + repeated string methods = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..1660874 --- /dev/null +++ b/renovate.json @@ -0,0 +1,74 @@ +{ + "extends": [ + ":separateMajorReleases", + ":combinePatchMinorReleases", + ":ignoreUnstable", + ":prImmediately", + ":updateNotScheduled", + ":automergeDisabled", + ":ignoreModulesAndTests", + ":maintainLockFilesDisabled", + ":autodetectPinVersions" + ], + "packageRules": [ + { + "packagePatterns": [ + "^com.google.guava:" + ], + "versionScheme": "docker" + }, + { + "packagePatterns": [ + "*" + ], + "semanticCommitType": "deps", + "semanticCommitScope": null + }, + { + "packagePatterns": [ + "^org.apache.maven", + "^org.jacoco:", + "^org.codehaus.mojo:", + "^org.sonatype.plugins:", + "^com.coveo:", + "^com.google.cloud:google-cloud-shared-config" + ], + "semanticCommitType": "build", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-apikeys", + "^com.google.cloud:libraries-bom", + "^com.google.cloud.samples:shared-configuration" + ], + "semanticCommitType": "chore", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^junit:junit", + "^com.google.truth:truth", + "^org.mockito:mockito-core", + "^org.objenesis:objenesis", + "^com.google.cloud:google-cloud-conformance-tests" + ], + "semanticCommitType": "test", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-" + ], + "ignoreUnstable": false + }, + { + "packagePatterns": [ + "^com.fasterxml.jackson.core" + ], + "groupName": "jackson dependencies" + } + ], + "semanticCommits": true, + "dependencyDashboard": true +} diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml new file mode 100644 index 0000000..07f0305 --- /dev/null +++ b/samples/install-without-bom/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.google.cloud + -install-without-bom + jar + Google API Keys Install Without Bom + https://github.com/googleapis/java-apikeys + + + + com.google.cloud.samples + shared-configuration + 1.2.0 + + + + 1.8 + 1.8 + UTF-8 + + + + + + + com.google.cloud + google-cloud-apikeys + 0.0.0 + + + + + junit + junit + 4.13.2 + test + + + com.google.truth + truth + 1.1.3 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + diff --git a/samples/pom.xml b/samples/pom.xml new file mode 100644 index 0000000..70b18db --- /dev/null +++ b/samples/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + com.google.cloud + google-cloud--samples + 0.0.1-SNAPSHOT + pom + Google API Keys Samples Parent + https://github.com/googleapis/java-apikeys + + Java idiomatic client for Google Cloud Platform services. + + + + + com.google.cloud.samples + shared-configuration + 1.2.0 + + + + 1.8 + 1.8 + UTF-8 + + + + install-without-bom + snapshot + snippets + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + + true + + + + + diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml new file mode 100644 index 0000000..2fa1359 --- /dev/null +++ b/samples/snapshot/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + com.google.cloud + -snapshot + jar + Google API Keys Snapshot Samples + https://github.com/googleapis/java-apikeys + + + + com.google.cloud.samples + shared-configuration + 1.2.0 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-apikeys + 0.0.0 + + + + + junit + junit + 4.13.2 + test + + + com.google.truth + truth + 1.1.3 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.3.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml new file mode 100644 index 0000000..df46e8a --- /dev/null +++ b/samples/snippets/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + com.google.cloud + -snippets + jar + Google API Keys Snippets + https://github.com/googleapis/java-apikeys + + + + com.google.cloud.samples + shared-configuration + 1.2.0 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-apikeys + 0.0.0 + + + + junit + junit + 4.13.2 + test + + + com.google.truth + truth + 1.1.3 + test + + + diff --git a/versions.txt b/versions.txt new file mode 100644 index 0000000..c1af14e --- /dev/null +++ b/versions.txt @@ -0,0 +1,6 @@ +# Format: +# module:released-version:current-version + +google-cloud-apikeys:0.0.0:0.0.1-SNAPSHOT +proto-google-cloud-apikeys-v2:0.0.0:0.0.1-SNAPSHOT +grpc-google-cloud-apikeys-v2:0.0.0:0.0.1-SNAPSHOT