From 00a6d87773a62dae6035daa22b4102dd5e9ea93f Mon Sep 17 00:00:00 2001 From: Tomo Suzuki Date: Mon, 10 Oct 2022 10:38:30 -0400 Subject: [PATCH] feat: [apikeys] new module for apikeys (#8550) * feat: initial generation of apikeys * build: add the apikeys module to monorepo --- .release-please-manifest.json | 1 + CoverageAggregator/pom.xml | 5 + java-apikeys/.OwlBot.yaml | 30 + java-apikeys/.repo-metadata.json | 16 + java-apikeys/README.md | 201 ++ java-apikeys/google-cloud-apikeys-bom/pom.xml | 94 + java-apikeys/google-cloud-apikeys/pom.xml | 139 + .../google/api/apikeys/v2/ApiKeysClient.java | 1315 ++++++++ .../api/apikeys/v2/ApiKeysSettings.java | 323 ++ .../google/api/apikeys/v2/gapic_metadata.json | 42 + .../google/api/apikeys/v2/package-info.java | 43 + .../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 | 628 ++++ .../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-apikeys/owlbot.py | 35 + java-apikeys/pom.xml | 188 ++ .../clirr-ignored-differences.xml | 19 + .../proto-google-cloud-apikeys-v2/pom.xml | 46 + .../api/apikeys/v2/AndroidApplication.java | 813 +++++ .../v2/AndroidApplicationOrBuilder.java | 81 + .../apikeys/v2/AndroidKeyRestrictions.java | 963 ++++++ .../v2/AndroidKeyRestrictionsOrBuilder.java | 82 + .../google/api/apikeys/v2/ApiKeysProto.java | 278 ++ .../com/google/api/apikeys/v2/ApiTarget.java | 998 ++++++ .../api/apikeys/v2/ApiTargetOrBuilder.java | 135 + .../apikeys/v2/BrowserKeyRestrictions.java | 723 ++++ .../v2/BrowserKeyRestrictionsOrBuilder.java | 80 + .../api/apikeys/v2/CreateKeyRequest.java | 1130 +++++++ .../apikeys/v2/CreateKeyRequestOrBuilder.java | 132 + .../api/apikeys/v2/DeleteKeyRequest.java | 813 +++++ .../apikeys/v2/DeleteKeyRequestOrBuilder.java | 81 + .../google/api/apikeys/v2/GetKeyRequest.java | 627 ++++ .../apikeys/v2/GetKeyRequestOrBuilder.java | 54 + .../api/apikeys/v2/GetKeyStringRequest.java | 628 ++++ .../v2/GetKeyStringRequestOrBuilder.java | 54 + .../api/apikeys/v2/GetKeyStringResponse.java | 614 ++++ .../v2/GetKeyStringResponseOrBuilder.java | 50 + .../api/apikeys/v2/IosKeyRestrictions.java | 709 ++++ .../v2/IosKeyRestrictionsOrBuilder.java | 76 + .../java/com/google/api/apikeys/v2/Key.java | 2902 +++++++++++++++++ .../com/google/api/apikeys/v2/KeyName.java | 216 ++ .../google/api/apikeys/v2/KeyOrBuilder.java | 399 +++ .../api/apikeys/v2/ListKeysRequest.java | 992 ++++++ .../apikeys/v2/ListKeysRequestOrBuilder.java | 106 + .../api/apikeys/v2/ListKeysResponse.java | 1094 +++++++ .../apikeys/v2/ListKeysResponseOrBuilder.java | 101 + .../google/api/apikeys/v2/LocationName.java | 192 ++ .../api/apikeys/v2/LookupKeyRequest.java | 614 ++++ .../apikeys/v2/LookupKeyRequestOrBuilder.java | 50 + .../api/apikeys/v2/LookupKeyResponse.java | 799 +++++ .../v2/LookupKeyResponseOrBuilder.java | 77 + .../google/api/apikeys/v2/ResourcesProto.java | 224 ++ .../google/api/apikeys/v2/Restrictions.java | 2292 +++++++++++++ .../api/apikeys/v2/RestrictionsOrBuilder.java | 234 ++ .../api/apikeys/v2/ServerKeyRestrictions.java | 723 ++++ .../v2/ServerKeyRestrictionsOrBuilder.java | 80 + .../api/apikeys/v2/UndeleteKeyRequest.java | 628 ++++ .../v2/UndeleteKeyRequestOrBuilder.java | 54 + .../api/apikeys/v2/UpdateKeyRequest.java | 1052 ++++++ .../apikeys/v2/UpdateKeyRequestOrBuilder.java | 119 + .../proto/google/api/apikeys/v2/apikeys.proto | 287 ++ .../google/api/apikeys/v2/resources.proto | 172 + java-apikeys/versions.txt | 6 + pom.xml | 1 + release-please-config.json | 4 + 74 files changed, 30210 insertions(+) create mode 100644 java-apikeys/.OwlBot.yaml create mode 100644 java-apikeys/.repo-metadata.json create mode 100644 java-apikeys/README.md create mode 100644 java-apikeys/google-cloud-apikeys-bom/pom.xml create mode 100644 java-apikeys/google-cloud-apikeys/pom.xml create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysClient.java create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysSettings.java create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/gapic_metadata.json create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/package-info.java create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStub.java create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStubSettings.java create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysCallableFactory.java create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysStub.java create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysCallableFactory.java create mode 100644 java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysStub.java create mode 100644 java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientHttpJsonTest.java create mode 100644 java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientTest.java create mode 100644 java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeys.java create mode 100644 java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeysImpl.java create mode 100644 java-apikeys/grpc-google-cloud-apikeys-v2/pom.xml create mode 100644 java-apikeys/grpc-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysGrpc.java create mode 100644 java-apikeys/owlbot.py create mode 100644 java-apikeys/pom.xml create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/clirr-ignored-differences.xml create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/pom.xml create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplication.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplicationOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictions.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictionsOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysProto.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTarget.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTargetOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictions.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictionsOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequest.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequestOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequest.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequestOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequest.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequestOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequest.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequestOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponse.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponseOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictions.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictionsOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Key.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyName.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequest.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequestOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponse.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponseOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LocationName.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequest.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequestOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponse.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponseOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ResourcesProto.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Restrictions.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/RestrictionsOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictions.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictionsOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequest.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequestOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequest.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequestOrBuilder.java create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/apikeys.proto create mode 100644 java-apikeys/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/resources.proto create mode 100644 java-apikeys/versions.txt diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 9893c1c229a2..23047f74d778 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -8,6 +8,7 @@ "java-api-gateway": "2.3.6", "java-apigee-connect": "2.3.7", "java-apigee-registry": "0.3.1", + "java-apikeys": "0.0.0", "java-appengine-admin": "2.3.4", "java-area120-tables": "0.7.8", "java-artifact-registry": "1.2.9", diff --git a/CoverageAggregator/pom.xml b/CoverageAggregator/pom.xml index 933efafc5ecb..b3da6bbd1293 100644 --- a/CoverageAggregator/pom.xml +++ b/CoverageAggregator/pom.xml @@ -57,6 +57,11 @@ google-cloud-apigee-registry 0.3.2-SNAPSHOT + + com.google.cloud + google-cloud-apikeys + 0.0.1-SNAPSHOT + com.google.cloud google-cloud-appengine-admin diff --git a/java-apikeys/.OwlBot.yaml b/java-apikeys/.OwlBot.yaml new file mode 100644 index 000000000000..a2281a023a11 --- /dev/null +++ b/java-apikeys/.OwlBot.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. + + +deep-remove-regex: +- "/java-apikeys/grpc-google-.*/src" +- "/java-apikeys/proto-google-.*/src" +- "/java-apikeys/google-.*/src" + +deep-preserve-regex: +- "/java-apikeys/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/java-apikeys/$1/proto-google-cloud-apikeys-$1/src" +- source: "/google/api/apikeys/(v.*)/.*-java/grpc-google-.*/src" + dest: "/owl-bot-staging/java-apikeys/$1/grpc-google-cloud-apikeys-$1/src" +- source: "/google/api/apikeys/(v.*)/.*-java/gapic-google-.*/src" + dest: "/owl-bot-staging/java-apikeys/$1/google-cloud-apikeys/src" diff --git a/java-apikeys/.repo-metadata.json b/java-apikeys/.repo-metadata.json new file mode 100644 index 000000000000..729351a7178a --- /dev/null +++ b/java-apikeys/.repo-metadata.json @@ -0,0 +1,16 @@ +{ + "api_shortname": "apikeys", + "name_pretty": "API Keys API", + "product_documentation": "https://cloud.google.com/api-keys/", + "api_description": "API Keys lets you create and manage your API keys for your 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/java-apikeys/README.md b/java-apikeys/README.md new file mode 100644 index 000000000000..cec53bb06d3b --- /dev/null +++ b/java-apikeys/README.md @@ -0,0 +1,201 @@ +# Google API Keys API Client for Java + +Java idiomatic client for [API Keys API][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.1.2 + +``` + +If you are using Gradle without BOM, add this to your dependencies: + +```Groovy +implementation 'com.google.cloud:google-cloud-apikeys:0.1.2' +``` + +If you are using SBT, add this to your dependencies: + +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-apikeys" % "0.1.2" +``` + +## 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 API APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the API Keys API API calls. + +## Getting Started + +### Prerequisites + +You will need a [Google Cloud Platform Console][developer-console] project with the API Keys API [API enabled][enable-api]. +You will need to [enable billing][enable-billing] to use Google API Keys API. +[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 + + +[API Keys API][product-docs] API Keys lets you create and manage your API keys for your projects. + +See the [API Keys API client library docs][javadocs] to learn how to +use this API Keys API Client Library. + + + + + + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. + +## Transport + +API Keys API 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]: https://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/java-apikeys/google-cloud-apikeys-bom/pom.xml b/java-apikeys/google-cloud-apikeys-bom/pom.xml new file mode 100644 index 000000000000..e26754798724 --- /dev/null +++ b/java-apikeys/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.5.3 + + + Google API Keys API BOM + https://github.com/googleapis/java-apikeys + + BOM for API Keys API + + + + 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/java-apikeys/google-cloud-apikeys/pom.xml b/java-apikeys/google-cloud-apikeys/pom.xml new file mode 100644 index 000000000000..f28355d4f577 --- /dev/null +++ b/java-apikeys/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 API + https://github.com/googleapis/java-apikeys + API Keys API API Keys lets you create and manage your API keys for your 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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysClient.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysClient.java new file mode 100644 index 000000000000..6484e9290af2 --- /dev/null +++ b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysClient.java @@ -0,0 +1,1315 @@ +/* + * 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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * 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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * 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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * 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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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 and should be regarded as a code template only.
+   * // It will require modifications to work:
+   * // - It may require correct/in-range values for request initialization.
+   * // - It may require specifying regional endpoints when creating the service client as shown in
+   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+   * try (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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysSettings.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/ApiKeysSettings.java new file mode 100644 index 000000000000..207674537d3f --- /dev/null +++ b/java-apikeys/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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * 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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/gapic_metadata.json b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/gapic_metadata.json new file mode 100644 index 000000000000..aee2228fcea2 --- /dev/null +++ b/java-apikeys/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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/package-info.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/package-info.java new file mode 100644 index 000000000000..301504539fd3 --- /dev/null +++ b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/package-info.java @@ -0,0 +1,43 @@ +/* + * 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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStub.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStub.java new file mode 100644 index 000000000000..a7ed23973ed4 --- /dev/null +++ b/java-apikeys/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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStubSettings.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/ApiKeysStubSettings.java new file mode 100644 index 000000000000..aa5031ba652e --- /dev/null +++ b/java-apikeys/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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * 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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysCallableFactory.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysCallableFactory.java new file mode 100644 index 000000000000..05ff6dfe002d --- /dev/null +++ b/java-apikeys/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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysStub.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/GrpcApiKeysStub.java new file mode 100644 index 000000000000..03e9ad88cfc6 --- /dev/null +++ b/java-apikeys/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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysCallableFactory.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysCallableFactory.java new file mode 100644 index 000000000000..2c4b2a2750e7 --- /dev/null +++ b/java-apikeys/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/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysStub.java b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysStub.java new file mode 100644 index 000000000000..4ecb49d3f346 --- /dev/null +++ b/java-apikeys/google-cloud-apikeys/src/main/java/com/google/api/apikeys/v2/stub/HttpJsonApiKeysStub.java @@ -0,0 +1,628 @@ +/* + * 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(), false)) + .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(), false)) + .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(), false)) + .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/java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientHttpJsonTest.java b/java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientHttpJsonTest.java new file mode 100644 index 000000000000..8763ba01406b --- /dev/null +++ b/java-apikeys/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/java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientTest.java b/java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/ApiKeysClientTest.java new file mode 100644 index 000000000000..6f3b31133c82 --- /dev/null +++ b/java-apikeys/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/java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeys.java b/java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeys.java new file mode 100644 index 000000000000..70b23d6b5d59 --- /dev/null +++ b/java-apikeys/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/java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeysImpl.java b/java-apikeys/google-cloud-apikeys/src/test/java/com/google/api/apikeys/v2/MockApiKeysImpl.java new file mode 100644 index 000000000000..26a5b950d307 --- /dev/null +++ b/java-apikeys/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/java-apikeys/grpc-google-cloud-apikeys-v2/pom.xml b/java-apikeys/grpc-google-cloud-apikeys-v2/pom.xml new file mode 100644 index 000000000000..59b6a63c7b5e --- /dev/null +++ b/java-apikeys/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/java-apikeys/grpc-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysGrpc.java b/java-apikeys/grpc-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysGrpc.java new file mode 100644 index 000000000000..a631353795ec --- /dev/null +++ b/java-apikeys/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-apikeys/owlbot.py b/java-apikeys/owlbot.py new file mode 100644 index 000000000000..7a77cf5ee557 --- /dev/null +++ b/java-apikeys/owlbot.py @@ -0,0 +1,35 @@ +# 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(excludes=[ + ".github/*", + ".kokoro/*", + "samples/*", + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE", + "SECURITY.md", + "java.header", + "license-checks.xml", + "renovate.json" +]) \ No newline at end of file diff --git a/java-apikeys/pom.xml b/java-apikeys/pom.xml new file mode 100644 index 000000000000..67b0b0d0151b --- /dev/null +++ b/java-apikeys/pom.xml @@ -0,0 +1,188 @@ + + + 4.0.0 + com.google.cloud + google-cloud-apikeys-parent + pom + 0.0.1-SNAPSHOT + Google API Keys API Parent + https://github.com/googleapis/java-apikeys + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 1.5.3 + + + + + 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 + 3.0.4 + 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/java-apikeys/proto-google-cloud-apikeys-v2/clirr-ignored-differences.xml b/java-apikeys/proto-google-cloud-apikeys-v2/clirr-ignored-differences.xml new file mode 100644 index 000000000000..4e0074d01dfb --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/pom.xml b/java-apikeys/proto-google-cloud-apikeys-v2/pom.xml new file mode 100644 index 000000000000..da8e17867a35 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplication.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplication.java new file mode 100644 index 000000000000..c0aa5213b8b4 --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplication.java @@ -0,0 +1,813 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + sha1Fingerprint_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + packageName_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplicationOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidApplicationOrBuilder.java new file mode 100644 index 000000000000..a67e1a6dd5bf --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictions.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictions.java new file mode 100644 index 000000000000..60be6416f57b --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictions.java @@ -0,0 +1,963 @@ +/* + * 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; + } + + 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)); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (allowedApplicationsBuilder_ == null) { + allowedApplications_ = java.util.Collections.emptyList(); + } else { + allowedApplications_ = null; + allowedApplicationsBuilder_.clear(); + } + 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_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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.api.apikeys.v2.AndroidApplication m = + input.readMessage( + com.google.api.apikeys.v2.AndroidApplication.parser(), extensionRegistry); + if (allowedApplicationsBuilder_ == null) { + ensureAllowedApplicationsIsMutable(); + allowedApplications_.add(m); + } else { + allowedApplicationsBuilder_.addMessage(m); + } + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictionsOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/AndroidKeyRestrictionsOrBuilder.java new file mode 100644 index 000000000000..59ffa5429c28 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysProto.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiKeysProto.java new file mode 100644 index 000000000000..dfd77c5a84ec --- /dev/null +++ b/java-apikeys/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; + } + + 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)); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + service_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureMethodsIsMutable(); + methods_.add(s); + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTargetOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ApiTargetOrBuilder.java new file mode 100644 index 000000000000..4a8e9a039d76 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictions.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictions.java new file mode 100644 index 000000000000..e105ba2d388f --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictions.java @@ -0,0 +1,723 @@ +/* + * 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; + } + + 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)); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + 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(); + ensureAllowedReferrersIsMutable(); + allowedReferrers_.add(s); + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictionsOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/BrowserKeyRestrictionsOrBuilder.java new file mode 100644 index 000000000000..daaba0894fc9 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequest.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequest.java new file mode 100644 index 000000000000..960dc4037b5c --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequest.java @@ -0,0 +1,1130 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + input.readMessage(getKeyFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + case 26: + { + keyId_ = input.readStringRequireUtf8(); + + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequestOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/CreateKeyRequestOrBuilder.java new file mode 100644 index 000000000000..e81ac4f58e4e --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequest.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequest.java new file mode 100644 index 000000000000..7e5c669d7aa7 --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequest.java @@ -0,0 +1,813 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + etag_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequestOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/DeleteKeyRequestOrBuilder.java new file mode 100644 index 000000000000..e64c8bd3d9c3 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequest.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequest.java new file mode 100644 index 000000000000..89b02c30a34f --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequest.java @@ -0,0 +1,627 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequestOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyRequestOrBuilder.java new file mode 100644 index 000000000000..7c6037390039 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequest.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequest.java new file mode 100644 index 000000000000..0e477d557299 --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequest.java @@ -0,0 +1,628 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequestOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringRequestOrBuilder.java new file mode 100644 index 000000000000..8bc4300b392e --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponse.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponse.java new file mode 100644 index 000000000000..56b0d476d36a --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponse.java @@ -0,0 +1,614 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + keyString_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponseOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/GetKeyStringResponseOrBuilder.java new file mode 100644 index 000000000000..0eb945260e12 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictions.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictions.java new file mode 100644 index 000000000000..170040f5f10d --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictions.java @@ -0,0 +1,709 @@ +/* + * 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; + } + + 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)); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + 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(); + ensureAllowedBundleIdsIsMutable(); + allowedBundleIds_.add(s); + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictionsOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/IosKeyRestrictionsOrBuilder.java new file mode 100644 index 000000000000..ca39266a1b6b --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Key.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Key.java new file mode 100644 index 000000000000..83a7e6946e98 --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/Key.java @@ -0,0 +1,2902 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + displayName_ = input.readStringRequireUtf8(); + + break; + } // case 18 + case 26: + { + keyString_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 34: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 34 + case 42: + { + uid_ = input.readStringRequireUtf8(); + + break; + } // case 42 + case 50: + { + input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 50 + case 58: + { + input.readMessage(getDeleteTimeFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 58 + case 66: + { + com.google.protobuf.MapEntry annotations__ = + input.readMessage( + AnnotationsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableAnnotations() + .getMutableMap() + .put(annotations__.getKey(), annotations__.getValue()); + break; + } // case 66 + case 74: + { + input.readMessage(getRestrictionsFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 74 + case 90: + { + etag_ = input.readStringRequireUtf8(); + + break; + } // case 90 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyName.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyName.java new file mode 100644 index 000000000000..04ac83eb48ad --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/KeyOrBuilder.java new file mode 100644 index 000000000000..ba79f1a1463c --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequest.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequest.java new file mode 100644 index 000000000000..7543dc91e885 --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequest.java @@ -0,0 +1,992 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + + break; + } // case 26 + case 48: + { + showDeleted_ = input.readBool(); + + break; + } // case 48 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequestOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysRequestOrBuilder.java new file mode 100644 index 000000000000..60b70575f8f1 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponse.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponse.java new file mode 100644 index 000000000000..a12b07a477be --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponse.java @@ -0,0 +1,1094 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (keysBuilder_ == null) { + keys_ = java.util.Collections.emptyList(); + } else { + keys_ = null; + keysBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + 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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + 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 m = + input.readMessage(com.google.api.apikeys.v2.Key.parser(), extensionRegistry); + if (keysBuilder_ == null) { + ensureKeysIsMutable(); + keys_.add(m); + } else { + keysBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponseOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ListKeysResponseOrBuilder.java new file mode 100644 index 000000000000..bd4c16cb36d4 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LocationName.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LocationName.java new file mode 100644 index 000000000000..8f4192f00f78 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequest.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequest.java new file mode 100644 index 000000000000..c878efa3e2ff --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequest.java @@ -0,0 +1,614 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + keyString_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequestOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyRequestOrBuilder.java new file mode 100644 index 000000000000..df8452b9c624 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponse.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponse.java new file mode 100644 index 000000000000..982ee2023b79 --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponse.java @@ -0,0 +1,799 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + + break; + } // case 10 + case 18: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponseOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/LookupKeyResponseOrBuilder.java new file mode 100644 index 000000000000..7870f6c600be --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ResourcesProto.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ResourcesProto.java new file mode 100644 index 000000000000..73ebcdce8aa6 --- /dev/null +++ b/java-apikeys/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; + } + + 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)); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (browserKeyRestrictionsBuilder_ != null) { + browserKeyRestrictionsBuilder_.clear(); + } + if (serverKeyRestrictionsBuilder_ != null) { + serverKeyRestrictionsBuilder_.clear(); + } + if (androidKeyRestrictionsBuilder_ != null) { + androidKeyRestrictionsBuilder_.clear(); + } + if (iosKeyRestrictionsBuilder_ != null) { + iosKeyRestrictionsBuilder_.clear(); + } + if (apiTargetsBuilder_ == null) { + apiTargets_ = java.util.Collections.emptyList(); + } else { + apiTargets_ = null; + apiTargetsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + 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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getBrowserKeyRestrictionsFieldBuilder().getBuilder(), extensionRegistry); + clientRestrictionsCase_ = 1; + break; + } // case 10 + case 18: + { + input.readMessage( + getServerKeyRestrictionsFieldBuilder().getBuilder(), extensionRegistry); + clientRestrictionsCase_ = 2; + break; + } // case 18 + case 26: + { + input.readMessage( + getAndroidKeyRestrictionsFieldBuilder().getBuilder(), extensionRegistry); + clientRestrictionsCase_ = 3; + break; + } // case 26 + case 34: + { + input.readMessage( + getIosKeyRestrictionsFieldBuilder().getBuilder(), extensionRegistry); + clientRestrictionsCase_ = 4; + break; + } // case 34 + case 42: + { + com.google.api.apikeys.v2.ApiTarget m = + input.readMessage( + com.google.api.apikeys.v2.ApiTarget.parser(), extensionRegistry); + if (apiTargetsBuilder_ == null) { + ensureApiTargetsIsMutable(); + apiTargets_.add(m); + } else { + apiTargetsBuilder_.addMessage(m); + } + break; + } // case 42 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/RestrictionsOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/RestrictionsOrBuilder.java new file mode 100644 index 000000000000..4cd55949c43c --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictions.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictions.java new file mode 100644 index 000000000000..5f7fa79e428a --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictions.java @@ -0,0 +1,723 @@ +/* + * 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; + } + + 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)); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + 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(); + ensureAllowedIpsIsMutable(); + allowedIps_.add(s); + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictionsOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/ServerKeyRestrictionsOrBuilder.java new file mode 100644 index 000000000000..5296a33502b1 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequest.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequest.java new file mode 100644 index 000000000000..fe9a5b4b396c --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequest.java @@ -0,0 +1,628 @@ +/* + * 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; + } + + 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_); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequestOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UndeleteKeyRequestOrBuilder.java new file mode 100644 index 000000000000..6d5ffd29918f --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequest.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequest.java new file mode 100644 index 000000000000..c40976fe1c49 --- /dev/null +++ b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequest.java @@ -0,0 +1,1052 @@ +/* + * 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; + } + + 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()); + } + getUnknownFields().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 += getUnknownFields().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 (!getUnknownFields().equals(other.getUnknownFields())) 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) + getUnknownFields().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() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @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.getUnknownFields()); + 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 { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getKeyFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 10 + case 18: + { + input.readMessage(getUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); + + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + 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 { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + 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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequestOrBuilder.java b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/java/com/google/api/apikeys/v2/UpdateKeyRequestOrBuilder.java new file mode 100644 index 000000000000..aa8bb12191a9 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/apikeys.proto b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/apikeys.proto new file mode 100644 index 000000000000..4b0e08ac20f1 --- /dev/null +++ b/java-apikeys/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/java-apikeys/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/resources.proto b/java-apikeys/proto-google-cloud-apikeys-v2/src/main/proto/google/api/apikeys/v2/resources.proto new file mode 100644 index 000000000000..08e0b11ae9ec --- /dev/null +++ b/java-apikeys/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/java-apikeys/versions.txt b/java-apikeys/versions.txt new file mode 100644 index 000000000000..c1af14e97e5a --- /dev/null +++ b/java-apikeys/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 diff --git a/pom.xml b/pom.xml index 3ce5ab01fec0..cdddadf2e2f9 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ java-api-gateway java-apigee-connect java-apigee-registry + java-apikeys java-appengine-admin java-area120-tables java-artifact-registry diff --git a/release-please-config.json b/release-please-config.json index d0be34563e30..babce8fbf6b1 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -40,6 +40,10 @@ "component": "google-cloud-apigee-registry", "skip-github-release": true }, + "java-apikeys": { + "component": "google-cloud-apikeys", + "skip-github-release": true + }, "java-appengine-admin": { "component": "google-cloud-appengine-admin", "skip-github-release": true