From cfa6187666a260af5a345c19fc2553f948d65200 Mon Sep 17 00:00:00 2001 From: Neenu1995 Date: Mon, 3 May 2021 12:38:17 -0400 Subject: [PATCH] feat: initial generation --- .github/.OwlBot.lock.yaml | 3 + .github/.OwlBot.yaml | 29 + .github/CODEOWNERS | 10 + .github/ISSUE_TEMPLATE/bug_report.md | 51 + .github/ISSUE_TEMPLATE/feature_request.md | 21 + .github/ISSUE_TEMPLATE/support_request.md | 7 + .github/PULL_REQUEST_TEMPLATE.md | 7 + .github/blunderbuss.yml | 7 + .github/generated-files-bot.yml | 11 + .github/readme/synth.py | 19 + .github/release-please.yml | 2 + .github/snippet-bot.yml | 0 .github/sync-repo-settings.yaml | 49 + .github/trusted-contribution.yml | 2 + .github/workflows/approve-readme.yaml | 54 + .github/workflows/auto-release.yaml | 88 + .github/workflows/ci.yaml | 83 + .github/workflows/samples.yaml | 14 + .gitignore | 17 + .kokoro/build.bat | 3 + .kokoro/build.sh | 125 ++ .kokoro/coerce_logs.sh | 38 + .kokoro/common.cfg | 13 + .kokoro/common.sh | 58 + .kokoro/continuous/common.cfg | 25 + .kokoro/continuous/java8.cfg | 12 + .kokoro/continuous/readme.cfg | 55 + .kokoro/dependencies.sh | 90 + .kokoro/nightly/common.cfg | 25 + .kokoro/nightly/integration.cfg | 37 + .kokoro/nightly/java11.cfg | 7 + .kokoro/nightly/java7.cfg | 7 + .kokoro/nightly/java8-osx.cfg | 3 + .kokoro/nightly/java8-win.cfg | 3 + .kokoro/nightly/java8.cfg | 12 + .kokoro/nightly/samples.cfg | 38 + .kokoro/populate-secrets.sh | 43 + .kokoro/presubmit/clirr.cfg | 13 + .kokoro/presubmit/common.cfg | 34 + .kokoro/presubmit/dependencies.cfg | 12 + .kokoro/presubmit/integration.cfg | 33 + .kokoro/presubmit/java11.cfg | 7 + .kokoro/presubmit/java7.cfg | 7 + .kokoro/presubmit/java8-osx.cfg | 3 + .kokoro/presubmit/java8-win.cfg | 3 + .kokoro/presubmit/java8.cfg | 12 + .kokoro/presubmit/linkage-monitor.cfg | 12 + .kokoro/presubmit/lint.cfg | 13 + .kokoro/presubmit/samples.cfg | 33 + .kokoro/readme.sh | 45 + .kokoro/release/bump_snapshot.cfg | 53 + .kokoro/release/common.cfg | 49 + .kokoro/release/common.sh | 50 + .kokoro/release/drop.cfg | 6 + .kokoro/release/drop.sh | 32 + .kokoro/release/promote.cfg | 6 + .kokoro/release/promote.sh | 34 + .kokoro/release/publish_javadoc.cfg | 23 + .kokoro/release/publish_javadoc.sh | 53 + .kokoro/release/publish_javadoc11.cfg | 30 + .kokoro/release/publish_javadoc11.sh | 58 + .kokoro/release/snapshot.cfg | 6 + .kokoro/release/snapshot.sh | 33 + .kokoro/release/stage.cfg | 19 + .kokoro/release/stage.sh | 45 + .kokoro/trampoline.sh | 26 + .repo-metadata.json | 15 + CODE_OF_CONDUCT.md | 94 + CONTRIBUTING.md | 139 ++ LICENSE | 201 ++ codecov.yaml | 4 + google-cloud-essential-contacts-bom/pom.xml | 85 + google-cloud-essential-contacts/pom.xml | 111 + .../v1/EssentialContactsServiceClient.java | 1139 ++++++++++ .../v1/EssentialContactsServiceSettings.java | 258 +++ .../essentialcontacts/v1/gapic_metadata.json | 39 + .../essentialcontacts/v1/package-info.java | 38 + .../v1/stub/EssentialContactsServiceStub.java | 85 + .../EssentialContactsServiceStubSettings.java | 556 +++++ ...sentialContactsServiceCallableFactory.java | 113 + .../GrpcEssentialContactsServiceStub.java | 393 ++++ .../EssentialContactsServiceClientTest.java | 752 +++++++ .../v1/MockEssentialContactsService.java | 59 + .../v1/MockEssentialContactsServiceImpl.java | 206 ++ .../pom.xml | 69 + .../v1/EssentialContactsServiceGrpc.java | 1092 +++++++++ java.header | 15 + license-checks.xml | 10 + owlbot.py | 24 + pom.xml | 179 ++ .../clirr-ignored-differences.xml | 19 + .../pom.xml | 46 + .../v1/ComputeContactsRequest.java | 1444 ++++++++++++ .../v1/ComputeContactsRequestOrBuilder.java | 189 ++ .../v1/ComputeContactsResponse.java | 1203 ++++++++++ .../v1/ComputeContactsResponseOrBuilder.java | 118 + .../cloud/essentialcontacts/v1/Contact.java | 1961 +++++++++++++++++ .../essentialcontacts/v1/ContactName.java | 371 ++++ .../v1/ContactOrBuilder.java | 260 +++ .../v1/CreateContactRequest.java | 979 ++++++++ .../v1/CreateContactRequestOrBuilder.java | 102 + .../v1/DeleteContactRequest.java | 672 ++++++ .../v1/DeleteContactRequestOrBuilder.java | 60 + .../essentialcontacts/v1/EnumsProto.java | 61 + .../essentialcontacts/v1/FolderName.java | 168 ++ .../v1/GetContactRequest.java | 672 ++++++ .../v1/GetContactRequestOrBuilder.java | 60 + .../v1/ListContactsRequest.java | 967 ++++++++ .../v1/ListContactsRequestOrBuilder.java | 105 + .../v1/ListContactsResponse.java | 1153 ++++++++++ .../v1/ListContactsResponseOrBuilder.java | 108 + .../v1/NotificationCategory.java | 328 +++ .../v1/OrganizationName.java | 168 ++ .../essentialcontacts/v1/ProjectName.java | 168 ++ .../v1/SendTestMessageRequest.java | 1209 ++++++++++ .../v1/SendTestMessageRequestOrBuilder.java | 164 ++ .../cloud/essentialcontacts/v1/Service.java | 310 +++ .../v1/UpdateContactRequest.java | 1079 +++++++++ .../v1/UpdateContactRequestOrBuilder.java | 113 + .../essentialcontacts/v1/ValidationState.java | 181 ++ .../cloud/essentialcontacts/v1/enums.proto | 80 + .../cloud/essentialcontacts/v1/service.proto | 343 +++ renovate.json | 73 + samples/install-without-bom/pom.xml | 84 + samples/pom.xml | 56 + samples/snapshot/pom.xml | 83 + samples/snippets/pom.xml | 47 + versions.txt | 6 + 128 files changed, 22704 insertions(+) create mode 100644 .github/.OwlBot.lock.yaml create mode 100644 .github/.OwlBot.yaml create mode 100644 .github/CODEOWNERS create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/support_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/blunderbuss.yml create mode 100644 .github/generated-files-bot.yml create mode 100644 .github/readme/synth.py create mode 100644 .github/release-please.yml create mode 100644 .github/snippet-bot.yml create mode 100644 .github/sync-repo-settings.yaml create mode 100644 .github/trusted-contribution.yml create mode 100644 .github/workflows/approve-readme.yaml create mode 100644 .github/workflows/auto-release.yaml create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/samples.yaml create mode 100644 .gitignore create mode 100644 .kokoro/build.bat create mode 100755 .kokoro/build.sh create mode 100755 .kokoro/coerce_logs.sh create mode 100644 .kokoro/common.cfg create mode 100644 .kokoro/common.sh create mode 100644 .kokoro/continuous/common.cfg create mode 100644 .kokoro/continuous/java8.cfg create mode 100644 .kokoro/continuous/readme.cfg create mode 100755 .kokoro/dependencies.sh create mode 100644 .kokoro/nightly/common.cfg create mode 100644 .kokoro/nightly/integration.cfg create mode 100644 .kokoro/nightly/java11.cfg create mode 100644 .kokoro/nightly/java7.cfg create mode 100644 .kokoro/nightly/java8-osx.cfg create mode 100644 .kokoro/nightly/java8-win.cfg create mode 100644 .kokoro/nightly/java8.cfg create mode 100644 .kokoro/nightly/samples.cfg create mode 100755 .kokoro/populate-secrets.sh create mode 100644 .kokoro/presubmit/clirr.cfg create mode 100644 .kokoro/presubmit/common.cfg create mode 100644 .kokoro/presubmit/dependencies.cfg create mode 100644 .kokoro/presubmit/integration.cfg create mode 100644 .kokoro/presubmit/java11.cfg create mode 100644 .kokoro/presubmit/java7.cfg create mode 100644 .kokoro/presubmit/java8-osx.cfg create mode 100644 .kokoro/presubmit/java8-win.cfg create mode 100644 .kokoro/presubmit/java8.cfg create mode 100644 .kokoro/presubmit/linkage-monitor.cfg create mode 100644 .kokoro/presubmit/lint.cfg create mode 100644 .kokoro/presubmit/samples.cfg create mode 100755 .kokoro/readme.sh create mode 100644 .kokoro/release/bump_snapshot.cfg create mode 100644 .kokoro/release/common.cfg create mode 100755 .kokoro/release/common.sh create mode 100644 .kokoro/release/drop.cfg create mode 100755 .kokoro/release/drop.sh create mode 100644 .kokoro/release/promote.cfg create mode 100755 .kokoro/release/promote.sh create mode 100644 .kokoro/release/publish_javadoc.cfg create mode 100755 .kokoro/release/publish_javadoc.sh create mode 100644 .kokoro/release/publish_javadoc11.cfg create mode 100755 .kokoro/release/publish_javadoc11.sh create mode 100644 .kokoro/release/snapshot.cfg create mode 100755 .kokoro/release/snapshot.sh create mode 100644 .kokoro/release/stage.cfg create mode 100755 .kokoro/release/stage.sh create mode 100644 .kokoro/trampoline.sh create mode 100644 .repo-metadata.json create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 codecov.yaml create mode 100644 google-cloud-essential-contacts-bom/pom.xml create mode 100644 google-cloud-essential-contacts/pom.xml create mode 100644 google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceClient.java create mode 100644 google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceSettings.java create mode 100644 google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/gapic_metadata.json create mode 100644 google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/package-info.java create mode 100644 google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/EssentialContactsServiceStub.java create mode 100644 google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/EssentialContactsServiceStubSettings.java create mode 100644 google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/GrpcEssentialContactsServiceCallableFactory.java create mode 100644 google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/GrpcEssentialContactsServiceStub.java create mode 100644 google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceClientTest.java create mode 100644 google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/MockEssentialContactsService.java create mode 100644 google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/MockEssentialContactsServiceImpl.java create mode 100644 grpc-google-cloud-essential-contacts-v1/pom.xml create mode 100644 grpc-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceGrpc.java create mode 100644 java.header create mode 100644 license-checks.xml create mode 100644 owlbot.py create mode 100644 pom.xml create mode 100644 proto-google-cloud-essential-contacts-v1/clirr-ignored-differences.xml create mode 100644 proto-google-cloud-essential-contacts-v1/pom.xml create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsRequest.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsRequestOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsResponse.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsResponseOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/Contact.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ContactName.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ContactOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/CreateContactRequest.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/CreateContactRequestOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/DeleteContactRequest.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/DeleteContactRequestOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/EnumsProto.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/FolderName.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/GetContactRequest.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/GetContactRequestOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsRequest.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsRequestOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsResponse.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsResponseOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/NotificationCategory.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/OrganizationName.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ProjectName.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/SendTestMessageRequest.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/SendTestMessageRequestOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/Service.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/UpdateContactRequest.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/UpdateContactRequestOrBuilder.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ValidationState.java create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/proto/google/cloud/essentialcontacts/v1/enums.proto create mode 100644 proto-google-cloud-essential-contacts-v1/src/main/proto/google/cloud/essentialcontacts/v1/service.proto create mode 100644 renovate.json create mode 100644 samples/install-without-bom/pom.xml create mode 100644 samples/pom.xml create mode 100644 samples/snapshot/pom.xml create mode 100644 samples/snippets/pom.xml create mode 100644 versions.txt diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 00000000..39c51c9f --- /dev/null +++ b/.github/.OwlBot.lock.yaml @@ -0,0 +1,3 @@ +docker: + digest: sha256:984b2b7b8d75fa16ff0e0b3dcdd1e86561b44e8eac23f7a1378db3d339f11333 + image: gcr.io/repo-automation-bots/owlbot-java:latest \ No newline at end of file diff --git a/.github/.OwlBot.yaml b/.github/.OwlBot.yaml new file mode 100644 index 00000000..f076d076 --- /dev/null +++ b/.github/.OwlBot.yaml @@ -0,0 +1,29 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +docker: + image: "gcr.io/repo-automation-bots/owlbot-java:latest" + +deep-remove-regex: +- "/grpc-google-.*/src" +- "/proto-google-.*/src" +- "/google-.*/src" + +deep-copy-regex: +- source: "/google/cloud/essentialcontacts/(v.*)/.*-java/proto-google-.*/src" + dest: "/owl-bot-staging/$1/proto-google-cloud-essential-contacts-$1/src" +- source: "/google/cloud/essentialcontacts/(v.*)/.*-java/grpc-google-.*/src" + dest: "/owl-bot-staging/$1/grpc-google-cloud-essential-contacts-$1/src" +- source: "/google/cloud/essentialcontacts/(v.*)/.*-java/gapic-google-.*/src" + dest: "/owl-bot-staging/$1/google-cloud-essential-contacts/src" \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..30fdb7b9 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,10 @@ +# Code owners file. +# This file controls who is tagged for review for any given pull request. + +# For syntax help see: +# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax + +* @googleapis/yoshi-java + +# The java-samples-reviewers team is the default owner for samples changes +samples/**/*.java @googleapis/java-samples-reviewers diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..01cd2f98 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,51 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +Please run down the following list and make sure you've tried the usual "quick fixes": + + - Search the issues already opened: https://github.com/googleapis/java-essential-contacts/issues + - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform + +If you are still having issues, please include as much information as possible: + +#### Environment details + +1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). + General, Core, and Other are also allowed as types +2. OS type and version: +3. Java version: +4. essential-contacts version(s): + +#### Steps to reproduce + + 1. ? + 2. ? + +#### Code example + +```java +// example +``` + +#### Stack trace +``` +Any relevant stacktrace here. +``` + +#### External references such as API reference guides + +- ? + +#### Any additional information below + + +Following these steps guarantees the quickest resolution possible. + +Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..754e30c6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this library + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +**Is your feature request related to a problem? Please describe.** +What the problem is. Example: I'm always frustrated when [...] + +**Describe the solution you'd like** +What you want to happen. + +**Describe alternatives you've considered** +Any alternative solutions or features you've considered. + +**Additional context** +Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 00000000..99586903 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -0,0 +1,7 @@ +--- +name: Support request +about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. + +--- + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..1de968f1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: +- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-essential-contacts/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea +- [ ] Ensure the tests and linter pass +- [ ] Code coverage does not decrease (if any source code was changed) +- [ ] Appropriate docs were updated (if necessary) + +Fixes # ☕️ diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml new file mode 100644 index 00000000..1a23ea42 --- /dev/null +++ b/.github/blunderbuss.yml @@ -0,0 +1,7 @@ +# Configuration for the Blunderbuss GitHub app. For more info see +# https://github.com/googleapis/repo-automation-bots/tree/master/packages/blunderbuss +assign_prs_by: +- labels: + - samples + to: + - googleapis/java-samples-reviewers \ No newline at end of file diff --git a/.github/generated-files-bot.yml b/.github/generated-files-bot.yml new file mode 100644 index 00000000..47c2ba13 --- /dev/null +++ b/.github/generated-files-bot.yml @@ -0,0 +1,11 @@ +externalManifests: +- type: json + file: 'synth.metadata' + jsonpath: '$.generatedFiles[*]' +- type: json + file: '.github/readme/synth.metadata/synth.metadata' + jsonpath: '$.generatedFiles[*]' +ignoreAuthors: +- 'renovate-bot' +- 'yoshi-automation' +- 'release-please[bot]' diff --git a/.github/readme/synth.py b/.github/readme/synth.py new file mode 100644 index 00000000..7b48cc28 --- /dev/null +++ b/.github/readme/synth.py @@ -0,0 +1,19 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated the README for this library.""" + +from synthtool.languages import java + +java.custom_templates(["java_library/README.md"]) diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 00000000..dce2c845 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,2 @@ +releaseType: java-yoshi +bumpMinorPreMajor: true \ No newline at end of file diff --git a/.github/snippet-bot.yml b/.github/snippet-bot.yml new file mode 100644 index 00000000..e69de29b diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml new file mode 100644 index 00000000..e100454f --- /dev/null +++ b/.github/sync-repo-settings.yaml @@ -0,0 +1,49 @@ + +# Whether or not rebase-merging is enabled on this repository. +# Defaults to `true` +rebaseMergeAllowed: false + +# Whether or not squash-merging is enabled on this repository. +# Defaults to `true` +squashMergeAllowed: true + +# Whether or not PRs are merged with a merge commit on this repository. +# Defaults to `false` +mergeCommitAllowed: false + +# Rules for master branch protection +branchProtectionRules: +# Identifies the protection rule pattern. Name of the branch to be protected. +# Defaults to `master` +- pattern: master + # Can admins overwrite branch protection. + # Defaults to `true` + isAdminEnforced: true + # Number of approving reviews required to update matching branches. + # Defaults to `1` + requiredApprovingReviewCount: 1 + # Are reviews from code owners required to update matching branches. + # Defaults to `false` + requiresCodeOwnerReviews: true + # Require up to date branches + requiresStrictStatusChecks: false + # List of required status check contexts that must pass for commits to be accepted to matching branches. + requiredStatusCheckContexts: + - "dependencies (8)" + - "dependencies (11)" + - "linkage-monitor" + - "lint" + - "clirr" + - "units (7)" + - "units (8)" + - "units (11)" + - "Kokoro - Test: Integration" + - "cla/google" +# List of explicit permissions to add (additive only) +permissionRules: +- team: yoshi-admins + permission: admin +- team: yoshi-java-admins + permission: admin +- team: yoshi-java + permission: push diff --git a/.github/trusted-contribution.yml b/.github/trusted-contribution.yml new file mode 100644 index 00000000..f247d5c7 --- /dev/null +++ b/.github/trusted-contribution.yml @@ -0,0 +1,2 @@ +trustedContributors: +- renovate-bot \ No newline at end of file diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml new file mode 100644 index 00000000..7513acae --- /dev/null +++ b/.github/workflows/approve-readme.yaml @@ -0,0 +1,54 @@ +on: + pull_request: +name: auto-merge-readme +jobs: + approve: + runs-on: ubuntu-latest + if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' + steps: + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + script: | + // only approve PRs from yoshi-automation + if (context.payload.pull_request.user.login !== "yoshi-automation") { + return; + } + + // only approve PRs like "chore: release " + if (!context.payload.pull_request.title === "chore: regenerate README") { + return; + } + + // only approve PRs with README.md and synth.metadata changes + const files = new Set( + ( + await github.paginate( + github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }) + ) + ).map(file => file.filename) + ); + if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { + return; + } + + // approve README regeneration PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped PR!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach automerge label + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['automerge'] + }); diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml new file mode 100644 index 00000000..9b4fd4d8 --- /dev/null +++ b/.github/workflows/auto-release.yaml @@ -0,0 +1,88 @@ +on: + pull_request: +name: auto-release +jobs: + approve: + runs-on: ubuntu-latest + if: contains(github.head_ref, 'release-please') + steps: + - uses: actions/github-script@v3 + with: + github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} + debug: true + script: | + // only approve PRs from release-please[bot] + if (context.payload.pull_request.user.login !== "release-please[bot]") { + return; + } + + // only approve PRs like "chore: release " + if ( !context.payload.pull_request.title.startsWith("chore: release") ) { + return; + } + + // only approve PRs with pom.xml and versions.txt changes + const filesPromise = github.pulls.listFiles.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + const changed_files = await github.paginate(filesPromise) + + if ( changed_files.length < 1 ) { + console.log( "Not proceeding since PR is empty!" ) + return; + } + + if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) { + console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" ) + return; + } + + // trigger auto-release when + // 1) it is a SNAPSHOT release (auto-generated post regular release) + // 2) there are dependency updates only + // 3) there are no open dependency update PRs in this repo (to avoid multiple releases) + if ( + context.payload.pull_request.body.includes("Fix") || + context.payload.pull_request.body.includes("Build") || + context.payload.pull_request.body.includes("Documentation") || + context.payload.pull_request.body.includes("BREAKING CHANGES") || + context.payload.pull_request.body.includes("Features") + ) { + console.log( "Not auto-releasing since it is not a dependency-update-only release." ); + return; + } + + const promise = github.pulls.list.endpoint({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open' + }); + const open_pulls = await github.paginate(promise) + + if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) { + for ( const pull of open_pulls ) { + if ( pull.title.startsWith("deps: update dependency") ) { + console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." ); + return; + } + } + } + + // approve release PR + await github.pulls.createReview({ + owner: context.repo.owner, + repo: context.repo.repo, + body: 'Rubber stamped release!', + pull_number: context.payload.pull_request.number, + event: 'APPROVE' + }); + + // attach kokoro:force-run and automerge labels + await github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['kokoro:force-run', 'automerge'] + }); diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..def8b3a2 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,83 @@ +on: + push: + branches: + - master + pull_request: +name: ci +jobs: + units: + runs-on: ubuntu-latest + strategy: + matrix: + java: [7, 8, 11] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: test + - name: coverage + uses: codecov/codecov-action@v1 + with: + name: actions ${{matrix.java}} + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.bat + env: + JOB_TYPE: test + dependencies: + runs-on: ubuntu-latest + strategy: + matrix: + java: [8, 11] + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: ${{matrix.java}} + - run: java -version + - run: .kokoro/dependencies.sh + linkage-monitor: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - name: Install artifacts to local Maven repository + run: .kokoro/build.sh + shell: bash + - name: Validate any conflicts with regard to com.google.cloud:libraries-bom (latest release) + uses: GoogleCloudPlatform/cloud-opensource-java/linkage-monitor@v1-linkagemonitor + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: lint + clirr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - run: java -version + - run: .kokoro/build.sh + env: + JOB_TYPE: clirr \ No newline at end of file diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml new file mode 100644 index 00000000..c46230a7 --- /dev/null +++ b/.github/workflows/samples.yaml @@ -0,0 +1,14 @@ +on: + pull_request: +name: samples +jobs: + checkstyle: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Run checkstyle + run: mvn -P lint --quiet --batch-mode checkstyle:check + working-directory: samples/snippets diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..069d08fc --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Maven +target/ + +# Eclipse +.classpath +.project +.settings + +# Intellij +*.iml +.idea/ + +# python utilities +*.pyc +__pycache__ + +.flattened-pom.xml diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 00000000..05826ad9 --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,3 @@ +:: See documentation in type-shell-output.bat + +"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 00000000..d4865167 --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,125 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java version +java -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +RETURN_CODE=0 +set +e + +case ${JOB_TYPE} in +test) + mvn test -B -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? + ;; +lint) + mvn com.coveo:fmt-maven-plugin:check + RETURN_CODE=$? + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc + RETURN_CODE=$? + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} \ + -ntp \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + ;; +samples) + SAMPLES_DIR=samples + # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. + if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] + then + SAMPLES_DIR=samples/snapshot + fi + + if [[ -f ${SAMPLES_DIR}/pom.xml ]] + then + for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do + [[ -f "$FILE" ]] || continue + source "$FILE" + done + + pushd ${SAMPLES_DIR} + mvn -B \ + -Penable-samples \ + -ntp \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi + ;; +clirr) + mvn -B -Denforcer.skip=true clirr:check + RETURN_CODE=$? + ;; +*) + ;; +esac + +if [ "${REPORT_COVERAGE}" == "true" ] +then + bash ${KOKORO_GFILE_DIR}/codecov.sh +fi + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +if [[ "${ENABLE_BUILD_COP}" == "true" ]] +then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot + ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/java-essential-contacts +fi + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 00000000..5cf7ba49 --- /dev/null +++ b/.kokoro/coerce_logs.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script finds and moves sponge logs so that they can be found by placer +# and are not flagged as flaky by sponge. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +job=$(basename ${KOKORO_JOB_NAME}) + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + echo "processing ${xml}" + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${job}/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 00000000..7187b078 --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "java-essential-contacts/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/build.sh" +} diff --git a/.kokoro/common.sh b/.kokoro/common.sh new file mode 100644 index 00000000..ace89f45 --- /dev/null +++ b/.kokoro/common.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +function retry_with_backoff { + attempts_left=$1 + sleep_seconds=$2 + shift 2 + command=$@ + + + # store current flag state + flags=$- + + # allow a failures to continue + set +e + ${command} + exit_code=$? + + # restore "e" flag + if [[ ${flags} =~ e ]] + then set -e + else set +e + fi + + if [[ $exit_code == 0 ]] + then + return 0 + fi + + # failure + if [[ ${attempts_left} > 0 ]] + then + echo "failure (${exit_code}), sleeping ${sleep_seconds}..." + sleep ${sleep_seconds} + new_attempts=$((${attempts_left} - 1)) + new_sleep=$((${sleep_seconds} * 2)) + retry_with_backoff ${new_attempts} ${new_sleep} ${command} + fi + + return $exit_code +} + +## Helper functionss +function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } +function msg() { println "$*" >&2; } +function println() { printf '%s\n' "$(now) $*"; } \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 00000000..25368d90 --- /dev/null +++ b/.kokoro/continuous/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-essential-contacts/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg new file mode 100644 index 00000000..495cc7ba --- /dev/null +++ b/.kokoro/continuous/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/continuous/readme.cfg b/.kokoro/continuous/readme.cfg new file mode 100644 index 00000000..2ede4c3a --- /dev/null +++ b/.kokoro/continuous/readme.cfg @@ -0,0 +1,55 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/python-multi" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/readme.sh" +} + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.log" + } +} + +# The github token is stored here. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "yoshi-automation-github-key" + # TODO(theacodes): remove this after secrets have globally propagated + backend_type: FASTCONFIGPUSH + } + } +} + +# Common env vars for all repositories and builds. +env_vars: { + key: "GITHUB_USER" + value: "yoshi-automation" +} +env_vars: { + key: "GITHUB_EMAIL" + value: "yoshi-automation@google.com" +} diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh new file mode 100755 index 00000000..59d2aafc --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +# include common functions +source ${scriptDir}/common.sh + +# Print out Java +java -version +echo $JOB_TYPE + +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" + +# this should run maven enforcer +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dmaven.javadoc.skip=true \ + -Dclirr.skip=true + +mvn -B dependency:analyze -DfailOnWarning=true + +echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" +## Run dependency list completeness check +function completenessCheck() { + # Output dep list with compile scope generated using the original pom + # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. + # This is stripped from the output as it is not present in the flattened pom. + # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. + msg "Generating dependency list using original pom..." + mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e s/\\s--\\smodule.*// >.org-list.txt + + # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) + msg "Generating dependency list using flattened pom..." + mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + + # Compare two dependency lists + msg "Comparing dependency lists..." + diff .org-list.txt .new-list.txt >.diff.txt + if [[ $? == 0 ]] + then + msg "Success. No diff!" + else + msg "Diff found. See below: " + msg "You can also check .diff.txt file located in $1." + cat .diff.txt + return 1 + fi +} + +# Allow failures to continue running the script +set +e + +error_count=0 +for path in $(find -name ".flattened-pom.xml") +do + # Check flattened pom in each dir that contains it for completeness + dir=$(dirname "$path") + pushd "$dir" + completenessCheck "$dir" + error_count=$(($error_count + $?)) + popd +done + +if [[ $error_count == 0 ]] +then + msg "All checks passed." + exit 0 +else + msg "Errors found. See log statements above." + exit 1 +fi diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg new file mode 100644 index 00000000..25368d90 --- /dev/null +++ b/.kokoro/nightly/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-essential-contacts/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg new file mode 100644 index 00000000..0048c8ec --- /dev/null +++ b/.kokoro/nightly/integration.cfg @@ -0,0 +1,37 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/nightly/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/nightly/java7.cfg b/.kokoro/nightly/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/nightly/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/nightly/java8-osx.cfg b/.kokoro/nightly/java8-osx.cfg new file mode 100644 index 00000000..5d33382a --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-essential-contacts/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 00000000..9006190f --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-essential-contacts/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg new file mode 100644 index 00000000..495cc7ba --- /dev/null +++ b/.kokoro/nightly/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/nightly/samples.cfg b/.kokoro/nightly/samples.cfg new file mode 100644 index 00000000..f2542931 --- /dev/null +++ b/.kokoro/nightly/samples.cfg @@ -0,0 +1,38 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" +} diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh new file mode 100755 index 00000000..f5251425 --- /dev/null +++ b/.kokoro/populate-secrets.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# Copyright 2020 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;} +function msg { println "$*" >&2 ;} +function println { printf '%s\n' "$(now) $*" ;} + + +# Populates requested secrets set in SECRET_MANAGER_KEYS from service account: +# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com +SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager" +msg "Creating folder on disk for secrets: ${SECRET_LOCATION}" +mkdir -p ${SECRET_LOCATION} +for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g") +do + msg "Retrieving secret ${key}" + docker run --entrypoint=gcloud \ + --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \ + gcr.io/google.com/cloudsdktool/cloud-sdk \ + secrets versions access latest \ + --project cloud-devrel-kokoro-resources \ + --secret ${key} > \ + "${SECRET_LOCATION}/${key}" + if [[ $? == 0 ]]; then + msg "Secret written to ${SECRET_LOCATION}/${key}" + else + msg "Error retrieving secret ${key}" + fi +done diff --git a/.kokoro/presubmit/clirr.cfg b/.kokoro/presubmit/clirr.cfg new file mode 100644 index 00000000..ec572442 --- /dev/null +++ b/.kokoro/presubmit/clirr.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "clirr" +} \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 00000000..e5c53863 --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-essential-contacts/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg new file mode 100644 index 00000000..60e45ccf --- /dev/null +++ b/.kokoro/presubmit/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/dependencies.sh" +} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 00000000..dded67a9 --- /dev/null +++ b/.kokoro/presubmit/integration.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "integration" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-it-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-it-service-account" +} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/presubmit/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/presubmit/java7.cfg b/.kokoro/presubmit/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/presubmit/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/presubmit/java8-osx.cfg b/.kokoro/presubmit/java8-osx.cfg new file mode 100644 index 00000000..5d33382a --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-essential-contacts/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 00000000..9006190f --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-essential-contacts/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg new file mode 100644 index 00000000..495cc7ba --- /dev/null +++ b/.kokoro/presubmit/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg new file mode 100644 index 00000000..39c766fd --- /dev/null +++ b/.kokoro/presubmit/linkage-monitor.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/linkage-monitor.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg new file mode 100644 index 00000000..01e09600 --- /dev/null +++ b/.kokoro/presubmit/samples.cfg @@ -0,0 +1,33 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "samples" +} + +# TODO: remove this after we've migrated all tests and scripts +env_vars: { + key: "GCLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_CLOUD_PROJECT" + value: "java-docs-samples-testing" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "secret_manager/java-docs-samples-service-account" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "java-docs-samples-service-account" +} \ No newline at end of file diff --git a/.kokoro/readme.sh b/.kokoro/readme.sh new file mode 100755 index 00000000..3128003e --- /dev/null +++ b/.kokoro/readme.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +cd ${KOKORO_ARTIFACTS_DIR}/github/java-essential-contacts + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Kokoro exposes this as a file, but the scripts expect just a plain variable. +export GITHUB_TOKEN=$(cat ${KOKORO_KEYSTORE_DIR}/73713_yoshi-automation-github-key) + +# Setup git credentials +echo "https://${GITHUB_TOKEN}:@github.com" >> ~/.git-credentials +git config --global credential.helper 'store --file ~/.git-credentials' + +python3.6 -m pip install git+https://github.com/googleapis/synthtool.git#egg=gcp-synthtool + +set +e +python3.6 -m autosynth.synth \ + --repository=googleapis/java-essential-contacts \ + --synth-file-name=.github/readme/synth.py \ + --metadata-path=.github/readme/synth.metadata \ + --pr-title="chore: regenerate README" \ + --branch-suffix="readme" + +# autosynth returns 28 to signal there are no changes +RETURN_CODE=$? +if [[ ${RETURN_CODE} -ne 0 && ${RETURN_CODE} -ne 28 ]] +then + exit ${RETURN_CODE} +fi diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg new file mode 100644 index 00000000..17b70205 --- /dev/null +++ b/.kokoro/release/bump_snapshot.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-essential-contacts/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/node:10-user" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/release/bump_snapshot.sh" +} + +# tokens used by release-please to keep an up-to-date release PR. +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-key-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-token-release-please" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "github-magic-proxy-url-release-please" + } + } +} diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg new file mode 100644 index 00000000..ed86e0e6 --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,49 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-essential-contacts/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-keyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-passphrase" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-pubkeyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "sonatype-credentials" + } + } +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh new file mode 100755 index 00000000..6e3f6599 --- /dev/null +++ b/.kokoro/release/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# Get secrets from keystore and set and environment variables +setup_environment_secrets() { + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) + export GPG_TTY=$(tty) + export GPG_HOMEDIR=/gpg + mkdir $GPG_HOMEDIR + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') +} + +create_settings_xml_file() { + echo " + + + ossrh + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-staging + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-snapshots + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + +" > $1 +} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg new file mode 100644 index 00000000..b3a9f02c --- /dev/null +++ b/.kokoro/release/drop.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/release/drop.sh" +} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 00000000..5c4551ef --- /dev/null +++ b/.kokoro/release/drop.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:drop -B \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg new file mode 100644 index 00000000..42e2c7d5 --- /dev/null +++ b/.kokoro/release/promote.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/release/promote.sh" +} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 00000000..1fa95fa5 --- /dev/null +++ b/.kokoro/release/promote.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh + +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg new file mode 100644 index 00000000..43161ee5 --- /dev/null +++ b/.kokoro/release/publish_javadoc.cfg @@ -0,0 +1,23 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/doc-templates/" + +env_vars: { + key: "STAGING_BUCKET" + value: "docs-staging" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/release/publish_javadoc.sh" +} + + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh new file mode 100755 index 00000000..7271b2f0 --- /dev/null +++ b/.kokoro/release/publish_javadoc.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright 2019 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET}" ]]; then + echo "Need to set STAGING_BUCKET environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-cloud-essential-contacts +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# build the docs +mvn site -B -q + +pushd target/site/apidocs + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --language java + +# upload docs +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET} diff --git a/.kokoro/release/publish_javadoc11.cfg b/.kokoro/release/publish_javadoc11.cfg new file mode 100644 index 00000000..a436da23 --- /dev/null +++ b/.kokoro/release/publish_javadoc11.cfg @@ -0,0 +1,30 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# cloud-rad production +env_vars: { + key: "STAGING_BUCKET_V2" + value: "docs-staging-v2" +} + +# Configure the docker image for kokoro-trampoline +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/release/publish_javadoc11.sh" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} + +# Downloads docfx doclet resource. This will be in ${KOKORO_GFILE_DIR}/ +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/docfx" diff --git a/.kokoro/release/publish_javadoc11.sh b/.kokoro/release/publish_javadoc11.sh new file mode 100755 index 00000000..01ca122e --- /dev/null +++ b/.kokoro/release/publish_javadoc11.sh @@ -0,0 +1,58 @@ +#!/bin/bash +# Copyright 2021 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET_V2}" ]]; then + echo "Need to set STAGING_BUCKET_V2 environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -q -DskipTests=true + +export NAME=google-cloud-essential-contacts +export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# V3 generates docfx yml from javadoc +# generate yml +mvn clean site -B -q -P docFX + +# copy README to docfx-yml dir and rename index.md +cp README.md target/docfx-yml/index.md + +pushd target/docfx-yml + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --language java + +# upload yml to production bucket +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET_V2} \ + --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg new file mode 100644 index 00000000..ea67dfdf --- /dev/null +++ b/.kokoro/release/snapshot.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/release/snapshot.sh" +} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh new file mode 100755 index 00000000..1f55b770 --- /dev/null +++ b/.kokoro/release/snapshot.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +# ensure we're trying to push a snapshot (no-result returns non-zero exit code) +grep SNAPSHOT versions.txt + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg new file mode 100644 index 00000000..6ac11497 --- /dev/null +++ b/.kokoro/release/stage.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-essential-contacts/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-essential-contacts/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-essential-contacts" + } +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" +} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh new file mode 100755 index 00000000..8a103384 --- /dev/null +++ b/.kokoro/release/stage.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +source $(dirname "$0")/../common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +# attempt to stage 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn clean deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DskipTests=true \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} + +if [[ -n "${AUTORELEASE_PR}" ]] +then + mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml +fi \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 00000000..9da0f839 --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT + +$(dirname $0)/populate-secrets.sh # Secret Manager secrets. +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.repo-metadata.json b/.repo-metadata.json new file mode 100644 index 00000000..52ddcc4e --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,15 @@ +{ + "name": "essential-contacts", + "name_pretty": "Essential Contacts API", + "product_documentation": "https://cloud.google.com/resource-manager/docs/managing-notification-contacts/", + "api_description": "helps you customize who receives notifications by providing your own list of contacts in many Google Cloud services.", + "client_documentation": "https://googleapis.dev/java/google-cloud-essential-contacts/latest/index.html", + "release_level": "ga", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-essential-contacts", + "repo_short": "java-essential-contacts", + "distribution_name": "com.google.cloud:google-cloud-essential-contacts", + "api_id": "essential-contacts.googleapis.com", + "requires_billing": true +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..2add2547 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,94 @@ + +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *googleapis-stewards@google.com*, the +Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out to the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..f2dbdee0 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,139 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). + +## Building the project + +To build, package, and run all unit tests run the command + +``` +mvn clean verify +``` + +### Running Integration tests + +To include integration tests when building the project, you need access to +a GCP Project with a valid service account. + +For instructions on how to generate a service account and corresponding +credentials JSON see: [Creating a Service Account][1]. + +Then run the following to build, package, run all unit tests and run all +integration tests. + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-integration-tests clean verify +``` + +## Code Samples + +Code Samples must be bundled in separate Maven modules, and guarded by a +Maven profile with the name `enable-samples`. + +The samples must be separate from the primary project for a few reasons: +1. Primary projects have a minimum Java version of Java 7 whereas samples have + a minimum Java version of Java 8. Due to this we need the ability to + selectively exclude samples from a build run. +2. Many code samples depend on external GCP services and need + credentials to access the service. +3. Code samples are not released as Maven artifacts and must be excluded from + release builds. + +### Building + +```bash +mvn -Penable-samples clean verify +``` + +Some samples require access to GCP services and require a service account: + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-samples clean verify +``` + +### Profile Config + +1. To add samples in a profile to your Maven project, add the following to your +`pom.xml` + + ```xml + + [...] + + + enable-samples + + sample + + + + [...] + + ``` + +2. [Activate](#profile-activation) the profile. +3. Define your samples in a normal Maven project in the `samples/` directory. + +### Code Formatting + +Code in this repo is formatted with +[google-java-format](https://github.com/google/google-java-format). +To run formatting on your project, you can run: +``` +mvn com.coveo:fmt-maven-plugin:format +``` + +### Profile Activation + +To include code samples when building and testing the project, enable the +`enable-samples` Maven profile. + +#### Command line + +To activate the Maven profile on the command line add `-Penable-samples` to your +Maven command. + +#### Maven `settings.xml` + +To activate the Maven profile in your `~/.m2/settings.xml` add an entry of +`enable-samples` following the instructions in [Active Profiles][2]. + +This method has the benefit of applying to all projects you build (and is +respected by IntelliJ IDEA) and is recommended if you are going to be +contributing samples to several projects. + +#### IntelliJ IDEA + +To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in +[Activate Maven profiles][3] to activate `enable-samples`. + +[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account +[2]: https://maven.apache.org/settings.html#Active_Profiles +[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 00000000..5724ea94 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/google-cloud-essential-contacts-bom/pom.xml b/google-cloud-essential-contacts-bom/pom.xml new file mode 100644 index 00000000..707e395b --- /dev/null +++ b/google-cloud-essential-contacts-bom/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + com.google.cloud + google-cloud-essential-contacts-bom + 0.0.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 0.11.0 + + + Google Essential Contacts API BOM + https://github.com/googleapis/java-essential-contacts + + BOM for Essential Contacts API + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-essential-contacts.git + scm:git:git@github.com:googleapis/java-essential-contacts.git + https://github.com/googleapis/java-essential-contacts + + + + true + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + com.google.cloud + google-cloud-essential-contacts + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-essential-contacts-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-essential-contacts-v1 + 0.0.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + diff --git a/google-cloud-essential-contacts/pom.xml b/google-cloud-essential-contacts/pom.xml new file mode 100644 index 00000000..97b27db9 --- /dev/null +++ b/google-cloud-essential-contacts/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + com.google.cloud + google-cloud-essential-contacts + 0.0.1-SNAPSHOT + jar + Google Essential Contacts API + https://github.com/googleapis/java-essential-contacts + Essential Contacts API helps you customize who receives notifications by providing your own list of contacts in many Google Cloud services. + + com.google.cloud + google-cloud-essential-contacts-parent + 0.0.1-SNAPSHOT + + + google-cloud-essential-contacts + + + + 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-essential-contacts-v1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + + + junit + junit + test + 4.13.2 + + + + com.google.api.grpc + grpc-google-cloud-essential-contacts-v1 + test + + + + com.google.api + gax-grpc + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceClient.java b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceClient.java new file mode 100644 index 00000000..f2412c52 --- /dev/null +++ b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceClient.java @@ -0,0 +1,1139 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +import com.google.api.core.ApiFunction; +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.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.essentialcontacts.v1.stub.EssentialContactsServiceStub; +import com.google.cloud.essentialcontacts.v1.stub.EssentialContactsServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +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 contacts for important Google Cloud notifications. + * + *

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
+ * try (EssentialContactsServiceClient essentialContactsServiceClient =
+ *     EssentialContactsServiceClient.create()) {
+ *   FolderName parent = FolderName.of("[FOLDER]");
+ *   Contact contact = Contact.newBuilder().build();
+ *   Contact response = essentialContactsServiceClient.createContact(parent, contact);
+ * }
+ * }
+ * + *

Note: close() needs to be called on the EssentialContactsServiceClient 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 + * EssentialContactsServiceSettings to create(). For example: + * + *

To customize credentials: + * + *

{@code
+ * EssentialContactsServiceSettings essentialContactsServiceSettings =
+ *     EssentialContactsServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * EssentialContactsServiceClient essentialContactsServiceClient =
+ *     EssentialContactsServiceClient.create(essentialContactsServiceSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * EssentialContactsServiceSettings essentialContactsServiceSettings =
+ *     EssentialContactsServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * EssentialContactsServiceClient essentialContactsServiceClient =
+ *     EssentialContactsServiceClient.create(essentialContactsServiceSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class EssentialContactsServiceClient implements BackgroundResource { + private final EssentialContactsServiceSettings settings; + private final EssentialContactsServiceStub stub; + + /** Constructs an instance of EssentialContactsServiceClient with default settings. */ + public static final EssentialContactsServiceClient create() throws IOException { + return create(EssentialContactsServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of EssentialContactsServiceClient, 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 EssentialContactsServiceClient create( + EssentialContactsServiceSettings settings) throws IOException { + return new EssentialContactsServiceClient(settings); + } + + /** + * Constructs an instance of EssentialContactsServiceClient, using the given stub for making + * calls. This is for advanced usage - prefer using create(EssentialContactsServiceSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final EssentialContactsServiceClient create(EssentialContactsServiceStub stub) { + return new EssentialContactsServiceClient(stub); + } + + /** + * Constructs an instance of EssentialContactsServiceClient, 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 EssentialContactsServiceClient(EssentialContactsServiceSettings settings) + throws IOException { + this.settings = settings; + this.stub = ((EssentialContactsServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected EssentialContactsServiceClient(EssentialContactsServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final EssentialContactsServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public EssentialContactsServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a new contact for a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   FolderName parent = FolderName.of("[FOLDER]");
+   *   Contact contact = Contact.newBuilder().build();
+   *   Contact response = essentialContactsServiceClient.createContact(parent, contact);
+   * }
+   * }
+ * + * @param parent Required. The resource to save this contact for. Format: + * organizations/{organization_id}, folders/{folder_id} or projects/{project_id} + * @param contact Required. The contact to create. Must specify an email address and language tag. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Contact createContact(FolderName parent, Contact contact) { + CreateContactRequest request = + CreateContactRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setContact(contact) + .build(); + return createContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a new contact for a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   Contact contact = Contact.newBuilder().build();
+   *   Contact response = essentialContactsServiceClient.createContact(parent, contact);
+   * }
+   * }
+ * + * @param parent Required. The resource to save this contact for. Format: + * organizations/{organization_id}, folders/{folder_id} or projects/{project_id} + * @param contact Required. The contact to create. Must specify an email address and language tag. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Contact createContact(OrganizationName parent, Contact contact) { + CreateContactRequest request = + CreateContactRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setContact(contact) + .build(); + return createContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a new contact for a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   Contact contact = Contact.newBuilder().build();
+   *   Contact response = essentialContactsServiceClient.createContact(parent, contact);
+   * }
+   * }
+ * + * @param parent Required. The resource to save this contact for. Format: + * organizations/{organization_id}, folders/{folder_id} or projects/{project_id} + * @param contact Required. The contact to create. Must specify an email address and language tag. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Contact createContact(ProjectName parent, Contact contact) { + CreateContactRequest request = + CreateContactRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setContact(contact) + .build(); + return createContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a new contact for a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   String parent = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString();
+   *   Contact contact = Contact.newBuilder().build();
+   *   Contact response = essentialContactsServiceClient.createContact(parent, contact);
+   * }
+   * }
+ * + * @param parent Required. The resource to save this contact for. Format: + * organizations/{organization_id}, folders/{folder_id} or projects/{project_id} + * @param contact Required. The contact to create. Must specify an email address and language tag. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Contact createContact(String parent, Contact contact) { + CreateContactRequest request = + CreateContactRequest.newBuilder().setParent(parent).setContact(contact).build(); + return createContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a new contact for a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   CreateContactRequest request =
+   *       CreateContactRequest.newBuilder()
+   *           .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .setContact(Contact.newBuilder().build())
+   *           .build();
+   *   Contact response = essentialContactsServiceClient.createContact(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 Contact createContact(CreateContactRequest request) { + return createContactCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Adds a new contact for a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   CreateContactRequest request =
+   *       CreateContactRequest.newBuilder()
+   *           .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .setContact(Contact.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       essentialContactsServiceClient.createContactCallable().futureCall(request);
+   *   // Do something.
+   *   Contact response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createContactCallable() { + return stub.createContactCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a contact. Note: A contact's email address cannot be changed. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   Contact contact = Contact.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   Contact response = essentialContactsServiceClient.updateContact(contact, updateMask);
+   * }
+   * }
+ * + * @param contact Required. The contact resource to replace the existing saved contact. Note: the + * email address of the contact cannot be modified. + * @param updateMask Optional. The update mask applied to the resource. For the `FieldMask` + * definition, see + * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Contact updateContact(Contact contact, FieldMask updateMask) { + UpdateContactRequest request = + UpdateContactRequest.newBuilder().setContact(contact).setUpdateMask(updateMask).build(); + return updateContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a contact. Note: A contact's email address cannot be changed. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   UpdateContactRequest request =
+   *       UpdateContactRequest.newBuilder()
+   *           .setContact(Contact.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   Contact response = essentialContactsServiceClient.updateContact(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 Contact updateContact(UpdateContactRequest request) { + return updateContactCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Updates a contact. Note: A contact's email address cannot be changed. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   UpdateContactRequest request =
+   *       UpdateContactRequest.newBuilder()
+   *           .setContact(Contact.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .build();
+   *   ApiFuture future =
+   *       essentialContactsServiceClient.updateContactCallable().futureCall(request);
+   *   // Do something.
+   *   Contact response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateContactCallable() { + return stub.updateContactCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the contacts that have been set on a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   FolderName parent = FolderName.of("[FOLDER]");
+   *   for (Contact element : essentialContactsServiceClient.listContacts(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The parent resource name. Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListContactsPagedResponse listContacts(FolderName parent) { + ListContactsRequest request = + ListContactsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listContacts(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the contacts that have been set on a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
+   *   for (Contact element : essentialContactsServiceClient.listContacts(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The parent resource name. Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListContactsPagedResponse listContacts(OrganizationName parent) { + ListContactsRequest request = + ListContactsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listContacts(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the contacts that have been set on a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ProjectName parent = ProjectName.of("[PROJECT]");
+   *   for (Contact element : essentialContactsServiceClient.listContacts(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The parent resource name. Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListContactsPagedResponse listContacts(ProjectName parent) { + ListContactsRequest request = + ListContactsRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listContacts(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the contacts that have been set on a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   String parent = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString();
+   *   for (Contact element : essentialContactsServiceClient.listContacts(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The parent resource name. Format: organizations/{organization_id}, + * folders/{folder_id} or projects/{project_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListContactsPagedResponse listContacts(String parent) { + ListContactsRequest request = ListContactsRequest.newBuilder().setParent(parent).build(); + return listContacts(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the contacts that have been set on a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ListContactsRequest request =
+   *       ListContactsRequest.newBuilder()
+   *           .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Contact element : essentialContactsServiceClient.listContacts(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 ListContactsPagedResponse listContacts(ListContactsRequest request) { + return listContactsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the contacts that have been set on a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ListContactsRequest request =
+   *       ListContactsRequest.newBuilder()
+   *           .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       essentialContactsServiceClient.listContactsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Contact element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listContactsPagedCallable() { + return stub.listContactsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists the contacts that have been set on a resource. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ListContactsRequest request =
+   *       ListContactsRequest.newBuilder()
+   *           .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ListContactsResponse response =
+   *         essentialContactsServiceClient.listContactsCallable().call(request);
+   *     for (Contact element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listContactsCallable() { + return stub.listContactsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a single contact. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ContactName name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]");
+   *   Contact response = essentialContactsServiceClient.getContact(name);
+   * }
+   * }
+ * + * @param name Required. The name of the contact to retrieve. Format: + * organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or projects/{project_id}/contacts/{contact_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Contact getContact(ContactName name) { + GetContactRequest request = + GetContactRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a single contact. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   String name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString();
+   *   Contact response = essentialContactsServiceClient.getContact(name);
+   * }
+   * }
+ * + * @param name Required. The name of the contact to retrieve. Format: + * organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or projects/{project_id}/contacts/{contact_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Contact getContact(String name) { + GetContactRequest request = GetContactRequest.newBuilder().setName(name).build(); + return getContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a single contact. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   GetContactRequest request =
+   *       GetContactRequest.newBuilder()
+   *           .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .build();
+   *   Contact response = essentialContactsServiceClient.getContact(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 Contact getContact(GetContactRequest request) { + return getContactCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets a single contact. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   GetContactRequest request =
+   *       GetContactRequest.newBuilder()
+   *           .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       essentialContactsServiceClient.getContactCallable().futureCall(request);
+   *   // Do something.
+   *   Contact response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getContactCallable() { + return stub.getContactCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a contact. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ContactName name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]");
+   *   essentialContactsServiceClient.deleteContact(name);
+   * }
+   * }
+ * + * @param name Required. The name of the contact to delete. Format: + * organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or projects/{project_id}/contacts/{contact_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteContact(ContactName name) { + DeleteContactRequest request = + DeleteContactRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a contact. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   String name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString();
+   *   essentialContactsServiceClient.deleteContact(name);
+   * }
+   * }
+ * + * @param name Required. The name of the contact to delete. Format: + * organizations/{organization_id}/contacts/{contact_id}, + * folders/{folder_id}/contacts/{contact_id} or projects/{project_id}/contacts/{contact_id} + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteContact(String name) { + DeleteContactRequest request = DeleteContactRequest.newBuilder().setName(name).build(); + deleteContact(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a contact. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   DeleteContactRequest request =
+   *       DeleteContactRequest.newBuilder()
+   *           .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .build();
+   *   essentialContactsServiceClient.deleteContact(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 void deleteContact(DeleteContactRequest request) { + deleteContactCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Deletes a contact. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   DeleteContactRequest request =
+   *       DeleteContactRequest.newBuilder()
+   *           .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .build();
+   *   ApiFuture future =
+   *       essentialContactsServiceClient.deleteContactCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteContactCallable() { + return stub.deleteContactCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all contacts for the resource that are subscribed to the specified notification + * categories, including contacts inherited from any parent resources. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ComputeContactsRequest request =
+   *       ComputeContactsRequest.newBuilder()
+   *           .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .addAllNotificationCategories(new ArrayList())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   for (Contact element : essentialContactsServiceClient.computeContacts(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 ComputeContactsPagedResponse computeContacts(ComputeContactsRequest request) { + return computeContactsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all contacts for the resource that are subscribed to the specified notification + * categories, including contacts inherited from any parent resources. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ComputeContactsRequest request =
+   *       ComputeContactsRequest.newBuilder()
+   *           .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .addAllNotificationCategories(new ArrayList())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   ApiFuture future =
+   *       essentialContactsServiceClient.computeContactsPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Contact element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + computeContactsPagedCallable() { + return stub.computeContactsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists all contacts for the resource that are subscribed to the specified notification + * categories, including contacts inherited from any parent resources. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   ComputeContactsRequest request =
+   *       ComputeContactsRequest.newBuilder()
+   *           .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .addAllNotificationCategories(new ArrayList())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .build();
+   *   while (true) {
+   *     ComputeContactsResponse response =
+   *         essentialContactsServiceClient.computeContactsCallable().call(request);
+   *     for (Contact element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + computeContactsCallable() { + return stub.computeContactsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Allows a contact admin to send a test message to contact to verify that it has been configured + * correctly. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   SendTestMessageRequest request =
+   *       SendTestMessageRequest.newBuilder()
+   *           .addAllContacts(new ArrayList())
+   *           .setResource(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .setNotificationCategory(NotificationCategory.forNumber(0))
+   *           .build();
+   *   essentialContactsServiceClient.sendTestMessage(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 void sendTestMessage(SendTestMessageRequest request) { + sendTestMessageCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Allows a contact admin to send a test message to contact to verify that it has been configured + * correctly. + * + *

Sample code: + * + *

{@code
+   * try (EssentialContactsServiceClient essentialContactsServiceClient =
+   *     EssentialContactsServiceClient.create()) {
+   *   SendTestMessageRequest request =
+   *       SendTestMessageRequest.newBuilder()
+   *           .addAllContacts(new ArrayList())
+   *           .setResource(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString())
+   *           .setNotificationCategory(NotificationCategory.forNumber(0))
+   *           .build();
+   *   ApiFuture future =
+   *       essentialContactsServiceClient.sendTestMessageCallable().futureCall(request);
+   *   // Do something.
+   *   future.get();
+   * }
+   * }
+ */ + public final UnaryCallable sendTestMessageCallable() { + return stub.sendTestMessageCallable(); + } + + @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 ListContactsPagedResponse + extends AbstractPagedListResponse< + ListContactsRequest, + ListContactsResponse, + Contact, + ListContactsPage, + ListContactsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListContactsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListContactsPagedResponse apply(ListContactsPage input) { + return new ListContactsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListContactsPagedResponse(ListContactsPage page) { + super(page, ListContactsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListContactsPage + extends AbstractPage { + + private ListContactsPage( + PageContext context, + ListContactsResponse response) { + super(context, response); + } + + private static ListContactsPage createEmptyPage() { + return new ListContactsPage(null, null); + } + + @Override + protected ListContactsPage createPage( + PageContext context, + ListContactsResponse response) { + return new ListContactsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListContactsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListContactsRequest, + ListContactsResponse, + Contact, + ListContactsPage, + ListContactsFixedSizeCollection> { + + private ListContactsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListContactsFixedSizeCollection createEmptyCollection() { + return new ListContactsFixedSizeCollection(null, 0); + } + + @Override + protected ListContactsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListContactsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ComputeContactsPagedResponse + extends AbstractPagedListResponse< + ComputeContactsRequest, + ComputeContactsResponse, + Contact, + ComputeContactsPage, + ComputeContactsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ComputeContactsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ComputeContactsPagedResponse apply(ComputeContactsPage input) { + return new ComputeContactsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ComputeContactsPagedResponse(ComputeContactsPage page) { + super(page, ComputeContactsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ComputeContactsPage + extends AbstractPage< + ComputeContactsRequest, ComputeContactsResponse, Contact, ComputeContactsPage> { + + private ComputeContactsPage( + PageContext context, + ComputeContactsResponse response) { + super(context, response); + } + + private static ComputeContactsPage createEmptyPage() { + return new ComputeContactsPage(null, null); + } + + @Override + protected ComputeContactsPage createPage( + PageContext context, + ComputeContactsResponse response) { + return new ComputeContactsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ComputeContactsFixedSizeCollection + extends AbstractFixedSizeCollection< + ComputeContactsRequest, + ComputeContactsResponse, + Contact, + ComputeContactsPage, + ComputeContactsFixedSizeCollection> { + + private ComputeContactsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ComputeContactsFixedSizeCollection createEmptyCollection() { + return new ComputeContactsFixedSizeCollection(null, 0); + } + + @Override + protected ComputeContactsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ComputeContactsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceSettings.java b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceSettings.java new file mode 100644 index 00000000..6b3955b1 --- /dev/null +++ b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceSettings.java @@ -0,0 +1,258 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ComputeContactsPagedResponse; +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ListContactsPagedResponse; + +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.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.essentialcontacts.v1.stub.EssentialContactsServiceStubSettings; +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 EssentialContactsServiceClient}. + * + *

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

    + *
  • The default service address (essentialcontacts.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 createContact to 30 seconds: + * + *

{@code
+ * EssentialContactsServiceSettings.Builder essentialContactsServiceSettingsBuilder =
+ *     EssentialContactsServiceSettings.newBuilder();
+ * essentialContactsServiceSettingsBuilder
+ *     .createContactSettings()
+ *     .setRetrySettings(
+ *         essentialContactsServiceSettingsBuilder
+ *             .createContactSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * EssentialContactsServiceSettings essentialContactsServiceSettings =
+ *     essentialContactsServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class EssentialContactsServiceSettings + extends ClientSettings { + + /** Returns the object with the settings used for calls to createContact. */ + public UnaryCallSettings createContactSettings() { + return ((EssentialContactsServiceStubSettings) getStubSettings()).createContactSettings(); + } + + /** Returns the object with the settings used for calls to updateContact. */ + public UnaryCallSettings updateContactSettings() { + return ((EssentialContactsServiceStubSettings) getStubSettings()).updateContactSettings(); + } + + /** Returns the object with the settings used for calls to listContacts. */ + public PagedCallSettings + listContactsSettings() { + return ((EssentialContactsServiceStubSettings) getStubSettings()).listContactsSettings(); + } + + /** Returns the object with the settings used for calls to getContact. */ + public UnaryCallSettings getContactSettings() { + return ((EssentialContactsServiceStubSettings) getStubSettings()).getContactSettings(); + } + + /** Returns the object with the settings used for calls to deleteContact. */ + public UnaryCallSettings deleteContactSettings() { + return ((EssentialContactsServiceStubSettings) getStubSettings()).deleteContactSettings(); + } + + /** Returns the object with the settings used for calls to computeContacts. */ + public PagedCallSettings< + ComputeContactsRequest, ComputeContactsResponse, ComputeContactsPagedResponse> + computeContactsSettings() { + return ((EssentialContactsServiceStubSettings) getStubSettings()).computeContactsSettings(); + } + + /** Returns the object with the settings used for calls to sendTestMessage. */ + public UnaryCallSettings sendTestMessageSettings() { + return ((EssentialContactsServiceStubSettings) getStubSettings()).sendTestMessageSettings(); + } + + public static final EssentialContactsServiceSettings create( + EssentialContactsServiceStubSettings stub) throws IOException { + return new EssentialContactsServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return EssentialContactsServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return EssentialContactsServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return EssentialContactsServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return EssentialContactsServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return EssentialContactsServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return EssentialContactsServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return EssentialContactsServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** 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 EssentialContactsServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for EssentialContactsServiceSettings. */ + public static class Builder + extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(EssentialContactsServiceStubSettings.newBuilder(clientContext)); + } + + protected Builder(EssentialContactsServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(EssentialContactsServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(EssentialContactsServiceStubSettings.newBuilder()); + } + + public EssentialContactsServiceStubSettings.Builder getStubSettingsBuilder() { + return ((EssentialContactsServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * 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) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to createContact. */ + public UnaryCallSettings.Builder createContactSettings() { + return getStubSettingsBuilder().createContactSettings(); + } + + /** Returns the builder for the settings used for calls to updateContact. */ + public UnaryCallSettings.Builder updateContactSettings() { + return getStubSettingsBuilder().updateContactSettings(); + } + + /** Returns the builder for the settings used for calls to listContacts. */ + public PagedCallSettings.Builder< + ListContactsRequest, ListContactsResponse, ListContactsPagedResponse> + listContactsSettings() { + return getStubSettingsBuilder().listContactsSettings(); + } + + /** Returns the builder for the settings used for calls to getContact. */ + public UnaryCallSettings.Builder getContactSettings() { + return getStubSettingsBuilder().getContactSettings(); + } + + /** Returns the builder for the settings used for calls to deleteContact. */ + public UnaryCallSettings.Builder deleteContactSettings() { + return getStubSettingsBuilder().deleteContactSettings(); + } + + /** Returns the builder for the settings used for calls to computeContacts. */ + public PagedCallSettings.Builder< + ComputeContactsRequest, ComputeContactsResponse, ComputeContactsPagedResponse> + computeContactsSettings() { + return getStubSettingsBuilder().computeContactsSettings(); + } + + /** Returns the builder for the settings used for calls to sendTestMessage. */ + public UnaryCallSettings.Builder sendTestMessageSettings() { + return getStubSettingsBuilder().sendTestMessageSettings(); + } + + @Override + public EssentialContactsServiceSettings build() throws IOException { + return new EssentialContactsServiceSettings(this); + } + } +} diff --git a/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/gapic_metadata.json b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/gapic_metadata.json new file mode 100644 index 00000000..ca862a13 --- /dev/null +++ b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/gapic_metadata.json @@ -0,0 +1,39 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.cloud.essentialcontacts.v1", + "libraryPackage": "com.google.cloud.essentialcontacts.v1", + "services": { + "EssentialContactsService": { + "clients": { + "grpc": { + "libraryClient": "EssentialContactsServiceClient", + "rpcs": { + "ComputeContacts": { + "methods": ["computeContacts", "computeContactsPagedCallable", "computeContactsCallable"] + }, + "CreateContact": { + "methods": ["createContact", "createContact", "createContact", "createContact", "createContact", "createContactCallable"] + }, + "DeleteContact": { + "methods": ["deleteContact", "deleteContact", "deleteContact", "deleteContactCallable"] + }, + "GetContact": { + "methods": ["getContact", "getContact", "getContact", "getContactCallable"] + }, + "ListContacts": { + "methods": ["listContacts", "listContacts", "listContacts", "listContacts", "listContacts", "listContactsPagedCallable", "listContactsCallable"] + }, + "SendTestMessage": { + "methods": ["sendTestMessage", "sendTestMessageCallable"] + }, + "UpdateContact": { + "methods": ["updateContact", "updateContact", "updateContactCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/package-info.java b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/package-info.java new file mode 100644 index 00000000..224176a0 --- /dev/null +++ b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/package-info.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +/** + * The interfaces provided are listed below, along with usage samples. + * + *

======================= EssentialContactsServiceClient ======================= + * + *

Service Description: Manages contacts for important Google Cloud notifications. + * + *

Sample for EssentialContactsServiceClient: + * + *

{@code
+ * try (EssentialContactsServiceClient essentialContactsServiceClient =
+ *     EssentialContactsServiceClient.create()) {
+ *   FolderName parent = FolderName.of("[FOLDER]");
+ *   Contact contact = Contact.newBuilder().build();
+ *   Contact response = essentialContactsServiceClient.createContact(parent, contact);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.cloud.essentialcontacts.v1; + +import javax.annotation.Generated; diff --git a/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/EssentialContactsServiceStub.java b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/EssentialContactsServiceStub.java new file mode 100644 index 00000000..7abbd2ca --- /dev/null +++ b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/EssentialContactsServiceStub.java @@ -0,0 +1,85 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1.stub; + +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ComputeContactsPagedResponse; +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ListContactsPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.essentialcontacts.v1.ComputeContactsRequest; +import com.google.cloud.essentialcontacts.v1.ComputeContactsResponse; +import com.google.cloud.essentialcontacts.v1.Contact; +import com.google.cloud.essentialcontacts.v1.CreateContactRequest; +import com.google.cloud.essentialcontacts.v1.DeleteContactRequest; +import com.google.cloud.essentialcontacts.v1.GetContactRequest; +import com.google.cloud.essentialcontacts.v1.ListContactsRequest; +import com.google.cloud.essentialcontacts.v1.ListContactsResponse; +import com.google.cloud.essentialcontacts.v1.SendTestMessageRequest; +import com.google.cloud.essentialcontacts.v1.UpdateContactRequest; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the EssentialContactsService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class EssentialContactsServiceStub implements BackgroundResource { + + public UnaryCallable createContactCallable() { + throw new UnsupportedOperationException("Not implemented: createContactCallable()"); + } + + public UnaryCallable updateContactCallable() { + throw new UnsupportedOperationException("Not implemented: updateContactCallable()"); + } + + public UnaryCallable listContactsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listContactsPagedCallable()"); + } + + public UnaryCallable listContactsCallable() { + throw new UnsupportedOperationException("Not implemented: listContactsCallable()"); + } + + public UnaryCallable getContactCallable() { + throw new UnsupportedOperationException("Not implemented: getContactCallable()"); + } + + public UnaryCallable deleteContactCallable() { + throw new UnsupportedOperationException("Not implemented: deleteContactCallable()"); + } + + public UnaryCallable + computeContactsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: computeContactsPagedCallable()"); + } + + public UnaryCallable computeContactsCallable() { + throw new UnsupportedOperationException("Not implemented: computeContactsCallable()"); + } + + public UnaryCallable sendTestMessageCallable() { + throw new UnsupportedOperationException("Not implemented: sendTestMessageCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/EssentialContactsServiceStubSettings.java b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/EssentialContactsServiceStubSettings.java new file mode 100644 index 00000000..07785da9 --- /dev/null +++ b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/EssentialContactsServiceStubSettings.java @@ -0,0 +1,556 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1.stub; + +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ComputeContactsPagedResponse; +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ListContactsPagedResponse; + +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.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.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.cloud.essentialcontacts.v1.ComputeContactsRequest; +import com.google.cloud.essentialcontacts.v1.ComputeContactsResponse; +import com.google.cloud.essentialcontacts.v1.Contact; +import com.google.cloud.essentialcontacts.v1.CreateContactRequest; +import com.google.cloud.essentialcontacts.v1.DeleteContactRequest; +import com.google.cloud.essentialcontacts.v1.GetContactRequest; +import com.google.cloud.essentialcontacts.v1.ListContactsRequest; +import com.google.cloud.essentialcontacts.v1.ListContactsResponse; +import com.google.cloud.essentialcontacts.v1.SendTestMessageRequest; +import com.google.cloud.essentialcontacts.v1.UpdateContactRequest; +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.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 EssentialContactsServiceStub}. + * + *

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

    + *
  • The default service address (essentialcontacts.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 createContact to 30 seconds: + * + *

{@code
+ * EssentialContactsServiceStubSettings.Builder essentialContactsServiceSettingsBuilder =
+ *     EssentialContactsServiceStubSettings.newBuilder();
+ * essentialContactsServiceSettingsBuilder
+ *     .createContactSettings()
+ *     .setRetrySettings(
+ *         essentialContactsServiceSettingsBuilder
+ *             .createContactSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * EssentialContactsServiceStubSettings essentialContactsServiceSettings =
+ *     essentialContactsServiceSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class EssentialContactsServiceStubSettings + 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").build(); + + private final UnaryCallSettings createContactSettings; + private final UnaryCallSettings updateContactSettings; + private final PagedCallSettings< + ListContactsRequest, ListContactsResponse, ListContactsPagedResponse> + listContactsSettings; + private final UnaryCallSettings getContactSettings; + private final UnaryCallSettings deleteContactSettings; + private final PagedCallSettings< + ComputeContactsRequest, ComputeContactsResponse, ComputeContactsPagedResponse> + computeContactsSettings; + private final UnaryCallSettings sendTestMessageSettings; + + private static final PagedListDescriptor + LIST_CONTACTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListContactsRequest injectToken(ListContactsRequest payload, String token) { + return ListContactsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListContactsRequest injectPageSize(ListContactsRequest payload, int pageSize) { + return ListContactsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListContactsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListContactsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListContactsResponse payload) { + return payload.getContactsList() == null + ? ImmutableList.of() + : payload.getContactsList(); + } + }; + + private static final PagedListDescriptor + COMPUTE_CONTACTS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ComputeContactsRequest injectToken( + ComputeContactsRequest payload, String token) { + return ComputeContactsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ComputeContactsRequest injectPageSize( + ComputeContactsRequest payload, int pageSize) { + return ComputeContactsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ComputeContactsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ComputeContactsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ComputeContactsResponse payload) { + return payload.getContactsList() == null + ? ImmutableList.of() + : payload.getContactsList(); + } + }; + + private static final PagedListResponseFactory< + ListContactsRequest, ListContactsResponse, ListContactsPagedResponse> + LIST_CONTACTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListContactsRequest, ListContactsResponse, ListContactsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListContactsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_CONTACTS_PAGE_STR_DESC, request, context); + return ListContactsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ComputeContactsRequest, ComputeContactsResponse, ComputeContactsPagedResponse> + COMPUTE_CONTACTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ComputeContactsRequest, ComputeContactsResponse, ComputeContactsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ComputeContactsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, COMPUTE_CONTACTS_PAGE_STR_DESC, request, context); + return ComputeContactsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to createContact. */ + public UnaryCallSettings createContactSettings() { + return createContactSettings; + } + + /** Returns the object with the settings used for calls to updateContact. */ + public UnaryCallSettings updateContactSettings() { + return updateContactSettings; + } + + /** Returns the object with the settings used for calls to listContacts. */ + public PagedCallSettings + listContactsSettings() { + return listContactsSettings; + } + + /** Returns the object with the settings used for calls to getContact. */ + public UnaryCallSettings getContactSettings() { + return getContactSettings; + } + + /** Returns the object with the settings used for calls to deleteContact. */ + public UnaryCallSettings deleteContactSettings() { + return deleteContactSettings; + } + + /** Returns the object with the settings used for calls to computeContacts. */ + public PagedCallSettings< + ComputeContactsRequest, ComputeContactsResponse, ComputeContactsPagedResponse> + computeContactsSettings() { + return computeContactsSettings; + } + + /** Returns the object with the settings used for calls to sendTestMessage. */ + public UnaryCallSettings sendTestMessageSettings() { + return sendTestMessageSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public EssentialContactsServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcEssentialContactsServiceStub.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 "essentialcontacts.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); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + 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 defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(EssentialContactsServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** 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 EssentialContactsServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createContactSettings = settingsBuilder.createContactSettings().build(); + updateContactSettings = settingsBuilder.updateContactSettings().build(); + listContactsSettings = settingsBuilder.listContactsSettings().build(); + getContactSettings = settingsBuilder.getContactSettings().build(); + deleteContactSettings = settingsBuilder.deleteContactSettings().build(); + computeContactsSettings = settingsBuilder.computeContactsSettings().build(); + sendTestMessageSettings = settingsBuilder.sendTestMessageSettings().build(); + } + + /** Builder for EssentialContactsServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder createContactSettings; + private final UnaryCallSettings.Builder updateContactSettings; + private final PagedCallSettings.Builder< + ListContactsRequest, ListContactsResponse, ListContactsPagedResponse> + listContactsSettings; + private final UnaryCallSettings.Builder getContactSettings; + private final UnaryCallSettings.Builder deleteContactSettings; + private final PagedCallSettings.Builder< + ComputeContactsRequest, ComputeContactsResponse, ComputeContactsPagedResponse> + computeContactsSettings; + private final UnaryCallSettings.Builder sendTestMessageSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList())); + definitions.put( + "retry_policy_0_codes", + ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE))); + 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(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("no_retry_1_params", settings); + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(1000L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(10000L)) + .setInitialRpcTimeout(Duration.ofMillis(60000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(60000L)) + .setTotalTimeout(Duration.ofMillis(60000L)) + .build(); + definitions.put("retry_policy_0_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + createContactSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateContactSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listContactsSettings = PagedCallSettings.newBuilder(LIST_CONTACTS_PAGE_STR_FACT); + getContactSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteContactSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + computeContactsSettings = PagedCallSettings.newBuilder(COMPUTE_CONTACTS_PAGE_STR_FACT); + sendTestMessageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createContactSettings, + updateContactSettings, + listContactsSettings, + getContactSettings, + deleteContactSettings, + computeContactsSettings, + sendTestMessageSettings); + initDefaults(this); + } + + protected Builder(EssentialContactsServiceStubSettings settings) { + super(settings); + + createContactSettings = settings.createContactSettings.toBuilder(); + updateContactSettings = settings.updateContactSettings.toBuilder(); + listContactsSettings = settings.listContactsSettings.toBuilder(); + getContactSettings = settings.getContactSettings.toBuilder(); + deleteContactSettings = settings.deleteContactSettings.toBuilder(); + computeContactsSettings = settings.computeContactsSettings.toBuilder(); + sendTestMessageSettings = settings.sendTestMessageSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createContactSettings, + updateContactSettings, + listContactsSettings, + getContactSettings, + deleteContactSettings, + computeContactsSettings, + sendTestMessageSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .createContactSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .updateContactSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .listContactsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .getContactSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params")); + + builder + .deleteContactSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .computeContactsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + builder + .sendTestMessageSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params")); + + return builder; + } + + // NEXT_MAJOR_VER: remove 'throws Exception'. + /** + * 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) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to createContact. */ + public UnaryCallSettings.Builder createContactSettings() { + return createContactSettings; + } + + /** Returns the builder for the settings used for calls to updateContact. */ + public UnaryCallSettings.Builder updateContactSettings() { + return updateContactSettings; + } + + /** Returns the builder for the settings used for calls to listContacts. */ + public PagedCallSettings.Builder< + ListContactsRequest, ListContactsResponse, ListContactsPagedResponse> + listContactsSettings() { + return listContactsSettings; + } + + /** Returns the builder for the settings used for calls to getContact. */ + public UnaryCallSettings.Builder getContactSettings() { + return getContactSettings; + } + + /** Returns the builder for the settings used for calls to deleteContact. */ + public UnaryCallSettings.Builder deleteContactSettings() { + return deleteContactSettings; + } + + /** Returns the builder for the settings used for calls to computeContacts. */ + public PagedCallSettings.Builder< + ComputeContactsRequest, ComputeContactsResponse, ComputeContactsPagedResponse> + computeContactsSettings() { + return computeContactsSettings; + } + + /** Returns the builder for the settings used for calls to sendTestMessage. */ + public UnaryCallSettings.Builder sendTestMessageSettings() { + return sendTestMessageSettings; + } + + @Override + public EssentialContactsServiceStubSettings build() throws IOException { + return new EssentialContactsServiceStubSettings(this); + } + } +} diff --git a/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/GrpcEssentialContactsServiceCallableFactory.java b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/GrpcEssentialContactsServiceCallableFactory.java new file mode 100644 index 00000000..56fcb83d --- /dev/null +++ b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/GrpcEssentialContactsServiceCallableFactory.java @@ -0,0 +1,113 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1.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 EssentialContactsService service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcEssentialContactsServiceCallableFactory implements GrpcStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + GrpcCallSettings grpcCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + GrpcCallSettings grpcCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, callSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings callSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, callSettings, clientContext); + } +} diff --git a/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/GrpcEssentialContactsServiceStub.java b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/GrpcEssentialContactsServiceStub.java new file mode 100644 index 00000000..5e92169b --- /dev/null +++ b/google-cloud-essential-contacts/src/main/java/com/google/cloud/essentialcontacts/v1/stub/GrpcEssentialContactsServiceStub.java @@ -0,0 +1,393 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1.stub; + +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ComputeContactsPagedResponse; +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ListContactsPagedResponse; + +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.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.essentialcontacts.v1.ComputeContactsRequest; +import com.google.cloud.essentialcontacts.v1.ComputeContactsResponse; +import com.google.cloud.essentialcontacts.v1.Contact; +import com.google.cloud.essentialcontacts.v1.CreateContactRequest; +import com.google.cloud.essentialcontacts.v1.DeleteContactRequest; +import com.google.cloud.essentialcontacts.v1.GetContactRequest; +import com.google.cloud.essentialcontacts.v1.ListContactsRequest; +import com.google.cloud.essentialcontacts.v1.ListContactsResponse; +import com.google.cloud.essentialcontacts.v1.SendTestMessageRequest; +import com.google.cloud.essentialcontacts.v1.UpdateContactRequest; +import com.google.common.collect.ImmutableMap; +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.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * gRPC stub implementation for the EssentialContactsService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcEssentialContactsServiceStub extends EssentialContactsServiceStub { + private static final MethodDescriptor + createContactMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.essentialcontacts.v1.EssentialContactsService/CreateContact") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateContactRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Contact.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateContactMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.essentialcontacts.v1.EssentialContactsService/UpdateContact") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateContactRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Contact.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listContactsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.essentialcontacts.v1.EssentialContactsService/ListContacts") + .setRequestMarshaller(ProtoUtils.marshaller(ListContactsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListContactsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor getContactMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.essentialcontacts.v1.EssentialContactsService/GetContact") + .setRequestMarshaller(ProtoUtils.marshaller(GetContactRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Contact.getDefaultInstance())) + .build(); + + private static final MethodDescriptor deleteContactMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.essentialcontacts.v1.EssentialContactsService/DeleteContact") + .setRequestMarshaller(ProtoUtils.marshaller(DeleteContactRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + computeContactsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.essentialcontacts.v1.EssentialContactsService/ComputeContacts") + .setRequestMarshaller( + ProtoUtils.marshaller(ComputeContactsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ComputeContactsResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + sendTestMessageMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.cloud.essentialcontacts.v1.EssentialContactsService/SendTestMessage") + .setRequestMarshaller( + ProtoUtils.marshaller(SendTestMessageRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private final UnaryCallable createContactCallable; + private final UnaryCallable updateContactCallable; + private final UnaryCallable listContactsCallable; + private final UnaryCallable + listContactsPagedCallable; + private final UnaryCallable getContactCallable; + private final UnaryCallable deleteContactCallable; + private final UnaryCallable + computeContactsCallable; + private final UnaryCallable + computeContactsPagedCallable; + private final UnaryCallable sendTestMessageCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcEssentialContactsServiceStub create( + EssentialContactsServiceStubSettings settings) throws IOException { + return new GrpcEssentialContactsServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcEssentialContactsServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcEssentialContactsServiceStub( + EssentialContactsServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcEssentialContactsServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcEssentialContactsServiceStub( + EssentialContactsServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcEssentialContactsServiceStub, 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 GrpcEssentialContactsServiceStub( + EssentialContactsServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcEssentialContactsServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcEssentialContactsServiceStub, 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 GrpcEssentialContactsServiceStub( + EssentialContactsServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings createContactTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createContactMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateContactRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateContactTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateContactMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateContactRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("contact.name", String.valueOf(request.getContact().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings listContactsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listContactsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListContactsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getContactTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getContactMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetContactRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteContactTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteContactMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteContactRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + computeContactsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(computeContactsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ComputeContactsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings sendTestMessageTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(sendTestMessageMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(SendTestMessageRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + + this.createContactCallable = + callableFactory.createUnaryCallable( + createContactTransportSettings, settings.createContactSettings(), clientContext); + this.updateContactCallable = + callableFactory.createUnaryCallable( + updateContactTransportSettings, settings.updateContactSettings(), clientContext); + this.listContactsCallable = + callableFactory.createUnaryCallable( + listContactsTransportSettings, settings.listContactsSettings(), clientContext); + this.listContactsPagedCallable = + callableFactory.createPagedCallable( + listContactsTransportSettings, settings.listContactsSettings(), clientContext); + this.getContactCallable = + callableFactory.createUnaryCallable( + getContactTransportSettings, settings.getContactSettings(), clientContext); + this.deleteContactCallable = + callableFactory.createUnaryCallable( + deleteContactTransportSettings, settings.deleteContactSettings(), clientContext); + this.computeContactsCallable = + callableFactory.createUnaryCallable( + computeContactsTransportSettings, settings.computeContactsSettings(), clientContext); + this.computeContactsPagedCallable = + callableFactory.createPagedCallable( + computeContactsTransportSettings, settings.computeContactsSettings(), clientContext); + this.sendTestMessageCallable = + callableFactory.createUnaryCallable( + sendTestMessageTransportSettings, settings.sendTestMessageSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable createContactCallable() { + return createContactCallable; + } + + @Override + public UnaryCallable updateContactCallable() { + return updateContactCallable; + } + + @Override + public UnaryCallable listContactsCallable() { + return listContactsCallable; + } + + @Override + public UnaryCallable listContactsPagedCallable() { + return listContactsPagedCallable; + } + + @Override + public UnaryCallable getContactCallable() { + return getContactCallable; + } + + @Override + public UnaryCallable deleteContactCallable() { + return deleteContactCallable; + } + + @Override + public UnaryCallable computeContactsCallable() { + return computeContactsCallable; + } + + @Override + public UnaryCallable + computeContactsPagedCallable() { + return computeContactsPagedCallable; + } + + @Override + public UnaryCallable sendTestMessageCallable() { + return sendTestMessageCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceClientTest.java b/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceClientTest.java new file mode 100644 index 00000000..cbfc898d --- /dev/null +++ b/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceClientTest.java @@ -0,0 +1,752 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ComputeContactsPagedResponse; +import static com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClient.ListContactsPagedResponse; + +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.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +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 EssentialContactsServiceClientTest { + private static MockServiceHelper mockServiceHelper; + private EssentialContactsServiceClient client; + private static MockEssentialContactsService mockEssentialContactsService; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockEssentialContactsService = new MockEssentialContactsService(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockEssentialContactsService)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + EssentialContactsServiceSettings settings = + EssentialContactsServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = EssentialContactsServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void createContactTest() throws Exception { + Contact expectedResponse = + Contact.newBuilder() + .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setEmail("email96619420") + .addAllNotificationCategorySubscriptions(new ArrayList()) + .setLanguageTag("languageTag-1175857886") + .setValidationState(ValidationState.forNumber(0)) + .setValidateTime(Timestamp.newBuilder().build()) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + FolderName parent = FolderName.of("[FOLDER]"); + Contact contact = Contact.newBuilder().build(); + + Contact actualResponse = client.createContact(parent, contact); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateContactRequest actualRequest = ((CreateContactRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(contact, actualRequest.getContact()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createContactExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + FolderName parent = FolderName.of("[FOLDER]"); + Contact contact = Contact.newBuilder().build(); + client.createContact(parent, contact); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createContactTest2() throws Exception { + Contact expectedResponse = + Contact.newBuilder() + .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setEmail("email96619420") + .addAllNotificationCategorySubscriptions(new ArrayList()) + .setLanguageTag("languageTag-1175857886") + .setValidationState(ValidationState.forNumber(0)) + .setValidateTime(Timestamp.newBuilder().build()) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + Contact contact = Contact.newBuilder().build(); + + Contact actualResponse = client.createContact(parent, contact); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateContactRequest actualRequest = ((CreateContactRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(contact, actualRequest.getContact()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createContactExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + Contact contact = Contact.newBuilder().build(); + client.createContact(parent, contact); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createContactTest3() throws Exception { + Contact expectedResponse = + Contact.newBuilder() + .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setEmail("email96619420") + .addAllNotificationCategorySubscriptions(new ArrayList()) + .setLanguageTag("languageTag-1175857886") + .setValidationState(ValidationState.forNumber(0)) + .setValidateTime(Timestamp.newBuilder().build()) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + Contact contact = Contact.newBuilder().build(); + + Contact actualResponse = client.createContact(parent, contact); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateContactRequest actualRequest = ((CreateContactRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(contact, actualRequest.getContact()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createContactExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + Contact contact = Contact.newBuilder().build(); + client.createContact(parent, contact); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createContactTest4() throws Exception { + Contact expectedResponse = + Contact.newBuilder() + .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setEmail("email96619420") + .addAllNotificationCategorySubscriptions(new ArrayList()) + .setLanguageTag("languageTag-1175857886") + .setValidationState(ValidationState.forNumber(0)) + .setValidateTime(Timestamp.newBuilder().build()) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + Contact contact = Contact.newBuilder().build(); + + Contact actualResponse = client.createContact(parent, contact); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateContactRequest actualRequest = ((CreateContactRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(contact, actualRequest.getContact()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createContactExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + String parent = "parent-995424086"; + Contact contact = Contact.newBuilder().build(); + client.createContact(parent, contact); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateContactTest() throws Exception { + Contact expectedResponse = + Contact.newBuilder() + .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setEmail("email96619420") + .addAllNotificationCategorySubscriptions(new ArrayList()) + .setLanguageTag("languageTag-1175857886") + .setValidationState(ValidationState.forNumber(0)) + .setValidateTime(Timestamp.newBuilder().build()) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + Contact contact = Contact.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Contact actualResponse = client.updateContact(contact, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateContactRequest actualRequest = ((UpdateContactRequest) actualRequests.get(0)); + + Assert.assertEquals(contact, actualRequest.getContact()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateContactExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + Contact contact = Contact.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateContact(contact, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listContactsTest() throws Exception { + Contact responsesElement = Contact.newBuilder().build(); + ListContactsResponse expectedResponse = + ListContactsResponse.newBuilder() + .setNextPageToken("") + .addAllContacts(Arrays.asList(responsesElement)) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + FolderName parent = FolderName.of("[FOLDER]"); + + ListContactsPagedResponse pagedListResponse = client.listContacts(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getContactsList().get(0), resources.get(0)); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListContactsRequest actualRequest = ((ListContactsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listContactsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + FolderName parent = FolderName.of("[FOLDER]"); + client.listContacts(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listContactsTest2() throws Exception { + Contact responsesElement = Contact.newBuilder().build(); + ListContactsResponse expectedResponse = + ListContactsResponse.newBuilder() + .setNextPageToken("") + .addAllContacts(Arrays.asList(responsesElement)) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + + ListContactsPagedResponse pagedListResponse = client.listContacts(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getContactsList().get(0), resources.get(0)); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListContactsRequest actualRequest = ((ListContactsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listContactsExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + OrganizationName parent = OrganizationName.of("[ORGANIZATION]"); + client.listContacts(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listContactsTest3() throws Exception { + Contact responsesElement = Contact.newBuilder().build(); + ListContactsResponse expectedResponse = + ListContactsResponse.newBuilder() + .setNextPageToken("") + .addAllContacts(Arrays.asList(responsesElement)) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + ProjectName parent = ProjectName.of("[PROJECT]"); + + ListContactsPagedResponse pagedListResponse = client.listContacts(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getContactsList().get(0), resources.get(0)); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListContactsRequest actualRequest = ((ListContactsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listContactsExceptionTest3() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + ProjectName parent = ProjectName.of("[PROJECT]"); + client.listContacts(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listContactsTest4() throws Exception { + Contact responsesElement = Contact.newBuilder().build(); + ListContactsResponse expectedResponse = + ListContactsResponse.newBuilder() + .setNextPageToken("") + .addAllContacts(Arrays.asList(responsesElement)) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListContactsPagedResponse pagedListResponse = client.listContacts(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getContactsList().get(0), resources.get(0)); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListContactsRequest actualRequest = ((ListContactsRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listContactsExceptionTest4() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + String parent = "parent-995424086"; + client.listContacts(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getContactTest() throws Exception { + Contact expectedResponse = + Contact.newBuilder() + .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setEmail("email96619420") + .addAllNotificationCategorySubscriptions(new ArrayList()) + .setLanguageTag("languageTag-1175857886") + .setValidationState(ValidationState.forNumber(0)) + .setValidateTime(Timestamp.newBuilder().build()) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + ContactName name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]"); + + Contact actualResponse = client.getContact(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetContactRequest actualRequest = ((GetContactRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getContactExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + ContactName name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]"); + client.getContact(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getContactTest2() throws Exception { + Contact expectedResponse = + Contact.newBuilder() + .setName(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setEmail("email96619420") + .addAllNotificationCategorySubscriptions(new ArrayList()) + .setLanguageTag("languageTag-1175857886") + .setValidationState(ValidationState.forNumber(0)) + .setValidateTime(Timestamp.newBuilder().build()) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + String name = "name3373707"; + + Contact actualResponse = client.getContact(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetContactRequest actualRequest = ((GetContactRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getContactExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + String name = "name3373707"; + client.getContact(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteContactTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockEssentialContactsService.addResponse(expectedResponse); + + ContactName name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]"); + + client.deleteContact(name); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteContactRequest actualRequest = ((DeleteContactRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteContactExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + ContactName name = ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]"); + client.deleteContact(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteContactTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockEssentialContactsService.addResponse(expectedResponse); + + String name = "name3373707"; + + client.deleteContact(name); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteContactRequest actualRequest = ((DeleteContactRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteContactExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + String name = "name3373707"; + client.deleteContact(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void computeContactsTest() throws Exception { + Contact responsesElement = Contact.newBuilder().build(); + ComputeContactsResponse expectedResponse = + ComputeContactsResponse.newBuilder() + .setNextPageToken("") + .addAllContacts(Arrays.asList(responsesElement)) + .build(); + mockEssentialContactsService.addResponse(expectedResponse); + + ComputeContactsRequest request = + ComputeContactsRequest.newBuilder() + .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .addAllNotificationCategories(new ArrayList()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ComputeContactsPagedResponse pagedListResponse = client.computeContacts(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getContactsList().get(0), resources.get(0)); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ComputeContactsRequest actualRequest = ((ComputeContactsRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getParent(), actualRequest.getParent()); + Assert.assertEquals( + request.getNotificationCategoriesList(), actualRequest.getNotificationCategoriesList()); + Assert.assertEquals(request.getPageSize(), actualRequest.getPageSize()); + Assert.assertEquals(request.getPageToken(), actualRequest.getPageToken()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void computeContactsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + ComputeContactsRequest request = + ComputeContactsRequest.newBuilder() + .setParent(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .addAllNotificationCategories(new ArrayList()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.computeContacts(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void sendTestMessageTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockEssentialContactsService.addResponse(expectedResponse); + + SendTestMessageRequest request = + SendTestMessageRequest.newBuilder() + .addAllContacts(new ArrayList()) + .setResource(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setNotificationCategory(NotificationCategory.forNumber(0)) + .build(); + + client.sendTestMessage(request); + + List actualRequests = mockEssentialContactsService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SendTestMessageRequest actualRequest = ((SendTestMessageRequest) actualRequests.get(0)); + + Assert.assertEquals(request.getContactsList(), actualRequest.getContactsList()); + Assert.assertEquals(request.getResource(), actualRequest.getResource()); + Assert.assertEquals(request.getNotificationCategory(), actualRequest.getNotificationCategory()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void sendTestMessageExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEssentialContactsService.addException(exception); + + try { + SendTestMessageRequest request = + SendTestMessageRequest.newBuilder() + .addAllContacts(new ArrayList()) + .setResource(ContactName.ofProjectContactName("[PROJECT]", "[CONTACT]").toString()) + .setNotificationCategory(NotificationCategory.forNumber(0)) + .build(); + client.sendTestMessage(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/MockEssentialContactsService.java b/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/MockEssentialContactsService.java new file mode 100644 index 00000000..417917f8 --- /dev/null +++ b/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/MockEssentialContactsService.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +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 MockEssentialContactsService implements MockGrpcService { + private final MockEssentialContactsServiceImpl serviceImpl; + + public MockEssentialContactsService() { + serviceImpl = new MockEssentialContactsServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/MockEssentialContactsServiceImpl.java b/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/MockEssentialContactsServiceImpl.java new file mode 100644 index 00000000..5687f8f1 --- /dev/null +++ b/google-cloud-essential-contacts/src/test/java/com/google/cloud/essentialcontacts/v1/MockEssentialContactsServiceImpl.java @@ -0,0 +1,206 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.essentialcontacts.v1.EssentialContactsServiceGrpc.EssentialContactsServiceImplBase; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +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 MockEssentialContactsServiceImpl extends EssentialContactsServiceImplBase { + private List requests; + private Queue responses; + + public MockEssentialContactsServiceImpl() { + 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 createContact( + CreateContactRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Contact) { + requests.add(request); + responseObserver.onNext(((Contact) 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 CreateContact, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Contact.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateContact( + UpdateContactRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Contact) { + requests.add(request); + responseObserver.onNext(((Contact) 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 UpdateContact, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Contact.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listContacts( + ListContactsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListContactsResponse) { + requests.add(request); + responseObserver.onNext(((ListContactsResponse) 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 ListContacts, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListContactsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getContact(GetContactRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Contact) { + requests.add(request); + responseObserver.onNext(((Contact) 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 GetContact, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Contact.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteContact(DeleteContactRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) 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 DeleteContact, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void computeContacts( + ComputeContactsRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ComputeContactsResponse) { + requests.add(request); + responseObserver.onNext(((ComputeContactsResponse) 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 ComputeContacts, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ComputeContactsResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void sendTestMessage( + SendTestMessageRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Empty) { + requests.add(request); + responseObserver.onNext(((Empty) 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 SendTestMessage, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Empty.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/grpc-google-cloud-essential-contacts-v1/pom.xml b/grpc-google-cloud-essential-contacts-v1/pom.xml new file mode 100644 index 00000000..705b0d00 --- /dev/null +++ b/grpc-google-cloud-essential-contacts-v1/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-essential-contacts-v1 + 0.0.1-SNAPSHOT + grpc-google-cloud-essential-contacts-v1 + GRPC library for google-cloud-essential-contacts + + com.google.cloud + google-cloud-essential-contacts-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-essential-contacts-v1 + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + \ No newline at end of file diff --git a/grpc-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceGrpc.java b/grpc-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceGrpc.java new file mode 100644 index 00000000..455f821e --- /dev/null +++ b/grpc-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/EssentialContactsServiceGrpc.java @@ -0,0 +1,1092 @@ +/* + * 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.cloud.essentialcontacts.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Manages contacts for important Google Cloud notifications.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/essentialcontacts/v1/service.proto") +public final class EssentialContactsServiceGrpc { + + private EssentialContactsServiceGrpc() {} + + public static final String SERVICE_NAME = + "google.cloud.essentialcontacts.v1.EssentialContactsService"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.CreateContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getCreateContactMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateContact", + requestType = com.google.cloud.essentialcontacts.v1.CreateContactRequest.class, + responseType = com.google.cloud.essentialcontacts.v1.Contact.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.CreateContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getCreateContactMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.CreateContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getCreateContactMethod; + if ((getCreateContactMethod = EssentialContactsServiceGrpc.getCreateContactMethod) == null) { + synchronized (EssentialContactsServiceGrpc.class) { + if ((getCreateContactMethod = EssentialContactsServiceGrpc.getCreateContactMethod) + == null) { + EssentialContactsServiceGrpc.getCreateContactMethod = + getCreateContactMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateContact")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.CreateContactRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance())) + .setSchemaDescriptor( + new EssentialContactsServiceMethodDescriptorSupplier("CreateContact")) + .build(); + } + } + } + return getCreateContactMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.UpdateContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getUpdateContactMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateContact", + requestType = com.google.cloud.essentialcontacts.v1.UpdateContactRequest.class, + responseType = com.google.cloud.essentialcontacts.v1.Contact.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.UpdateContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getUpdateContactMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.UpdateContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getUpdateContactMethod; + if ((getUpdateContactMethod = EssentialContactsServiceGrpc.getUpdateContactMethod) == null) { + synchronized (EssentialContactsServiceGrpc.class) { + if ((getUpdateContactMethod = EssentialContactsServiceGrpc.getUpdateContactMethod) + == null) { + EssentialContactsServiceGrpc.getUpdateContactMethod = + getUpdateContactMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateContact")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.UpdateContactRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance())) + .setSchemaDescriptor( + new EssentialContactsServiceMethodDescriptorSupplier("UpdateContact")) + .build(); + } + } + } + return getUpdateContactMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.ListContactsRequest, + com.google.cloud.essentialcontacts.v1.ListContactsResponse> + getListContactsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListContacts", + requestType = com.google.cloud.essentialcontacts.v1.ListContactsRequest.class, + responseType = com.google.cloud.essentialcontacts.v1.ListContactsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.ListContactsRequest, + com.google.cloud.essentialcontacts.v1.ListContactsResponse> + getListContactsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.ListContactsRequest, + com.google.cloud.essentialcontacts.v1.ListContactsResponse> + getListContactsMethod; + if ((getListContactsMethod = EssentialContactsServiceGrpc.getListContactsMethod) == null) { + synchronized (EssentialContactsServiceGrpc.class) { + if ((getListContactsMethod = EssentialContactsServiceGrpc.getListContactsMethod) == null) { + EssentialContactsServiceGrpc.getListContactsMethod = + getListContactsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListContacts")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.ListContactsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.ListContactsResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new EssentialContactsServiceMethodDescriptorSupplier("ListContacts")) + .build(); + } + } + } + return getListContactsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.GetContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getGetContactMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetContact", + requestType = com.google.cloud.essentialcontacts.v1.GetContactRequest.class, + responseType = com.google.cloud.essentialcontacts.v1.Contact.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.GetContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getGetContactMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.GetContactRequest, + com.google.cloud.essentialcontacts.v1.Contact> + getGetContactMethod; + if ((getGetContactMethod = EssentialContactsServiceGrpc.getGetContactMethod) == null) { + synchronized (EssentialContactsServiceGrpc.class) { + if ((getGetContactMethod = EssentialContactsServiceGrpc.getGetContactMethod) == null) { + EssentialContactsServiceGrpc.getGetContactMethod = + getGetContactMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetContact")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.GetContactRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance())) + .setSchemaDescriptor( + new EssentialContactsServiceMethodDescriptorSupplier("GetContact")) + .build(); + } + } + } + return getGetContactMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.DeleteContactRequest, com.google.protobuf.Empty> + getDeleteContactMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteContact", + requestType = com.google.cloud.essentialcontacts.v1.DeleteContactRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.DeleteContactRequest, com.google.protobuf.Empty> + getDeleteContactMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.DeleteContactRequest, com.google.protobuf.Empty> + getDeleteContactMethod; + if ((getDeleteContactMethod = EssentialContactsServiceGrpc.getDeleteContactMethod) == null) { + synchronized (EssentialContactsServiceGrpc.class) { + if ((getDeleteContactMethod = EssentialContactsServiceGrpc.getDeleteContactMethod) + == null) { + EssentialContactsServiceGrpc.getDeleteContactMethod = + getDeleteContactMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteContact")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.DeleteContactRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new EssentialContactsServiceMethodDescriptorSupplier("DeleteContact")) + .build(); + } + } + } + return getDeleteContactMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest, + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse> + getComputeContactsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ComputeContacts", + requestType = com.google.cloud.essentialcontacts.v1.ComputeContactsRequest.class, + responseType = com.google.cloud.essentialcontacts.v1.ComputeContactsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest, + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse> + getComputeContactsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest, + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse> + getComputeContactsMethod; + if ((getComputeContactsMethod = EssentialContactsServiceGrpc.getComputeContactsMethod) + == null) { + synchronized (EssentialContactsServiceGrpc.class) { + if ((getComputeContactsMethod = EssentialContactsServiceGrpc.getComputeContactsMethod) + == null) { + EssentialContactsServiceGrpc.getComputeContactsMethod = + getComputeContactsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ComputeContacts")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new EssentialContactsServiceMethodDescriptorSupplier("ComputeContacts")) + .build(); + } + } + } + return getComputeContactsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest, com.google.protobuf.Empty> + getSendTestMessageMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SendTestMessage", + requestType = com.google.cloud.essentialcontacts.v1.SendTestMessageRequest.class, + responseType = com.google.protobuf.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest, com.google.protobuf.Empty> + getSendTestMessageMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest, com.google.protobuf.Empty> + getSendTestMessageMethod; + if ((getSendTestMessageMethod = EssentialContactsServiceGrpc.getSendTestMessageMethod) + == null) { + synchronized (EssentialContactsServiceGrpc.class) { + if ((getSendTestMessageMethod = EssentialContactsServiceGrpc.getSendTestMessageMethod) + == null) { + EssentialContactsServiceGrpc.getSendTestMessageMethod = + getSendTestMessageMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendTestMessage")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new EssentialContactsServiceMethodDescriptorSupplier("SendTestMessage")) + .build(); + } + } + } + return getSendTestMessageMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static EssentialContactsServiceStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EssentialContactsServiceStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EssentialContactsServiceStub(channel, callOptions); + } + }; + return EssentialContactsServiceStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static EssentialContactsServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EssentialContactsServiceBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EssentialContactsServiceBlockingStub(channel, callOptions); + } + }; + return EssentialContactsServiceBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static EssentialContactsServiceFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EssentialContactsServiceFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EssentialContactsServiceFutureStub(channel, callOptions); + } + }; + return EssentialContactsServiceFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Manages contacts for important Google Cloud notifications.
+   * 
+ */ + public abstract static class EssentialContactsServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Adds a new contact for a resource.
+     * 
+ */ + public void createContact( + com.google.cloud.essentialcontacts.v1.CreateContactRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateContactMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates a contact.
+     * Note: A contact's email address cannot be changed.
+     * 
+ */ + public void updateContact( + com.google.cloud.essentialcontacts.v1.UpdateContactRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateContactMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists the contacts that have been set on a resource.
+     * 
+ */ + public void listContacts( + com.google.cloud.essentialcontacts.v1.ListContactsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListContactsMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets a single contact.
+     * 
+ */ + public void getContact( + com.google.cloud.essentialcontacts.v1.GetContactRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetContactMethod(), responseObserver); + } + + /** + * + * + *
+     * Deletes a contact.
+     * 
+ */ + public void deleteContact( + com.google.cloud.essentialcontacts.v1.DeleteContactRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteContactMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists all contacts for the resource that are subscribed to the
+     * specified notification categories, including contacts inherited from
+     * any parent resources.
+     * 
+ */ + public void computeContacts( + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getComputeContactsMethod(), responseObserver); + } + + /** + * + * + *
+     * Allows a contact admin to send a test message to contact to verify that it
+     * has been configured correctly.
+     * 
+ */ + public void sendTestMessage( + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getSendTestMessageMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateContactMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.essentialcontacts.v1.CreateContactRequest, + com.google.cloud.essentialcontacts.v1.Contact>( + this, METHODID_CREATE_CONTACT))) + .addMethod( + getUpdateContactMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.essentialcontacts.v1.UpdateContactRequest, + com.google.cloud.essentialcontacts.v1.Contact>( + this, METHODID_UPDATE_CONTACT))) + .addMethod( + getListContactsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.essentialcontacts.v1.ListContactsRequest, + com.google.cloud.essentialcontacts.v1.ListContactsResponse>( + this, METHODID_LIST_CONTACTS))) + .addMethod( + getGetContactMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.essentialcontacts.v1.GetContactRequest, + com.google.cloud.essentialcontacts.v1.Contact>(this, METHODID_GET_CONTACT))) + .addMethod( + getDeleteContactMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.essentialcontacts.v1.DeleteContactRequest, + com.google.protobuf.Empty>(this, METHODID_DELETE_CONTACT))) + .addMethod( + getComputeContactsMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest, + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse>( + this, METHODID_COMPUTE_CONTACTS))) + .addMethod( + getSendTestMessageMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest, + com.google.protobuf.Empty>(this, METHODID_SEND_TEST_MESSAGE))) + .build(); + } + } + + /** + * + * + *
+   * Manages contacts for important Google Cloud notifications.
+   * 
+ */ + public static final class EssentialContactsServiceStub + extends io.grpc.stub.AbstractAsyncStub { + private EssentialContactsServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EssentialContactsServiceStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EssentialContactsServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Adds a new contact for a resource.
+     * 
+ */ + public void createContact( + com.google.cloud.essentialcontacts.v1.CreateContactRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateContactMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates a contact.
+     * Note: A contact's email address cannot be changed.
+     * 
+ */ + public void updateContact( + com.google.cloud.essentialcontacts.v1.UpdateContactRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateContactMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists the contacts that have been set on a resource.
+     * 
+ */ + public void listContacts( + com.google.cloud.essentialcontacts.v1.ListContactsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListContactsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets a single contact.
+     * 
+ */ + public void getContact( + com.google.cloud.essentialcontacts.v1.GetContactRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetContactMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * Deletes a contact.
+     * 
+ */ + public void deleteContact( + com.google.cloud.essentialcontacts.v1.DeleteContactRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteContactMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists all contacts for the resource that are subscribed to the
+     * specified notification categories, including contacts inherited from
+     * any parent resources.
+     * 
+ */ + public void computeContacts( + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getComputeContactsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Allows a contact admin to send a test message to contact to verify that it
+     * has been configured correctly.
+     * 
+ */ + public void sendTestMessage( + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getSendTestMessageMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Manages contacts for important Google Cloud notifications.
+   * 
+ */ + public static final class EssentialContactsServiceBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private EssentialContactsServiceBlockingStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EssentialContactsServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EssentialContactsServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Adds a new contact for a resource.
+     * 
+ */ + public com.google.cloud.essentialcontacts.v1.Contact createContact( + com.google.cloud.essentialcontacts.v1.CreateContactRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateContactMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates a contact.
+     * Note: A contact's email address cannot be changed.
+     * 
+ */ + public com.google.cloud.essentialcontacts.v1.Contact updateContact( + com.google.cloud.essentialcontacts.v1.UpdateContactRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateContactMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists the contacts that have been set on a resource.
+     * 
+ */ + public com.google.cloud.essentialcontacts.v1.ListContactsResponse listContacts( + com.google.cloud.essentialcontacts.v1.ListContactsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListContactsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets a single contact.
+     * 
+ */ + public com.google.cloud.essentialcontacts.v1.Contact getContact( + com.google.cloud.essentialcontacts.v1.GetContactRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetContactMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a contact.
+     * 
+ */ + public com.google.protobuf.Empty deleteContact( + com.google.cloud.essentialcontacts.v1.DeleteContactRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteContactMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists all contacts for the resource that are subscribed to the
+     * specified notification categories, including contacts inherited from
+     * any parent resources.
+     * 
+ */ + public com.google.cloud.essentialcontacts.v1.ComputeContactsResponse computeContacts( + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getComputeContactsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Allows a contact admin to send a test message to contact to verify that it
+     * has been configured correctly.
+     * 
+ */ + public com.google.protobuf.Empty sendTestMessage( + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getSendTestMessageMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Manages contacts for important Google Cloud notifications.
+   * 
+ */ + public static final class EssentialContactsServiceFutureStub + extends io.grpc.stub.AbstractFutureStub { + private EssentialContactsServiceFutureStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EssentialContactsServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EssentialContactsServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Adds a new contact for a resource.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.essentialcontacts.v1.Contact> + createContact(com.google.cloud.essentialcontacts.v1.CreateContactRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateContactMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates a contact.
+     * Note: A contact's email address cannot be changed.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.essentialcontacts.v1.Contact> + updateContact(com.google.cloud.essentialcontacts.v1.UpdateContactRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateContactMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists the contacts that have been set on a resource.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.essentialcontacts.v1.ListContactsResponse> + listContacts(com.google.cloud.essentialcontacts.v1.ListContactsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListContactsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets a single contact.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.essentialcontacts.v1.Contact> + getContact(com.google.cloud.essentialcontacts.v1.GetContactRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetContactMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a contact.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteContact(com.google.cloud.essentialcontacts.v1.DeleteContactRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteContactMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists all contacts for the resource that are subscribed to the
+     * specified notification categories, including contacts inherited from
+     * any parent resources.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse> + computeContacts(com.google.cloud.essentialcontacts.v1.ComputeContactsRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getComputeContactsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Allows a contact admin to send a test message to contact to verify that it
+     * has been configured correctly.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + sendTestMessage(com.google.cloud.essentialcontacts.v1.SendTestMessageRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getSendTestMessageMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_CONTACT = 0; + private static final int METHODID_UPDATE_CONTACT = 1; + private static final int METHODID_LIST_CONTACTS = 2; + private static final int METHODID_GET_CONTACT = 3; + private static final int METHODID_DELETE_CONTACT = 4; + private static final int METHODID_COMPUTE_CONTACTS = 5; + private static final int METHODID_SEND_TEST_MESSAGE = 6; + + 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 EssentialContactsServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(EssentialContactsServiceImplBase 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_CONTACT: + serviceImpl.createContact( + (com.google.cloud.essentialcontacts.v1.CreateContactRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_CONTACT: + serviceImpl.updateContact( + (com.google.cloud.essentialcontacts.v1.UpdateContactRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_CONTACTS: + serviceImpl.listContacts( + (com.google.cloud.essentialcontacts.v1.ListContactsRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.essentialcontacts.v1.ListContactsResponse>) + responseObserver); + break; + case METHODID_GET_CONTACT: + serviceImpl.getContact( + (com.google.cloud.essentialcontacts.v1.GetContactRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DELETE_CONTACT: + serviceImpl.deleteContact( + (com.google.cloud.essentialcontacts.v1.DeleteContactRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_COMPUTE_CONTACTS: + serviceImpl.computeContacts( + (com.google.cloud.essentialcontacts.v1.ComputeContactsRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse>) + responseObserver); + break; + case METHODID_SEND_TEST_MESSAGE: + serviceImpl.sendTestMessage( + (com.google.cloud.essentialcontacts.v1.SendTestMessageRequest) 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 EssentialContactsServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + EssentialContactsServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("EssentialContactsService"); + } + } + + private static final class EssentialContactsServiceFileDescriptorSupplier + extends EssentialContactsServiceBaseDescriptorSupplier { + EssentialContactsServiceFileDescriptorSupplier() {} + } + + private static final class EssentialContactsServiceMethodDescriptorSupplier + extends EssentialContactsServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + EssentialContactsServiceMethodDescriptorSupplier(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 (EssentialContactsServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new EssentialContactsServiceFileDescriptorSupplier()) + .addMethod(getCreateContactMethod()) + .addMethod(getUpdateContactMethod()) + .addMethod(getListContactsMethod()) + .addMethod(getGetContactMethod()) + .addMethod(getDeleteContactMethod()) + .addMethod(getComputeContactsMethod()) + .addMethod(getSendTestMessageMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/java.header b/java.header new file mode 100644 index 00000000..3a9b503a --- /dev/null +++ b/java.header @@ -0,0 +1,15 @@ +^/\*$ +^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)( All [rR]ights [rR]eserved\.)?$ +^ \*$ +^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$ +^ \* you may not use this file except in compliance with the License\.$ +^ \* You may obtain a copy of the License at$ +^ \*$ +^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$ +^ \*$ +^ \* Unless required by applicable law or agreed to in writing, software$ +^ \* distributed under the License is distributed on an "AS IS" BASIS,$ +^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$ +^ \* See the License for the specific language governing permissions and$ +^ \* limitations under the License\.$ +^ \*/$ diff --git a/license-checks.xml b/license-checks.xml new file mode 100644 index 00000000..6597fced --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/owlbot.py b/owlbot.py new file mode 100644 index 00000000..77243461 --- /dev/null +++ b/owlbot.py @@ -0,0 +1,24 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import synthtool as s +from synthtool.languages import java + + +for library in s.get_staging_dirs(): + # put any special-case replacements here + s.move(library) + +s.remove_staging_dirs() +java.common_templates() \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..bfc0f148 --- /dev/null +++ b/pom.xml @@ -0,0 +1,179 @@ + + + 4.0.0 + com.google.cloud + google-cloud-essential-contacts-parent + pom + 0.0.1-SNAPSHOT + Google Essential Contacts API Parent + https://github.com/googleapis/java-essential-contacts + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 0.11.0 + + + + + chingor + Jeff Ching + chingor@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-essential-contacts.git + scm:git:git@github.com:googleapis/java-essential-contacts.git + https://github.com/googleapis/java-essential-contacts + HEAD + + + https://github.com/googleapis/java-essential-contacts/issues + GitHub Issues + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-essential-contacts-parent + + + + + + com.google.cloud + google-cloud-essential-contacts + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-essential-contacts-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-essential-contacts-v1 + 0.0.1-SNAPSHOT + + + + com.google.cloud + google-cloud-shared-dependencies + 0.20.1 + pom + import + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.objenesis:objenesis + javax.annotation:javax.annotation-api + + + + + + + + + google-cloud-essential-contacts + grpc-google-cloud-essential-contacts-v1 + proto-google-cloud-essential-contacts-v1 + google-cloud-essential-contacts-bom + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.1.1 + + + + 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.2.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/ + + + + + + \ No newline at end of file diff --git a/proto-google-cloud-essential-contacts-v1/clirr-ignored-differences.xml b/proto-google-cloud-essential-contacts-v1/clirr-ignored-differences.xml new file mode 100644 index 00000000..d9dbe8c8 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/cloud/essentialcontacts/v1/*OrBuilder + * get*(*) + + + 7012 + com/google/cloud/essentialcontacts/v1/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/cloud/essentialcontacts/v1/*OrBuilder + boolean has*(*) + + diff --git a/proto-google-cloud-essential-contacts-v1/pom.xml b/proto-google-cloud-essential-contacts-v1/pom.xml new file mode 100644 index 00000000..6b1f3c24 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-essential-contacts-v1 + 0.0.1-SNAPSHOT + proto-google-cloud-essential-contacts-v1 + Proto library for google-cloud-essential-contacts + + com.google.cloud + google-cloud-essential-contacts-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api + api-common + + + com.google.guava + guava + + + + + + + org.codehaus.mojo + flatten-maven-plugin + + + + diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsRequest.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsRequest.java new file mode 100644 index 00000000..44518c43 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsRequest.java @@ -0,0 +1,1444 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Request message for the ComputeContacts method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.ComputeContactsRequest} + */ +public final class ComputeContactsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.ComputeContactsRequest) + ComputeContactsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ComputeContactsRequest.newBuilder() to construct. + private ComputeContactsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ComputeContactsRequest() { + parent_ = ""; + notificationCategories_ = java.util.Collections.emptyList(); + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ComputeContactsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ComputeContactsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 24: + { + pageSize_ = input.readInt32(); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 48: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + notificationCategories_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + notificationCategories_.add(rawValue); + break; + } + case 50: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + notificationCategories_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + notificationCategories_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + notificationCategories_ = java.util.Collections.unmodifiableList(notificationCategories_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest.class, + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The name of the resource to compute contacts for.
+   * Format: organizations/{organization_id},
+   * folders/{folder_id} or projects/{project_id}
+   * 
+ * + * + * 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 name of the resource to compute contacts for.
+   * Format: organizations/{organization_id},
+   * folders/{folder_id} or projects/{project_id}
+   * 
+ * + * + * 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 NOTIFICATION_CATEGORIES_FIELD_NUMBER = 6; + private java.util.List notificationCategories_; + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.essentialcontacts.v1.NotificationCategory> + notificationCategories_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.essentialcontacts.v1.NotificationCategory>() { + public com.google.cloud.essentialcontacts.v1.NotificationCategory convert( + java.lang.Integer from) { + @SuppressWarnings("deprecation") + com.google.cloud.essentialcontacts.v1.NotificationCategory result = + com.google.cloud.essentialcontacts.v1.NotificationCategory.valueOf(from); + return result == null + ? com.google.cloud.essentialcontacts.v1.NotificationCategory.UNRECOGNIZED + : result; + } + }; + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return A list containing the notificationCategories. + */ + @java.lang.Override + public java.util.List + getNotificationCategoriesList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.essentialcontacts.v1.NotificationCategory>( + notificationCategories_, notificationCategories_converter_); + } + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return The count of notificationCategories. + */ + @java.lang.Override + public int getNotificationCategoriesCount() { + return notificationCategories_.size(); + } + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param index The index of the element to return. + * @return The notificationCategories at the given index. + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.NotificationCategory getNotificationCategories( + int index) { + return notificationCategories_converter_.convert(notificationCategories_.get(index)); + } + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return A list containing the enum numeric values on the wire for notificationCategories. + */ + @java.lang.Override + public java.util.List getNotificationCategoriesValueList() { + return notificationCategories_; + } + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of notificationCategories at the given index. + */ + @java.lang.Override + public int getNotificationCategoriesValue(int index) { + return notificationCategories_.get(index); + } + + private int notificationCategoriesMemoizedSerializedSize; + + public static final int PAGE_SIZE_FIELD_NUMBER = 3; + private int pageSize_; + /** + * + * + *
+   * Optional. The maximum number of results to return from this request.
+   * Non-positive values are ignored. The presence of `next_page_token` in the
+   * response indicates that more results might be available.
+   * If not specified, the default page_size is 100.
+   * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 4; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. If present, retrieves the next batch of results from the
+   * preceding call to this method. `page_token` must be the value of
+   * `next_page_token` from the previous response. The values of other method
+   * parameters should be identical to those in the previous call.
+   * 
+ * + * string page_token = 4 [(.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. If present, retrieves the next batch of results from the
+   * preceding call to this method. `page_token` must be the value of
+   * `next_page_token` from the previous response. The values of other method
+   * parameters should be identical to those in the previous call.
+   * 
+ * + * string page_token = 4 [(.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; + } + } + + 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 { + getSerializedSize(); + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(3, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); + } + if (getNotificationCategoriesList().size() > 0) { + output.writeUInt32NoTag(50); + output.writeUInt32NoTag(notificationCategoriesMemoizedSerializedSize); + } + for (int i = 0; i < notificationCategories_.size(); i++) { + output.writeEnumNoTag(notificationCategories_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, pageToken_); + } + { + int dataSize = 0; + for (int i = 0; i < notificationCategories_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag( + notificationCategories_.get(i)); + } + size += dataSize; + if (!getNotificationCategoriesList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + notificationCategoriesMemoizedSerializedSize = dataSize; + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.ComputeContactsRequest)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest other = + (com.google.cloud.essentialcontacts.v1.ComputeContactsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!notificationCategories_.equals(other.notificationCategories_)) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (getNotificationCategoriesCount() > 0) { + hash = (37 * hash) + NOTIFICATION_CATEGORIES_FIELD_NUMBER; + hash = (53 * hash) + notificationCategories_.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 = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest 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.cloud.essentialcontacts.v1.ComputeContactsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest 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.cloud.essentialcontacts.v1.ComputeContactsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest 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.cloud.essentialcontacts.v1.ComputeContactsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest 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.cloud.essentialcontacts.v1.ComputeContactsRequest 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 the ComputeContacts method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.ComputeContactsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.ComputeContactsRequest) + com.google.cloud.essentialcontacts.v1.ComputeContactsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest.class, + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.ComputeContactsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + notificationCategories_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ComputeContactsRequest + getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.ComputeContactsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ComputeContactsRequest build() { + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ComputeContactsRequest buildPartial() { + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest result = + new com.google.cloud.essentialcontacts.v1.ComputeContactsRequest(this); + int from_bitField0_ = bitField0_; + result.parent_ = parent_; + if (((bitField0_ & 0x00000001) != 0)) { + notificationCategories_ = java.util.Collections.unmodifiableList(notificationCategories_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.notificationCategories_ = notificationCategories_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + 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.cloud.essentialcontacts.v1.ComputeContactsRequest) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.ComputeContactsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.ComputeContactsRequest other) { + if (other + == com.google.cloud.essentialcontacts.v1.ComputeContactsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (!other.notificationCategories_.isEmpty()) { + if (notificationCategories_.isEmpty()) { + notificationCategories_ = other.notificationCategories_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureNotificationCategoriesIsMutable(); + notificationCategories_.addAll(other.notificationCategories_); + } + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.ComputeContactsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.ComputeContactsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The name of the resource to compute contacts for.
+     * Format: organizations/{organization_id},
+     * folders/{folder_id} or projects/{project_id}
+     * 
+ * + * + * 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 name of the resource to compute contacts for.
+     * Format: organizations/{organization_id},
+     * folders/{folder_id} or projects/{project_id}
+     * 
+ * + * + * 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 name of the resource to compute contacts for.
+     * Format: organizations/{organization_id},
+     * folders/{folder_id} or projects/{project_id}
+     * 
+ * + * + * 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 name of the resource to compute contacts for.
+     * Format: organizations/{organization_id},
+     * folders/{folder_id} or projects/{project_id}
+     * 
+ * + * + * 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 name of the resource to compute contacts for.
+     * Format: organizations/{organization_id},
+     * folders/{folder_id} or projects/{project_id}
+     * 
+ * + * + * 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 java.util.List notificationCategories_ = + java.util.Collections.emptyList(); + + private void ensureNotificationCategoriesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + notificationCategories_ = + new java.util.ArrayList(notificationCategories_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return A list containing the notificationCategories. + */ + public java.util.List + getNotificationCategoriesList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.essentialcontacts.v1.NotificationCategory>( + notificationCategories_, notificationCategories_converter_); + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return The count of notificationCategories. + */ + public int getNotificationCategoriesCount() { + return notificationCategories_.size(); + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param index The index of the element to return. + * @return The notificationCategories at the given index. + */ + public com.google.cloud.essentialcontacts.v1.NotificationCategory getNotificationCategories( + int index) { + return notificationCategories_converter_.convert(notificationCategories_.get(index)); + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param index The index to set the value at. + * @param value The notificationCategories to set. + * @return This builder for chaining. + */ + public Builder setNotificationCategories( + int index, com.google.cloud.essentialcontacts.v1.NotificationCategory value) { + if (value == null) { + throw new NullPointerException(); + } + ensureNotificationCategoriesIsMutable(); + notificationCategories_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param value The notificationCategories to add. + * @return This builder for chaining. + */ + public Builder addNotificationCategories( + com.google.cloud.essentialcontacts.v1.NotificationCategory value) { + if (value == null) { + throw new NullPointerException(); + } + ensureNotificationCategoriesIsMutable(); + notificationCategories_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param values The notificationCategories to add. + * @return This builder for chaining. + */ + public Builder addAllNotificationCategories( + java.lang.Iterable + values) { + ensureNotificationCategoriesIsMutable(); + for (com.google.cloud.essentialcontacts.v1.NotificationCategory value : values) { + notificationCategories_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return This builder for chaining. + */ + public Builder clearNotificationCategories() { + notificationCategories_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return A list containing the enum numeric values on the wire for notificationCategories. + */ + public java.util.List getNotificationCategoriesValueList() { + return java.util.Collections.unmodifiableList(notificationCategories_); + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of notificationCategories at the given index. + */ + public int getNotificationCategoriesValue(int index) { + return notificationCategories_.get(index); + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of notificationCategories at the given index. + * @return This builder for chaining. + */ + public Builder setNotificationCategoriesValue(int index, int value) { + ensureNotificationCategoriesIsMutable(); + notificationCategories_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param value The enum numeric value on the wire for notificationCategories to add. + * @return This builder for chaining. + */ + public Builder addNotificationCategoriesValue(int value) { + ensureNotificationCategoriesIsMutable(); + notificationCategories_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications to compute contacts for. If ALL is included
+     * in this list, contacts subscribed to any notification category will be
+     * returned.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param values The enum numeric values on the wire for notificationCategories to add. + * @return This builder for chaining. + */ + public Builder addAllNotificationCategoriesValue(java.lang.Iterable values) { + ensureNotificationCategoriesIsMutable(); + for (int value : values) { + notificationCategories_.add(value); + } + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. The maximum number of results to return from this request.
+     * Non-positive values are ignored. The presence of `next_page_token` in the
+     * response indicates that more results might be available.
+     * If not specified, the default page_size is 100.
+     * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. The maximum number of results to return from this request.
+     * Non-positive values are ignored. The presence of `next_page_token` in the
+     * response indicates that more results might be available.
+     * If not specified, the default page_size is 100.
+     * 
+ * + * int32 page_size = 3 [(.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. The maximum number of results to return from this request.
+     * Non-positive values are ignored. The presence of `next_page_token` in the
+     * response indicates that more results might be available.
+     * If not specified, the default page_size is 100.
+     * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.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. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.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. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.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. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * string page_token = 4 [(.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; + } + + @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.cloud.essentialcontacts.v1.ComputeContactsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.ComputeContactsRequest) + private static final com.google.cloud.essentialcontacts.v1.ComputeContactsRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.ComputeContactsRequest(); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ComputeContactsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ComputeContactsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ComputeContactsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsRequestOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsRequestOrBuilder.java new file mode 100644 index 00000000..066f77b9 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsRequestOrBuilder.java @@ -0,0 +1,189 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface ComputeContactsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.ComputeContactsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the resource to compute contacts for.
+   * Format: organizations/{organization_id},
+   * folders/{folder_id} or projects/{project_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The name of the resource to compute contacts for.
+   * Format: organizations/{organization_id},
+   * folders/{folder_id} or projects/{project_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return A list containing the notificationCategories. + */ + java.util.List + getNotificationCategoriesList(); + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return The count of notificationCategories. + */ + int getNotificationCategoriesCount(); + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param index The index of the element to return. + * @return The notificationCategories at the given index. + */ + com.google.cloud.essentialcontacts.v1.NotificationCategory getNotificationCategories(int index); + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @return A list containing the enum numeric values on the wire for notificationCategories. + */ + java.util.List getNotificationCategoriesValueList(); + /** + * + * + *
+   * The categories of notifications to compute contacts for. If ALL is included
+   * in this list, contacts subscribed to any notification category will be
+   * returned.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_categories = 6; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of notificationCategories at the given index. + */ + int getNotificationCategoriesValue(int index); + + /** + * + * + *
+   * Optional. The maximum number of results to return from this request.
+   * Non-positive values are ignored. The presence of `next_page_token` in the
+   * response indicates that more results might be available.
+   * If not specified, the default page_size is 100.
+   * 
+ * + * int32 page_size = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. If present, retrieves the next batch of results from the
+   * preceding call to this method. `page_token` must be the value of
+   * `next_page_token` from the previous response. The values of other method
+   * parameters should be identical to those in the previous call.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. If present, retrieves the next batch of results from the
+   * preceding call to this method. `page_token` must be the value of
+   * `next_page_token` from the previous response. The values of other method
+   * parameters should be identical to those in the previous call.
+   * 
+ * + * string page_token = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsResponse.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsResponse.java new file mode 100644 index 00000000..96f528d3 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsResponse.java @@ -0,0 +1,1203 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Response message for the ComputeContacts method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.ComputeContactsResponse} + */ +public final class ComputeContactsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.ComputeContactsResponse) + ComputeContactsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ComputeContactsResponse.newBuilder() to construct. + private ComputeContactsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ComputeContactsResponse() { + contacts_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ComputeContactsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ComputeContactsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + contacts_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + contacts_.add( + input.readMessage( + com.google.cloud.essentialcontacts.v1.Contact.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + contacts_ = java.util.Collections.unmodifiableList(contacts_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse.class, + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse.Builder.class); + } + + public static final int CONTACTS_FIELD_NUMBER = 1; + private java.util.List contacts_; + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public java.util.List getContactsList() { + return contacts_; + } + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public java.util.List + getContactsOrBuilderList() { + return contacts_; + } + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public int getContactsCount() { + return contacts_.size(); + } + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.Contact getContacts(int index) { + return contacts_.get(index); + } + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactsOrBuilder(int index) { + return contacts_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included. To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token` and the
+   * rest of the parameters the same as the original request.
+   * 
+ * + * 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; + } + } + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included. To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token` and the
+   * rest of the parameters the same as the original request.
+   * 
+ * + * 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 < contacts_.size(); i++) { + output.writeMessage(1, contacts_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < contacts_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, contacts_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.ComputeContactsResponse)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse other = + (com.google.cloud.essentialcontacts.v1.ComputeContactsResponse) obj; + + if (!getContactsList().equals(other.getContactsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getContactsCount() > 0) { + hash = (37 * hash) + CONTACTS_FIELD_NUMBER; + hash = (53 * hash) + getContactsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse 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.cloud.essentialcontacts.v1.ComputeContactsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse 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.cloud.essentialcontacts.v1.ComputeContactsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse 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.cloud.essentialcontacts.v1.ComputeContactsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse 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.cloud.essentialcontacts.v1.ComputeContactsResponse 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 the ComputeContacts method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.ComputeContactsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.ComputeContactsResponse) + com.google.cloud.essentialcontacts.v1.ComputeContactsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse.class, + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.ComputeContactsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getContactsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (contactsBuilder_ == null) { + contacts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + contactsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ComputeContactsResponse + getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.ComputeContactsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ComputeContactsResponse build() { + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ComputeContactsResponse buildPartial() { + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse result = + new com.google.cloud.essentialcontacts.v1.ComputeContactsResponse(this); + int from_bitField0_ = bitField0_; + if (contactsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + contacts_ = java.util.Collections.unmodifiableList(contacts_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.contacts_ = contacts_; + } else { + result.contacts_ = contactsBuilder_.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.cloud.essentialcontacts.v1.ComputeContactsResponse) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.ComputeContactsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.ComputeContactsResponse other) { + if (other + == com.google.cloud.essentialcontacts.v1.ComputeContactsResponse.getDefaultInstance()) + return this; + if (contactsBuilder_ == null) { + if (!other.contacts_.isEmpty()) { + if (contacts_.isEmpty()) { + contacts_ = other.contacts_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureContactsIsMutable(); + contacts_.addAll(other.contacts_); + } + onChanged(); + } + } else { + if (!other.contacts_.isEmpty()) { + if (contactsBuilder_.isEmpty()) { + contactsBuilder_.dispose(); + contactsBuilder_ = null; + contacts_ = other.contacts_; + bitField0_ = (bitField0_ & ~0x00000001); + contactsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getContactsFieldBuilder() + : null; + } else { + contactsBuilder_.addAllMessages(other.contacts_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.ComputeContactsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.ComputeContactsResponse) + e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List contacts_ = + java.util.Collections.emptyList(); + + private void ensureContactsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + contacts_ = + new java.util.ArrayList(contacts_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder> + contactsBuilder_; + + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public java.util.List getContactsList() { + if (contactsBuilder_ == null) { + return java.util.Collections.unmodifiableList(contacts_); + } else { + return contactsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public int getContactsCount() { + if (contactsBuilder_ == null) { + return contacts_.size(); + } else { + return contactsBuilder_.getCount(); + } + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.Contact getContacts(int index) { + if (contactsBuilder_ == null) { + return contacts_.get(index); + } else { + return contactsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder setContacts(int index, com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContactsIsMutable(); + contacts_.set(index, value); + onChanged(); + } else { + contactsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder setContacts( + int index, com.google.cloud.essentialcontacts.v1.Contact.Builder builderForValue) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + contacts_.set(index, builderForValue.build()); + onChanged(); + } else { + contactsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addContacts(com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContactsIsMutable(); + contacts_.add(value); + onChanged(); + } else { + contactsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addContacts(int index, com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContactsIsMutable(); + contacts_.add(index, value); + onChanged(); + } else { + contactsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addContacts( + com.google.cloud.essentialcontacts.v1.Contact.Builder builderForValue) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + contacts_.add(builderForValue.build()); + onChanged(); + } else { + contactsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addContacts( + int index, com.google.cloud.essentialcontacts.v1.Contact.Builder builderForValue) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + contacts_.add(index, builderForValue.build()); + onChanged(); + } else { + contactsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addAllContacts( + java.lang.Iterable values) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, contacts_); + onChanged(); + } else { + contactsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder clearContacts() { + if (contactsBuilder_ == null) { + contacts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + contactsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder removeContacts(int index) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + contacts_.remove(index); + onChanged(); + } else { + contactsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.Contact.Builder getContactsBuilder(int index) { + return getContactsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactsOrBuilder(int index) { + if (contactsBuilder_ == null) { + return contacts_.get(index); + } else { + return contactsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public java.util.List + getContactsOrBuilderList() { + if (contactsBuilder_ != null) { + return contactsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(contacts_); + } + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.Contact.Builder addContactsBuilder() { + return getContactsFieldBuilder() + .addBuilder(com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance()); + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.Contact.Builder addContactsBuilder(int index) { + return getContactsFieldBuilder() + .addBuilder(index, com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance()); + } + /** + * + * + *
+     * All contacts for the resource that are subscribed to the specified
+     * notification categories, including contacts inherited from any parent
+     * resources.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public java.util.List + getContactsBuilderList() { + return getContactsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder> + getContactsFieldBuilder() { + if (contactsBuilder_ == null) { + contactsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder>( + contacts_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + contacts_ = null; + } + return contactsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * 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; + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * 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.cloud.essentialcontacts.v1.ComputeContactsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.ComputeContactsResponse) + private static final com.google.cloud.essentialcontacts.v1.ComputeContactsResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.ComputeContactsResponse(); + } + + public static com.google.cloud.essentialcontacts.v1.ComputeContactsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ComputeContactsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ComputeContactsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ComputeContactsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsResponseOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsResponseOrBuilder.java new file mode 100644 index 00000000..52b366b9 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ComputeContactsResponseOrBuilder.java @@ -0,0 +1,118 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface ComputeContactsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.ComputeContactsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + java.util.List getContactsList(); + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + com.google.cloud.essentialcontacts.v1.Contact getContacts(int index); + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + int getContactsCount(); + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + java.util.List + getContactsOrBuilderList(); + /** + * + * + *
+   * All contacts for the resource that are subscribed to the specified
+   * notification categories, including contacts inherited from any parent
+   * resources.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactsOrBuilder(int index); + + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included. To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token` and the
+   * rest of the parameters the same as the original request.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included. To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token` and the
+   * rest of the parameters the same as the original request.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/Contact.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/Contact.java new file mode 100644 index 00000000..ba5dcb1b --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/Contact.java @@ -0,0 +1,1961 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * A contact that will receive notifications from Google Cloud.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.Contact} + */ +public final class Contact extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.Contact) + ContactOrBuilder { + private static final long serialVersionUID = 0L; + // Use Contact.newBuilder() to construct. + private Contact(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Contact() { + name_ = ""; + email_ = ""; + notificationCategorySubscriptions_ = java.util.Collections.emptyList(); + languageTag_ = ""; + validationState_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Contact(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Contact( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + email_ = s; + break; + } + case 24: + { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + notificationCategorySubscriptions_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + notificationCategorySubscriptions_.add(rawValue); + break; + } + case 26: + { + int length = input.readRawVarint32(); + int oldLimit = input.pushLimit(length); + while (input.getBytesUntilLimit() > 0) { + int rawValue = input.readEnum(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + notificationCategorySubscriptions_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + notificationCategorySubscriptions_.add(rawValue); + } + input.popLimit(oldLimit); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + languageTag_ = s; + break; + } + case 64: + { + int rawValue = input.readEnum(); + + validationState_ = rawValue; + break; + } + case 74: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (validateTime_ != null) { + subBuilder = validateTime_.toBuilder(); + } + validateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(validateTime_); + validateTime_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + notificationCategorySubscriptions_ = + java.util.Collections.unmodifiableList(notificationCategorySubscriptions_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_Contact_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_Contact_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.Contact.class, + com.google.cloud.essentialcontacts.v1.Contact.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The identifier for the contact.
+   * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+   * 
+ * + * string name = 1; + * + * @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 identifier for the contact.
+   * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+   * 
+ * + * string name = 1; + * + * @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 EMAIL_FIELD_NUMBER = 2; + private volatile java.lang.Object email_; + /** + * + * + *
+   * Required. The email address to send notifications to. This does not need to
+   * be a Google account.
+   * 
+ * + * string email = 2; + * + * @return The email. + */ + @java.lang.Override + public java.lang.String getEmail() { + java.lang.Object ref = email_; + 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(); + email_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The email address to send notifications to. This does not need to
+   * be a Google account.
+   * 
+ * + * string email = 2; + * + * @return The bytes for email. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEmailBytes() { + java.lang.Object ref = email_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + email_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NOTIFICATION_CATEGORY_SUBSCRIPTIONS_FIELD_NUMBER = 3; + private java.util.List notificationCategorySubscriptions_; + private static final com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.essentialcontacts.v1.NotificationCategory> + notificationCategorySubscriptions_converter_ = + new com.google.protobuf.Internal.ListAdapter.Converter< + java.lang.Integer, com.google.cloud.essentialcontacts.v1.NotificationCategory>() { + public com.google.cloud.essentialcontacts.v1.NotificationCategory convert( + java.lang.Integer from) { + @SuppressWarnings("deprecation") + com.google.cloud.essentialcontacts.v1.NotificationCategory result = + com.google.cloud.essentialcontacts.v1.NotificationCategory.valueOf(from); + return result == null + ? com.google.cloud.essentialcontacts.v1.NotificationCategory.UNRECOGNIZED + : result; + } + }; + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return A list containing the notificationCategorySubscriptions. + */ + @java.lang.Override + public java.util.List + getNotificationCategorySubscriptionsList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.essentialcontacts.v1.NotificationCategory>( + notificationCategorySubscriptions_, notificationCategorySubscriptions_converter_); + } + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return The count of notificationCategorySubscriptions. + */ + @java.lang.Override + public int getNotificationCategorySubscriptionsCount() { + return notificationCategorySubscriptions_.size(); + } + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param index The index of the element to return. + * @return The notificationCategorySubscriptions at the given index. + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.NotificationCategory + getNotificationCategorySubscriptions(int index) { + return notificationCategorySubscriptions_converter_.convert( + notificationCategorySubscriptions_.get(index)); + } + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return A list containing the enum numeric values on the wire for + * notificationCategorySubscriptions. + */ + @java.lang.Override + public java.util.List getNotificationCategorySubscriptionsValueList() { + return notificationCategorySubscriptions_; + } + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of notificationCategorySubscriptions at the given + * index. + */ + @java.lang.Override + public int getNotificationCategorySubscriptionsValue(int index) { + return notificationCategorySubscriptions_.get(index); + } + + private int notificationCategorySubscriptionsMemoizedSerializedSize; + + public static final int LANGUAGE_TAG_FIELD_NUMBER = 4; + private volatile java.lang.Object languageTag_; + /** + * + * + *
+   * The preferred language for notifications, as a ISO 639-1 language code. See
+   * [Supported
+   * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+   * for a list of supported languages.
+   * 
+ * + * string language_tag = 4; + * + * @return The languageTag. + */ + @java.lang.Override + public java.lang.String getLanguageTag() { + java.lang.Object ref = languageTag_; + 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(); + languageTag_ = s; + return s; + } + } + /** + * + * + *
+   * The preferred language for notifications, as a ISO 639-1 language code. See
+   * [Supported
+   * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+   * for a list of supported languages.
+   * 
+ * + * string language_tag = 4; + * + * @return The bytes for languageTag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLanguageTagBytes() { + java.lang.Object ref = languageTag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageTag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATION_STATE_FIELD_NUMBER = 8; + private int validationState_; + /** + * + * + *
+   * The validity of the contact. A contact is considered valid if it is the
+   * correct recipient for notifications for a particular resource.
+   * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @return The enum numeric value on the wire for validationState. + */ + @java.lang.Override + public int getValidationStateValue() { + return validationState_; + } + /** + * + * + *
+   * The validity of the contact. A contact is considered valid if it is the
+   * correct recipient for notifications for a particular resource.
+   * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @return The validationState. + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ValidationState getValidationState() { + @SuppressWarnings("deprecation") + com.google.cloud.essentialcontacts.v1.ValidationState result = + com.google.cloud.essentialcontacts.v1.ValidationState.valueOf(validationState_); + return result == null + ? com.google.cloud.essentialcontacts.v1.ValidationState.UNRECOGNIZED + : result; + } + + public static final int VALIDATE_TIME_FIELD_NUMBER = 9; + private com.google.protobuf.Timestamp validateTime_; + /** + * + * + *
+   * The last time the validation_state was updated, either manually or
+   * automatically. A contact is considered stale if its validation state was
+   * updated more than 1 year ago.
+   * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + * + * @return Whether the validateTime field is set. + */ + @java.lang.Override + public boolean hasValidateTime() { + return validateTime_ != null; + } + /** + * + * + *
+   * The last time the validation_state was updated, either manually or
+   * automatically. A contact is considered stale if its validation state was
+   * updated more than 1 year ago.
+   * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + * + * @return The validateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getValidateTime() { + return validateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : validateTime_; + } + /** + * + * + *
+   * The last time the validation_state was updated, either manually or
+   * automatically. A contact is considered stale if its validation state was
+   * updated more than 1 year ago.
+   * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getValidateTimeOrBuilder() { + return getValidateTime(); + } + + 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 { + getSerializedSize(); + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!getEmailBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, email_); + } + if (getNotificationCategorySubscriptionsList().size() > 0) { + output.writeUInt32NoTag(26); + output.writeUInt32NoTag(notificationCategorySubscriptionsMemoizedSerializedSize); + } + for (int i = 0; i < notificationCategorySubscriptions_.size(); i++) { + output.writeEnumNoTag(notificationCategorySubscriptions_.get(i)); + } + if (!getLanguageTagBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, languageTag_); + } + if (validationState_ + != com.google.cloud.essentialcontacts.v1.ValidationState.VALIDATION_STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(8, validationState_); + } + if (validateTime_ != null) { + output.writeMessage(9, getValidateTime()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!getEmailBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, email_); + } + { + int dataSize = 0; + for (int i = 0; i < notificationCategorySubscriptions_.size(); i++) { + dataSize += + com.google.protobuf.CodedOutputStream.computeEnumSizeNoTag( + notificationCategorySubscriptions_.get(i)); + } + size += dataSize; + if (!getNotificationCategorySubscriptionsList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream.computeUInt32SizeNoTag(dataSize); + } + notificationCategorySubscriptionsMemoizedSerializedSize = dataSize; + } + if (!getLanguageTagBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, languageTag_); + } + if (validationState_ + != com.google.cloud.essentialcontacts.v1.ValidationState.VALIDATION_STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(8, validationState_); + } + if (validateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getValidateTime()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.Contact)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.Contact other = + (com.google.cloud.essentialcontacts.v1.Contact) obj; + + if (!getName().equals(other.getName())) return false; + if (!getEmail().equals(other.getEmail())) return false; + if (!notificationCategorySubscriptions_.equals(other.notificationCategorySubscriptions_)) + return false; + if (!getLanguageTag().equals(other.getLanguageTag())) return false; + if (validationState_ != other.validationState_) return false; + if (hasValidateTime() != other.hasValidateTime()) return false; + if (hasValidateTime()) { + if (!getValidateTime().equals(other.getValidateTime())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + EMAIL_FIELD_NUMBER; + hash = (53 * hash) + getEmail().hashCode(); + if (getNotificationCategorySubscriptionsCount() > 0) { + hash = (37 * hash) + NOTIFICATION_CATEGORY_SUBSCRIPTIONS_FIELD_NUMBER; + hash = (53 * hash) + notificationCategorySubscriptions_.hashCode(); + } + hash = (37 * hash) + LANGUAGE_TAG_FIELD_NUMBER; + hash = (53 * hash) + getLanguageTag().hashCode(); + hash = (37 * hash) + VALIDATION_STATE_FIELD_NUMBER; + hash = (53 * hash) + validationState_; + if (hasValidateTime()) { + hash = (37 * hash) + VALIDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getValidateTime().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.Contact parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.Contact parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.Contact parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.Contact 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.cloud.essentialcontacts.v1.Contact parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.Contact parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.Contact parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.Contact 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.cloud.essentialcontacts.v1.Contact parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.Contact 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.cloud.essentialcontacts.v1.Contact parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.Contact 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.cloud.essentialcontacts.v1.Contact 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 contact that will receive notifications from Google Cloud.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.Contact} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.Contact) + com.google.cloud.essentialcontacts.v1.ContactOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_Contact_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_Contact_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.Contact.class, + com.google.cloud.essentialcontacts.v1.Contact.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.Contact.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + email_ = ""; + + notificationCategorySubscriptions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + languageTag_ = ""; + + validationState_ = 0; + + if (validateTimeBuilder_ == null) { + validateTime_ = null; + } else { + validateTime_ = null; + validateTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_Contact_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.Contact getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.Contact build() { + com.google.cloud.essentialcontacts.v1.Contact result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.Contact buildPartial() { + com.google.cloud.essentialcontacts.v1.Contact result = + new com.google.cloud.essentialcontacts.v1.Contact(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.email_ = email_; + if (((bitField0_ & 0x00000001) != 0)) { + notificationCategorySubscriptions_ = + java.util.Collections.unmodifiableList(notificationCategorySubscriptions_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.notificationCategorySubscriptions_ = notificationCategorySubscriptions_; + result.languageTag_ = languageTag_; + result.validationState_ = validationState_; + if (validateTimeBuilder_ == null) { + result.validateTime_ = validateTime_; + } else { + result.validateTime_ = validateTimeBuilder_.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.cloud.essentialcontacts.v1.Contact) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.Contact) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.Contact other) { + if (other == com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getEmail().isEmpty()) { + email_ = other.email_; + onChanged(); + } + if (!other.notificationCategorySubscriptions_.isEmpty()) { + if (notificationCategorySubscriptions_.isEmpty()) { + notificationCategorySubscriptions_ = other.notificationCategorySubscriptions_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureNotificationCategorySubscriptionsIsMutable(); + notificationCategorySubscriptions_.addAll(other.notificationCategorySubscriptions_); + } + onChanged(); + } + if (!other.getLanguageTag().isEmpty()) { + languageTag_ = other.languageTag_; + onChanged(); + } + if (other.validationState_ != 0) { + setValidationStateValue(other.getValidationStateValue()); + } + if (other.hasValidateTime()) { + mergeValidateTime(other.getValidateTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.Contact parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.essentialcontacts.v1.Contact) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The identifier for the contact.
+     * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+     * 
+ * + * string name = 1; + * + * @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 identifier for the contact.
+     * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+     * 
+ * + * string name = 1; + * + * @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 identifier for the contact.
+     * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+     * 
+ * + * string name = 1; + * + * @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 identifier for the contact.
+     * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The identifier for the contact.
+     * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+     * 
+ * + * string name = 1; + * + * @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 email_ = ""; + /** + * + * + *
+     * Required. The email address to send notifications to. This does not need to
+     * be a Google account.
+     * 
+ * + * string email = 2; + * + * @return The email. + */ + public java.lang.String getEmail() { + java.lang.Object ref = email_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + email_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The email address to send notifications to. This does not need to
+     * be a Google account.
+     * 
+ * + * string email = 2; + * + * @return The bytes for email. + */ + public com.google.protobuf.ByteString getEmailBytes() { + java.lang.Object ref = email_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + email_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The email address to send notifications to. This does not need to
+     * be a Google account.
+     * 
+ * + * string email = 2; + * + * @param value The email to set. + * @return This builder for chaining. + */ + public Builder setEmail(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + email_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The email address to send notifications to. This does not need to
+     * be a Google account.
+     * 
+ * + * string email = 2; + * + * @return This builder for chaining. + */ + public Builder clearEmail() { + + email_ = getDefaultInstance().getEmail(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The email address to send notifications to. This does not need to
+     * be a Google account.
+     * 
+ * + * string email = 2; + * + * @param value The bytes for email to set. + * @return This builder for chaining. + */ + public Builder setEmailBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + email_ = value; + onChanged(); + return this; + } + + private java.util.List notificationCategorySubscriptions_ = + java.util.Collections.emptyList(); + + private void ensureNotificationCategorySubscriptionsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + notificationCategorySubscriptions_ = + new java.util.ArrayList(notificationCategorySubscriptions_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return A list containing the notificationCategorySubscriptions. + */ + public java.util.List + getNotificationCategorySubscriptionsList() { + return new com.google.protobuf.Internal.ListAdapter< + java.lang.Integer, com.google.cloud.essentialcontacts.v1.NotificationCategory>( + notificationCategorySubscriptions_, notificationCategorySubscriptions_converter_); + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return The count of notificationCategorySubscriptions. + */ + public int getNotificationCategorySubscriptionsCount() { + return notificationCategorySubscriptions_.size(); + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param index The index of the element to return. + * @return The notificationCategorySubscriptions at the given index. + */ + public com.google.cloud.essentialcontacts.v1.NotificationCategory + getNotificationCategorySubscriptions(int index) { + return notificationCategorySubscriptions_converter_.convert( + notificationCategorySubscriptions_.get(index)); + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param index The index to set the value at. + * @param value The notificationCategorySubscriptions to set. + * @return This builder for chaining. + */ + public Builder setNotificationCategorySubscriptions( + int index, com.google.cloud.essentialcontacts.v1.NotificationCategory value) { + if (value == null) { + throw new NullPointerException(); + } + ensureNotificationCategorySubscriptionsIsMutable(); + notificationCategorySubscriptions_.set(index, value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param value The notificationCategorySubscriptions to add. + * @return This builder for chaining. + */ + public Builder addNotificationCategorySubscriptions( + com.google.cloud.essentialcontacts.v1.NotificationCategory value) { + if (value == null) { + throw new NullPointerException(); + } + ensureNotificationCategorySubscriptionsIsMutable(); + notificationCategorySubscriptions_.add(value.getNumber()); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param values The notificationCategorySubscriptions to add. + * @return This builder for chaining. + */ + public Builder addAllNotificationCategorySubscriptions( + java.lang.Iterable + values) { + ensureNotificationCategorySubscriptionsIsMutable(); + for (com.google.cloud.essentialcontacts.v1.NotificationCategory value : values) { + notificationCategorySubscriptions_.add(value.getNumber()); + } + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return This builder for chaining. + */ + public Builder clearNotificationCategorySubscriptions() { + notificationCategorySubscriptions_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return A list containing the enum numeric values on the wire for + * notificationCategorySubscriptions. + */ + public java.util.List getNotificationCategorySubscriptionsValueList() { + return java.util.Collections.unmodifiableList(notificationCategorySubscriptions_); + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of notificationCategorySubscriptions at the given + * index. + */ + public int getNotificationCategorySubscriptionsValue(int index) { + return notificationCategorySubscriptions_.get(index); + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of notificationCategorySubscriptions at the given + * index. + * @return This builder for chaining. + */ + public Builder setNotificationCategorySubscriptionsValue(int index, int value) { + ensureNotificationCategorySubscriptionsIsMutable(); + notificationCategorySubscriptions_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param value The enum numeric value on the wire for notificationCategorySubscriptions to add. + * @return This builder for chaining. + */ + public Builder addNotificationCategorySubscriptionsValue(int value) { + ensureNotificationCategorySubscriptionsIsMutable(); + notificationCategorySubscriptions_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * The categories of notifications that the contact will receive
+     * communications for.
+     * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param values The enum numeric values on the wire for notificationCategorySubscriptions to + * add. + * @return This builder for chaining. + */ + public Builder addAllNotificationCategorySubscriptionsValue( + java.lang.Iterable values) { + ensureNotificationCategorySubscriptionsIsMutable(); + for (int value : values) { + notificationCategorySubscriptions_.add(value); + } + onChanged(); + return this; + } + + private java.lang.Object languageTag_ = ""; + /** + * + * + *
+     * The preferred language for notifications, as a ISO 639-1 language code. See
+     * [Supported
+     * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+     * for a list of supported languages.
+     * 
+ * + * string language_tag = 4; + * + * @return The languageTag. + */ + public java.lang.String getLanguageTag() { + java.lang.Object ref = languageTag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + languageTag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The preferred language for notifications, as a ISO 639-1 language code. See
+     * [Supported
+     * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+     * for a list of supported languages.
+     * 
+ * + * string language_tag = 4; + * + * @return The bytes for languageTag. + */ + public com.google.protobuf.ByteString getLanguageTagBytes() { + java.lang.Object ref = languageTag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + languageTag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The preferred language for notifications, as a ISO 639-1 language code. See
+     * [Supported
+     * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+     * for a list of supported languages.
+     * 
+ * + * string language_tag = 4; + * + * @param value The languageTag to set. + * @return This builder for chaining. + */ + public Builder setLanguageTag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + languageTag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The preferred language for notifications, as a ISO 639-1 language code. See
+     * [Supported
+     * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+     * for a list of supported languages.
+     * 
+ * + * string language_tag = 4; + * + * @return This builder for chaining. + */ + public Builder clearLanguageTag() { + + languageTag_ = getDefaultInstance().getLanguageTag(); + onChanged(); + return this; + } + /** + * + * + *
+     * The preferred language for notifications, as a ISO 639-1 language code. See
+     * [Supported
+     * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+     * for a list of supported languages.
+     * 
+ * + * string language_tag = 4; + * + * @param value The bytes for languageTag to set. + * @return This builder for chaining. + */ + public Builder setLanguageTagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + languageTag_ = value; + onChanged(); + return this; + } + + private int validationState_ = 0; + /** + * + * + *
+     * The validity of the contact. A contact is considered valid if it is the
+     * correct recipient for notifications for a particular resource.
+     * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @return The enum numeric value on the wire for validationState. + */ + @java.lang.Override + public int getValidationStateValue() { + return validationState_; + } + /** + * + * + *
+     * The validity of the contact. A contact is considered valid if it is the
+     * correct recipient for notifications for a particular resource.
+     * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @param value The enum numeric value on the wire for validationState to set. + * @return This builder for chaining. + */ + public Builder setValidationStateValue(int value) { + + validationState_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The validity of the contact. A contact is considered valid if it is the
+     * correct recipient for notifications for a particular resource.
+     * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @return The validationState. + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ValidationState getValidationState() { + @SuppressWarnings("deprecation") + com.google.cloud.essentialcontacts.v1.ValidationState result = + com.google.cloud.essentialcontacts.v1.ValidationState.valueOf(validationState_); + return result == null + ? com.google.cloud.essentialcontacts.v1.ValidationState.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * The validity of the contact. A contact is considered valid if it is the
+     * correct recipient for notifications for a particular resource.
+     * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @param value The validationState to set. + * @return This builder for chaining. + */ + public Builder setValidationState(com.google.cloud.essentialcontacts.v1.ValidationState value) { + if (value == null) { + throw new NullPointerException(); + } + + validationState_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * The validity of the contact. A contact is considered valid if it is the
+     * correct recipient for notifications for a particular resource.
+     * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @return This builder for chaining. + */ + public Builder clearValidationState() { + + validationState_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp validateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + validateTimeBuilder_; + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + * + * @return Whether the validateTime field is set. + */ + public boolean hasValidateTime() { + return validateTimeBuilder_ != null || validateTime_ != null; + } + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + * + * @return The validateTime. + */ + public com.google.protobuf.Timestamp getValidateTime() { + if (validateTimeBuilder_ == null) { + return validateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : validateTime_; + } else { + return validateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + public Builder setValidateTime(com.google.protobuf.Timestamp value) { + if (validateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + validateTime_ = value; + onChanged(); + } else { + validateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + public Builder setValidateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (validateTimeBuilder_ == null) { + validateTime_ = builderForValue.build(); + onChanged(); + } else { + validateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + public Builder mergeValidateTime(com.google.protobuf.Timestamp value) { + if (validateTimeBuilder_ == null) { + if (validateTime_ != null) { + validateTime_ = + com.google.protobuf.Timestamp.newBuilder(validateTime_) + .mergeFrom(value) + .buildPartial(); + } else { + validateTime_ = value; + } + onChanged(); + } else { + validateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + public Builder clearValidateTime() { + if (validateTimeBuilder_ == null) { + validateTime_ = null; + onChanged(); + } else { + validateTime_ = null; + validateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + public com.google.protobuf.Timestamp.Builder getValidateTimeBuilder() { + + onChanged(); + return getValidateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + public com.google.protobuf.TimestampOrBuilder getValidateTimeOrBuilder() { + if (validateTimeBuilder_ != null) { + return validateTimeBuilder_.getMessageOrBuilder(); + } else { + return validateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : validateTime_; + } + } + /** + * + * + *
+     * The last time the validation_state was updated, either manually or
+     * automatically. A contact is considered stale if its validation state was
+     * updated more than 1 year ago.
+     * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getValidateTimeFieldBuilder() { + if (validateTimeBuilder_ == null) { + validateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getValidateTime(), getParentForChildren(), isClean()); + validateTime_ = null; + } + return validateTimeBuilder_; + } + + @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.cloud.essentialcontacts.v1.Contact) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.Contact) + private static final com.google.cloud.essentialcontacts.v1.Contact DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.Contact(); + } + + public static com.google.cloud.essentialcontacts.v1.Contact getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Contact parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Contact(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.Contact getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ContactName.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ContactName.java new file mode 100644 index 00000000..0eb7c7ca --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ContactName.java @@ -0,0 +1,371 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +import com.google.api.core.BetaApi; +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.pathtemplate.ValidationException; +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 ContactName implements ResourceName { + private static final PathTemplate PROJECT_CONTACT = + PathTemplate.createWithoutUrlEncoding("projects/{project}/contacts/{contact}"); + private static final PathTemplate FOLDER_CONTACT = + PathTemplate.createWithoutUrlEncoding("folders/{folder}/contacts/{contact}"); + private static final PathTemplate ORGANIZATION_CONTACT = + PathTemplate.createWithoutUrlEncoding("organizations/{organization}/contacts/{contact}"); + private volatile Map fieldValuesMap; + private PathTemplate pathTemplate; + private String fixedValue; + private final String project; + private final String contact; + private final String folder; + private final String organization; + + @Deprecated + protected ContactName() { + project = null; + contact = null; + folder = null; + organization = null; + } + + private ContactName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + contact = Preconditions.checkNotNull(builder.getContact()); + folder = null; + organization = null; + pathTemplate = PROJECT_CONTACT; + } + + private ContactName(FolderContactBuilder builder) { + folder = Preconditions.checkNotNull(builder.getFolder()); + contact = Preconditions.checkNotNull(builder.getContact()); + project = null; + organization = null; + pathTemplate = FOLDER_CONTACT; + } + + private ContactName(OrganizationContactBuilder builder) { + organization = Preconditions.checkNotNull(builder.getOrganization()); + contact = Preconditions.checkNotNull(builder.getContact()); + project = null; + folder = null; + pathTemplate = ORGANIZATION_CONTACT; + } + + public String getProject() { + return project; + } + + public String getContact() { + return contact; + } + + public String getFolder() { + return folder; + } + + public String getOrganization() { + return organization; + } + + public static Builder newBuilder() { + return new Builder(); + } + + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static Builder newProjectContactBuilder() { + return new Builder(); + } + + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static FolderContactBuilder newFolderContactBuilder() { + return new FolderContactBuilder(); + } + + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static OrganizationContactBuilder newOrganizationContactBuilder() { + return new OrganizationContactBuilder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ContactName of(String project, String contact) { + return newBuilder().setProject(project).setContact(contact).build(); + } + + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static ContactName ofProjectContactName(String project, String contact) { + return newBuilder().setProject(project).setContact(contact).build(); + } + + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static ContactName ofFolderContactName(String folder, String contact) { + return newFolderContactBuilder().setFolder(folder).setContact(contact).build(); + } + + @BetaApi("The static create methods are not stable yet and may be changed in the future.") + public static ContactName ofOrganizationContactName(String organization, String contact) { + return newOrganizationContactBuilder() + .setOrganization(organization) + .setContact(contact) + .build(); + } + + public static String format(String project, String contact) { + return newBuilder().setProject(project).setContact(contact).build().toString(); + } + + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatProjectContactName(String project, String contact) { + return newBuilder().setProject(project).setContact(contact).build().toString(); + } + + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatFolderContactName(String folder, String contact) { + return newFolderContactBuilder().setFolder(folder).setContact(contact).build().toString(); + } + + @BetaApi("The static format methods are not stable yet and may be changed in the future.") + public static String formatOrganizationContactName(String organization, String contact) { + return newOrganizationContactBuilder() + .setOrganization(organization) + .setContact(contact) + .build() + .toString(); + } + + public static ContactName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + if (PROJECT_CONTACT.matches(formattedString)) { + Map matchMap = PROJECT_CONTACT.match(formattedString); + return ofProjectContactName(matchMap.get("project"), matchMap.get("contact")); + } else if (FOLDER_CONTACT.matches(formattedString)) { + Map matchMap = FOLDER_CONTACT.match(formattedString); + return ofFolderContactName(matchMap.get("folder"), matchMap.get("contact")); + } else if (ORGANIZATION_CONTACT.matches(formattedString)) { + Map matchMap = ORGANIZATION_CONTACT.match(formattedString); + return ofOrganizationContactName(matchMap.get("organization"), matchMap.get("contact")); + } + throw new ValidationException("ContactName.parse: formattedString not in valid format"); + } + + 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 (ContactName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_CONTACT.matches(formattedString) + || FOLDER_CONTACT.matches(formattedString) + || ORGANIZATION_CONTACT.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 (contact != null) { + fieldMapBuilder.put("contact", contact); + } + if (folder != null) { + fieldMapBuilder.put("folder", folder); + } + if (organization != null) { + fieldMapBuilder.put("organization", organization); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return fixedValue != null ? fixedValue : pathTemplate.instantiate(getFieldValuesMap()); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ContactName that = ((ContactName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.contact, that.contact) + && Objects.equals(this.folder, that.folder) + && Objects.equals(this.organization, that.organization); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(fixedValue); + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(contact); + h *= 1000003; + h ^= Objects.hashCode(folder); + h *= 1000003; + h ^= Objects.hashCode(organization); + return h; + } + + /** Builder for projects/{project}/contacts/{contact}. */ + public static class Builder { + private String project; + private String contact; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getContact() { + return contact; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setContact(String contact) { + this.contact = contact; + return this; + } + + private Builder(ContactName contactName) { + Preconditions.checkArgument( + Objects.equals(contactName.pathTemplate, PROJECT_CONTACT), + "toBuilder is only supported when ContactName has the pattern of projects/{project}/contacts/{contact}"); + project = contactName.project; + contact = contactName.contact; + } + + public ContactName build() { + return new ContactName(this); + } + } + + /** Builder for folders/{folder}/contacts/{contact}. */ + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static class FolderContactBuilder { + private String folder; + private String contact; + + protected FolderContactBuilder() {} + + public String getFolder() { + return folder; + } + + public String getContact() { + return contact; + } + + public FolderContactBuilder setFolder(String folder) { + this.folder = folder; + return this; + } + + public FolderContactBuilder setContact(String contact) { + this.contact = contact; + return this; + } + + public ContactName build() { + return new ContactName(this); + } + } + + /** Builder for organizations/{organization}/contacts/{contact}. */ + @BetaApi("The per-pattern Builders are not stable yet and may be changed in the future.") + public static class OrganizationContactBuilder { + private String organization; + private String contact; + + protected OrganizationContactBuilder() {} + + public String getOrganization() { + return organization; + } + + public String getContact() { + return contact; + } + + public OrganizationContactBuilder setOrganization(String organization) { + this.organization = organization; + return this; + } + + public OrganizationContactBuilder setContact(String contact) { + this.contact = contact; + return this; + } + + public ContactName build() { + return new ContactName(this); + } + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ContactOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ContactOrBuilder.java new file mode 100644 index 00000000..5ec6c0eb --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ContactOrBuilder.java @@ -0,0 +1,260 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface ContactOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.Contact) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The identifier for the contact.
+   * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The identifier for the contact.
+   * Format: {resource_type}/{resource_id}/contacts/{contact_id}
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Required. The email address to send notifications to. This does not need to
+   * be a Google account.
+   * 
+ * + * string email = 2; + * + * @return The email. + */ + java.lang.String getEmail(); + /** + * + * + *
+   * Required. The email address to send notifications to. This does not need to
+   * be a Google account.
+   * 
+ * + * string email = 2; + * + * @return The bytes for email. + */ + com.google.protobuf.ByteString getEmailBytes(); + + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return A list containing the notificationCategorySubscriptions. + */ + java.util.List + getNotificationCategorySubscriptionsList(); + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return The count of notificationCategorySubscriptions. + */ + int getNotificationCategorySubscriptionsCount(); + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param index The index of the element to return. + * @return The notificationCategorySubscriptions at the given index. + */ + com.google.cloud.essentialcontacts.v1.NotificationCategory getNotificationCategorySubscriptions( + int index); + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @return A list containing the enum numeric values on the wire for + * notificationCategorySubscriptions. + */ + java.util.List getNotificationCategorySubscriptionsValueList(); + /** + * + * + *
+   * The categories of notifications that the contact will receive
+   * communications for.
+   * 
+ * + * + * repeated .google.cloud.essentialcontacts.v1.NotificationCategory notification_category_subscriptions = 3; + * + * + * @param index The index of the value to return. + * @return The enum numeric value on the wire of notificationCategorySubscriptions at the given + * index. + */ + int getNotificationCategorySubscriptionsValue(int index); + + /** + * + * + *
+   * The preferred language for notifications, as a ISO 639-1 language code. See
+   * [Supported
+   * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+   * for a list of supported languages.
+   * 
+ * + * string language_tag = 4; + * + * @return The languageTag. + */ + java.lang.String getLanguageTag(); + /** + * + * + *
+   * The preferred language for notifications, as a ISO 639-1 language code. See
+   * [Supported
+   * languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages)
+   * for a list of supported languages.
+   * 
+ * + * string language_tag = 4; + * + * @return The bytes for languageTag. + */ + com.google.protobuf.ByteString getLanguageTagBytes(); + + /** + * + * + *
+   * The validity of the contact. A contact is considered valid if it is the
+   * correct recipient for notifications for a particular resource.
+   * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @return The enum numeric value on the wire for validationState. + */ + int getValidationStateValue(); + /** + * + * + *
+   * The validity of the contact. A contact is considered valid if it is the
+   * correct recipient for notifications for a particular resource.
+   * 
+ * + * .google.cloud.essentialcontacts.v1.ValidationState validation_state = 8; + * + * @return The validationState. + */ + com.google.cloud.essentialcontacts.v1.ValidationState getValidationState(); + + /** + * + * + *
+   * The last time the validation_state was updated, either manually or
+   * automatically. A contact is considered stale if its validation state was
+   * updated more than 1 year ago.
+   * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + * + * @return Whether the validateTime field is set. + */ + boolean hasValidateTime(); + /** + * + * + *
+   * The last time the validation_state was updated, either manually or
+   * automatically. A contact is considered stale if its validation state was
+   * updated more than 1 year ago.
+   * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + * + * @return The validateTime. + */ + com.google.protobuf.Timestamp getValidateTime(); + /** + * + * + *
+   * The last time the validation_state was updated, either manually or
+   * automatically. A contact is considered stale if its validation state was
+   * updated more than 1 year ago.
+   * 
+ * + * .google.protobuf.Timestamp validate_time = 9; + */ + com.google.protobuf.TimestampOrBuilder getValidateTimeOrBuilder(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/CreateContactRequest.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/CreateContactRequest.java new file mode 100644 index 00000000..aeaf1891 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/CreateContactRequest.java @@ -0,0 +1,979 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Request message for the CreateContact method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.CreateContactRequest} + */ +public final class CreateContactRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.CreateContactRequest) + CreateContactRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateContactRequest.newBuilder() to construct. + private CreateContactRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateContactRequest() { + parent_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateContactRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateContactRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.essentialcontacts.v1.Contact.Builder subBuilder = null; + if (contact_ != null) { + subBuilder = contact_.toBuilder(); + } + contact_ = + input.readMessage( + com.google.cloud.essentialcontacts.v1.Contact.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(contact_); + contact_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.CreateContactRequest.class, + com.google.cloud.essentialcontacts.v1.CreateContactRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The resource to save this contact for.
+   * Format: organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * 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 resource to save this contact for.
+   * Format: organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * 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 CONTACT_FIELD_NUMBER = 2; + private com.google.cloud.essentialcontacts.v1.Contact contact_; + /** + * + * + *
+   * Required. The contact to create. Must specify an email address and language
+   * tag.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the contact field is set. + */ + @java.lang.Override + public boolean hasContact() { + return contact_ != null; + } + /** + * + * + *
+   * Required. The contact to create. Must specify an email address and language
+   * tag.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The contact. + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.Contact getContact() { + return contact_ == null + ? com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance() + : contact_; + } + /** + * + * + *
+   * Required. The contact to create. Must specify an email address and language
+   * tag.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactOrBuilder() { + return getContact(); + } + + 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 (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (contact_ != null) { + output.writeMessage(2, getContact()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (contact_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getContact()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.CreateContactRequest)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.CreateContactRequest other = + (com.google.cloud.essentialcontacts.v1.CreateContactRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasContact() != other.hasContact()) return false; + if (hasContact()) { + if (!getContact().equals(other.getContact())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasContact()) { + hash = (37 * hash) + CONTACT_FIELD_NUMBER; + hash = (53 * hash) + getContact().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest 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.cloud.essentialcontacts.v1.CreateContactRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest 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.cloud.essentialcontacts.v1.CreateContactRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest 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.cloud.essentialcontacts.v1.CreateContactRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest 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.cloud.essentialcontacts.v1.CreateContactRequest 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 the CreateContact method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.CreateContactRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.CreateContactRequest) + com.google.cloud.essentialcontacts.v1.CreateContactRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.CreateContactRequest.class, + com.google.cloud.essentialcontacts.v1.CreateContactRequest.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.CreateContactRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (contactBuilder_ == null) { + contact_ = null; + } else { + contact_ = null; + contactBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.CreateContactRequest getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.CreateContactRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.CreateContactRequest build() { + com.google.cloud.essentialcontacts.v1.CreateContactRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.CreateContactRequest buildPartial() { + com.google.cloud.essentialcontacts.v1.CreateContactRequest result = + new com.google.cloud.essentialcontacts.v1.CreateContactRequest(this); + result.parent_ = parent_; + if (contactBuilder_ == null) { + result.contact_ = contact_; + } else { + result.contact_ = contactBuilder_.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.cloud.essentialcontacts.v1.CreateContactRequest) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.CreateContactRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.CreateContactRequest other) { + if (other == com.google.cloud.essentialcontacts.v1.CreateContactRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasContact()) { + mergeContact(other.getContact()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.CreateContactRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.CreateContactRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The resource to save this contact for.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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 resource to save this contact for.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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 resource to save this contact for.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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 resource to save this contact for.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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 resource to save this contact for.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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.cloud.essentialcontacts.v1.Contact contact_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder> + contactBuilder_; + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the contact field is set. + */ + public boolean hasContact() { + return contactBuilder_ != null || contact_ != null; + } + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The contact. + */ + public com.google.cloud.essentialcontacts.v1.Contact getContact() { + if (contactBuilder_ == null) { + return contact_ == null + ? com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance() + : contact_; + } else { + return contactBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setContact(com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + contact_ = value; + onChanged(); + } else { + contactBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setContact( + com.google.cloud.essentialcontacts.v1.Contact.Builder builderForValue) { + if (contactBuilder_ == null) { + contact_ = builderForValue.build(); + onChanged(); + } else { + contactBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeContact(com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactBuilder_ == null) { + if (contact_ != null) { + contact_ = + com.google.cloud.essentialcontacts.v1.Contact.newBuilder(contact_) + .mergeFrom(value) + .buildPartial(); + } else { + contact_ = value; + } + onChanged(); + } else { + contactBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearContact() { + if (contactBuilder_ == null) { + contact_ = null; + onChanged(); + } else { + contact_ = null; + contactBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.essentialcontacts.v1.Contact.Builder getContactBuilder() { + + onChanged(); + return getContactFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactOrBuilder() { + if (contactBuilder_ != null) { + return contactBuilder_.getMessageOrBuilder(); + } else { + return contact_ == null + ? com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance() + : contact_; + } + } + /** + * + * + *
+     * Required. The contact to create. Must specify an email address and language
+     * tag.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder> + getContactFieldBuilder() { + if (contactBuilder_ == null) { + contactBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder>( + getContact(), getParentForChildren(), isClean()); + contact_ = null; + } + return contactBuilder_; + } + + @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.cloud.essentialcontacts.v1.CreateContactRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.CreateContactRequest) + private static final com.google.cloud.essentialcontacts.v1.CreateContactRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.CreateContactRequest(); + } + + public static com.google.cloud.essentialcontacts.v1.CreateContactRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateContactRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateContactRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.CreateContactRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/CreateContactRequestOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/CreateContactRequestOrBuilder.java new file mode 100644 index 00000000..83bec6cb --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/CreateContactRequestOrBuilder.java @@ -0,0 +1,102 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface CreateContactRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.CreateContactRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource to save this contact for.
+   * Format: organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The resource to save this contact for.
+   * Format: organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The contact to create. Must specify an email address and language
+   * tag.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the contact field is set. + */ + boolean hasContact(); + /** + * + * + *
+   * Required. The contact to create. Must specify an email address and language
+   * tag.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The contact. + */ + com.google.cloud.essentialcontacts.v1.Contact getContact(); + /** + * + * + *
+   * Required. The contact to create. Must specify an email address and language
+   * tag.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactOrBuilder(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/DeleteContactRequest.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/DeleteContactRequest.java new file mode 100644 index 00000000..c0239045 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/DeleteContactRequest.java @@ -0,0 +1,672 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Request message for the DeleteContact method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.DeleteContactRequest} + */ +public final class DeleteContactRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.DeleteContactRequest) + DeleteContactRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteContactRequest.newBuilder() to construct. + private DeleteContactRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteContactRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteContactRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteContactRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.DeleteContactRequest.class, + com.google.cloud.essentialcontacts.v1.DeleteContactRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the contact to delete.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * 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 name of the contact to delete.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * 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 (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.DeleteContactRequest)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.DeleteContactRequest other = + (com.google.cloud.essentialcontacts.v1.DeleteContactRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest 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.cloud.essentialcontacts.v1.DeleteContactRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest 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.cloud.essentialcontacts.v1.DeleteContactRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest 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.cloud.essentialcontacts.v1.DeleteContactRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest 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.cloud.essentialcontacts.v1.DeleteContactRequest 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 the DeleteContact method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.DeleteContactRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.DeleteContactRequest) + com.google.cloud.essentialcontacts.v1.DeleteContactRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.DeleteContactRequest.class, + com.google.cloud.essentialcontacts.v1.DeleteContactRequest.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.DeleteContactRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.DeleteContactRequest getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.DeleteContactRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.DeleteContactRequest build() { + com.google.cloud.essentialcontacts.v1.DeleteContactRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.DeleteContactRequest buildPartial() { + com.google.cloud.essentialcontacts.v1.DeleteContactRequest result = + new com.google.cloud.essentialcontacts.v1.DeleteContactRequest(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.cloud.essentialcontacts.v1.DeleteContactRequest) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.DeleteContactRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.DeleteContactRequest other) { + if (other == com.google.cloud.essentialcontacts.v1.DeleteContactRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.DeleteContactRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.DeleteContactRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the contact to delete.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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 name of the contact to delete.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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 name of the contact to delete.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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 name of the contact to delete.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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 name of the contact to delete.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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.cloud.essentialcontacts.v1.DeleteContactRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.DeleteContactRequest) + private static final com.google.cloud.essentialcontacts.v1.DeleteContactRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.DeleteContactRequest(); + } + + public static com.google.cloud.essentialcontacts.v1.DeleteContactRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteContactRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteContactRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.DeleteContactRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/DeleteContactRequestOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/DeleteContactRequestOrBuilder.java new file mode 100644 index 00000000..1e0142ee --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/DeleteContactRequestOrBuilder.java @@ -0,0 +1,60 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface DeleteContactRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.DeleteContactRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the contact to delete.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the contact to delete.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/EnumsProto.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/EnumsProto.java new file mode 100644 index 00000000..b6e5f884 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/EnumsProto.java @@ -0,0 +1,61 @@ +/* + * 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/cloud/essentialcontacts/v1/enums.proto + +package com.google.cloud.essentialcontacts.v1; + +public final class EnumsProto { + private EnumsProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + 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/cloud/essentialcontacts/v1/enum" + + "s.proto\022!google.cloud.essentialcontacts." + + "v1*\271\001\n\024NotificationCategory\022%\n!NOTIFICAT" + + "ION_CATEGORY_UNSPECIFIED\020\000\022\007\n\003ALL\020\002\022\016\n\nS" + + "USPENSION\020\003\022\014\n\010SECURITY\020\005\022\r\n\tTECHNICAL\020\006" + + "\022\013\n\007BILLING\020\007\022\t\n\005LEGAL\020\010\022\023\n\017PRODUCT_UPDA" + + "TES\020\t\022\027\n\023TECHNICAL_INCIDENTS\020\n*K\n\017Valida" + + "tionState\022 \n\034VALIDATION_STATE_UNSPECIFIE" + + "D\020\000\022\t\n\005VALID\020\001\022\013\n\007INVALID\020\002B\370\001\n%com.goog" + + "le.cloud.essentialcontacts.v1B\nEnumsProt" + + "oP\001ZRgoogle.golang.org/genproto/googleap" + + "is/cloud/essentialcontacts/v1;essentialc" + + "ontacts\252\002!Google.Cloud.EssentialContacts" + + ".V1\312\002!Google\\Cloud\\EssentialContacts\\V1\352" + + "\002$Google::Cloud::EssentialContacts::V1b\006" + + "proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {}); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/FolderName.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/FolderName.java new file mode 100644 index 00000000..a34e7534 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/FolderName.java @@ -0,0 +1,168 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +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 FolderName implements ResourceName { + private static final PathTemplate FOLDER = + PathTemplate.createWithoutUrlEncoding("folders/{folder}"); + private volatile Map fieldValuesMap; + private final String folder; + + @Deprecated + protected FolderName() { + folder = null; + } + + private FolderName(Builder builder) { + folder = Preconditions.checkNotNull(builder.getFolder()); + } + + public String getFolder() { + return folder; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static FolderName of(String folder) { + return newBuilder().setFolder(folder).build(); + } + + public static String format(String folder) { + return newBuilder().setFolder(folder).build().toString(); + } + + public static FolderName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + FOLDER.validatedMatch( + formattedString, "FolderName.parse: formattedString not in valid format"); + return of(matchMap.get("folder")); + } + + 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 (FolderName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return FOLDER.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (folder != null) { + fieldMapBuilder.put("folder", folder); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return FOLDER.instantiate("folder", folder); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + FolderName that = ((FolderName) o); + return Objects.equals(this.folder, that.folder); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(folder); + return h; + } + + /** Builder for folders/{folder}. */ + public static class Builder { + private String folder; + + protected Builder() {} + + public String getFolder() { + return folder; + } + + public Builder setFolder(String folder) { + this.folder = folder; + return this; + } + + private Builder(FolderName folderName) { + folder = folderName.folder; + } + + public FolderName build() { + return new FolderName(this); + } + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/GetContactRequest.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/GetContactRequest.java new file mode 100644 index 00000000..3f423ad5 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/GetContactRequest.java @@ -0,0 +1,672 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Request message for the GetContact method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.GetContactRequest} + */ +public final class GetContactRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.GetContactRequest) + GetContactRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetContactRequest.newBuilder() to construct. + private GetContactRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetContactRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetContactRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetContactRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.GetContactRequest.class, + com.google.cloud.essentialcontacts.v1.GetContactRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the contact to retrieve.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * 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 name of the contact to retrieve.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * 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 (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.GetContactRequest)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.GetContactRequest other = + (com.google.cloud.essentialcontacts.v1.GetContactRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest 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.cloud.essentialcontacts.v1.GetContactRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest 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.cloud.essentialcontacts.v1.GetContactRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest 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.cloud.essentialcontacts.v1.GetContactRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest 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.cloud.essentialcontacts.v1.GetContactRequest 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 the GetContact method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.GetContactRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.GetContactRequest) + com.google.cloud.essentialcontacts.v1.GetContactRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.GetContactRequest.class, + com.google.cloud.essentialcontacts.v1.GetContactRequest.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.GetContactRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.GetContactRequest getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.GetContactRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.GetContactRequest build() { + com.google.cloud.essentialcontacts.v1.GetContactRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.GetContactRequest buildPartial() { + com.google.cloud.essentialcontacts.v1.GetContactRequest result = + new com.google.cloud.essentialcontacts.v1.GetContactRequest(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.cloud.essentialcontacts.v1.GetContactRequest) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.GetContactRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.GetContactRequest other) { + if (other == com.google.cloud.essentialcontacts.v1.GetContactRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.GetContactRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.GetContactRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the contact to retrieve.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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 name of the contact to retrieve.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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 name of the contact to retrieve.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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 name of the contact to retrieve.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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 name of the contact to retrieve.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * 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.cloud.essentialcontacts.v1.GetContactRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.GetContactRequest) + private static final com.google.cloud.essentialcontacts.v1.GetContactRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.GetContactRequest(); + } + + public static com.google.cloud.essentialcontacts.v1.GetContactRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetContactRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetContactRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.GetContactRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/GetContactRequestOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/GetContactRequestOrBuilder.java new file mode 100644 index 00000000..5d03d56a --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/GetContactRequestOrBuilder.java @@ -0,0 +1,60 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface GetContactRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.GetContactRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the contact to retrieve.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the contact to retrieve.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsRequest.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsRequest.java new file mode 100644 index 00000000..5de77c68 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsRequest.java @@ -0,0 +1,967 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Request message for the ListContacts method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.ListContactsRequest} + */ +public final class ListContactsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.ListContactsRequest) + ListContactsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListContactsRequest.newBuilder() to construct. + private ListContactsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListContactsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListContactsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListContactsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.ListContactsRequest.class, + com.google.cloud.essentialcontacts.v1.ListContactsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The parent resource name.
+   * Format: organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * 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 parent resource name.
+   * Format: organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * 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. The maximum number of results to return from this request.
+   * Non-positive values are ignored. The presence of `next_page_token` in the
+   * response indicates that more results might be available.
+   * If not specified, the default page_size is 100.
+   * 
+ * + * 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. If present, retrieves the next batch of results from the
+   * preceding call to this method. `page_token` must be the value of
+   * `next_page_token` from the previous response. The values of other method
+   * parameters should be identical to those in the previous call.
+   * 
+ * + * 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. If present, retrieves the next batch of results from the
+   * preceding call to this method. `page_token` must be the value of
+   * `next_page_token` from the previous response. The values of other method
+   * parameters should be identical to those in the previous call.
+   * 
+ * + * 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; + } + } + + 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 (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.ListContactsRequest)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.ListContactsRequest other = + (com.google.cloud.essentialcontacts.v1.ListContactsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest 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.cloud.essentialcontacts.v1.ListContactsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest 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.cloud.essentialcontacts.v1.ListContactsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest 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.cloud.essentialcontacts.v1.ListContactsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest 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.cloud.essentialcontacts.v1.ListContactsRequest 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 the ListContacts method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.ListContactsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.ListContactsRequest) + com.google.cloud.essentialcontacts.v1.ListContactsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.ListContactsRequest.class, + com.google.cloud.essentialcontacts.v1.ListContactsRequest.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.ListContactsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ListContactsRequest getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.ListContactsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ListContactsRequest build() { + com.google.cloud.essentialcontacts.v1.ListContactsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ListContactsRequest buildPartial() { + com.google.cloud.essentialcontacts.v1.ListContactsRequest result = + new com.google.cloud.essentialcontacts.v1.ListContactsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + 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.cloud.essentialcontacts.v1.ListContactsRequest) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.ListContactsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.ListContactsRequest other) { + if (other == com.google.cloud.essentialcontacts.v1.ListContactsRequest.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(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.ListContactsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.ListContactsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent resource name.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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 parent resource name.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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 parent resource name.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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 parent resource name.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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 parent resource name.
+     * Format: organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * 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. The maximum number of results to return from this request.
+     * Non-positive values are ignored. The presence of `next_page_token` in the
+     * response indicates that more results might be available.
+     * If not specified, the default page_size is 100.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. The maximum number of results to return from this request.
+     * Non-positive values are ignored. The presence of `next_page_token` in the
+     * response indicates that more results might be available.
+     * If not specified, the default page_size is 100.
+     * 
+ * + * 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. The maximum number of results to return from this request.
+     * Non-positive values are ignored. The presence of `next_page_token` in the
+     * response indicates that more results might be available.
+     * If not specified, the default page_size is 100.
+     * 
+ * + * 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. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * 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. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * 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. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * 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. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If present, retrieves the next batch of results from the
+     * preceding call to this method. `page_token` must be the value of
+     * `next_page_token` from the previous response. The values of other method
+     * parameters should be identical to those in the previous call.
+     * 
+ * + * 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; + } + + @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.cloud.essentialcontacts.v1.ListContactsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.ListContactsRequest) + private static final com.google.cloud.essentialcontacts.v1.ListContactsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.ListContactsRequest(); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListContactsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListContactsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ListContactsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsRequestOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsRequestOrBuilder.java new file mode 100644 index 00000000..fb569d12 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsRequestOrBuilder.java @@ -0,0 +1,105 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface ListContactsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.ListContactsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent resource name.
+   * Format: organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent resource name.
+   * Format: organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. The maximum number of results to return from this request.
+   * Non-positive values are ignored. The presence of `next_page_token` in the
+   * response indicates that more results might be available.
+   * If not specified, the default page_size is 100.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. If present, retrieves the next batch of results from the
+   * preceding call to this method. `page_token` must be the value of
+   * `next_page_token` from the previous response. The values of other method
+   * parameters should be identical to those in the previous call.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. If present, retrieves the next batch of results from the
+   * preceding call to this method. `page_token` must be the value of
+   * `next_page_token` from the previous response. The values of other method
+   * parameters should be identical to those in the previous call.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsResponse.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsResponse.java new file mode 100644 index 00000000..57e48e8b --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsResponse.java @@ -0,0 +1,1153 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Response message for the ListContacts method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.ListContactsResponse} + */ +public final class ListContactsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.ListContactsResponse) + ListContactsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListContactsResponse.newBuilder() to construct. + private ListContactsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListContactsResponse() { + contacts_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListContactsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListContactsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + contacts_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + contacts_.add( + input.readMessage( + com.google.cloud.essentialcontacts.v1.Contact.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + contacts_ = java.util.Collections.unmodifiableList(contacts_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.ListContactsResponse.class, + com.google.cloud.essentialcontacts.v1.ListContactsResponse.Builder.class); + } + + public static final int CONTACTS_FIELD_NUMBER = 1; + private java.util.List contacts_; + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public java.util.List getContactsList() { + return contacts_; + } + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public java.util.List + getContactsOrBuilderList() { + return contacts_; + } + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public int getContactsCount() { + return contacts_.size(); + } + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.Contact getContacts(int index) { + return contacts_.get(index); + } + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactsOrBuilder(int index) { + return contacts_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included. To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token` and the
+   * rest of the parameters the same as the original request.
+   * 
+ * + * 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; + } + } + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included. To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token` and the
+   * rest of the parameters the same as the original request.
+   * 
+ * + * 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 < contacts_.size(); i++) { + output.writeMessage(1, contacts_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < contacts_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, contacts_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.ListContactsResponse)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.ListContactsResponse other = + (com.google.cloud.essentialcontacts.v1.ListContactsResponse) obj; + + if (!getContactsList().equals(other.getContactsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getContactsCount() > 0) { + hash = (37 * hash) + CONTACTS_FIELD_NUMBER; + hash = (53 * hash) + getContactsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse 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.cloud.essentialcontacts.v1.ListContactsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse 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.cloud.essentialcontacts.v1.ListContactsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse 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.cloud.essentialcontacts.v1.ListContactsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse 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.cloud.essentialcontacts.v1.ListContactsResponse 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 the ListContacts method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.ListContactsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.ListContactsResponse) + com.google.cloud.essentialcontacts.v1.ListContactsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.ListContactsResponse.class, + com.google.cloud.essentialcontacts.v1.ListContactsResponse.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.ListContactsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getContactsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (contactsBuilder_ == null) { + contacts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + contactsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ListContactsResponse getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.ListContactsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ListContactsResponse build() { + com.google.cloud.essentialcontacts.v1.ListContactsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ListContactsResponse buildPartial() { + com.google.cloud.essentialcontacts.v1.ListContactsResponse result = + new com.google.cloud.essentialcontacts.v1.ListContactsResponse(this); + int from_bitField0_ = bitField0_; + if (contactsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + contacts_ = java.util.Collections.unmodifiableList(contacts_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.contacts_ = contacts_; + } else { + result.contacts_ = contactsBuilder_.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.cloud.essentialcontacts.v1.ListContactsResponse) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.ListContactsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.ListContactsResponse other) { + if (other == com.google.cloud.essentialcontacts.v1.ListContactsResponse.getDefaultInstance()) + return this; + if (contactsBuilder_ == null) { + if (!other.contacts_.isEmpty()) { + if (contacts_.isEmpty()) { + contacts_ = other.contacts_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureContactsIsMutable(); + contacts_.addAll(other.contacts_); + } + onChanged(); + } + } else { + if (!other.contacts_.isEmpty()) { + if (contactsBuilder_.isEmpty()) { + contactsBuilder_.dispose(); + contactsBuilder_ = null; + contacts_ = other.contacts_; + bitField0_ = (bitField0_ & ~0x00000001); + contactsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getContactsFieldBuilder() + : null; + } else { + contactsBuilder_.addAllMessages(other.contacts_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.ListContactsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.ListContactsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List contacts_ = + java.util.Collections.emptyList(); + + private void ensureContactsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + contacts_ = + new java.util.ArrayList(contacts_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder> + contactsBuilder_; + + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public java.util.List getContactsList() { + if (contactsBuilder_ == null) { + return java.util.Collections.unmodifiableList(contacts_); + } else { + return contactsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public int getContactsCount() { + if (contactsBuilder_ == null) { + return contacts_.size(); + } else { + return contactsBuilder_.getCount(); + } + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.Contact getContacts(int index) { + if (contactsBuilder_ == null) { + return contacts_.get(index); + } else { + return contactsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder setContacts(int index, com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContactsIsMutable(); + contacts_.set(index, value); + onChanged(); + } else { + contactsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder setContacts( + int index, com.google.cloud.essentialcontacts.v1.Contact.Builder builderForValue) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + contacts_.set(index, builderForValue.build()); + onChanged(); + } else { + contactsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addContacts(com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContactsIsMutable(); + contacts_.add(value); + onChanged(); + } else { + contactsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addContacts(int index, com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureContactsIsMutable(); + contacts_.add(index, value); + onChanged(); + } else { + contactsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addContacts( + com.google.cloud.essentialcontacts.v1.Contact.Builder builderForValue) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + contacts_.add(builderForValue.build()); + onChanged(); + } else { + contactsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addContacts( + int index, com.google.cloud.essentialcontacts.v1.Contact.Builder builderForValue) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + contacts_.add(index, builderForValue.build()); + onChanged(); + } else { + contactsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder addAllContacts( + java.lang.Iterable values) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, contacts_); + onChanged(); + } else { + contactsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder clearContacts() { + if (contactsBuilder_ == null) { + contacts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + contactsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public Builder removeContacts(int index) { + if (contactsBuilder_ == null) { + ensureContactsIsMutable(); + contacts_.remove(index); + onChanged(); + } else { + contactsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.Contact.Builder getContactsBuilder(int index) { + return getContactsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactsOrBuilder(int index) { + if (contactsBuilder_ == null) { + return contacts_.get(index); + } else { + return contactsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public java.util.List + getContactsOrBuilderList() { + if (contactsBuilder_ != null) { + return contactsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(contacts_); + } + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.Contact.Builder addContactsBuilder() { + return getContactsFieldBuilder() + .addBuilder(com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance()); + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public com.google.cloud.essentialcontacts.v1.Contact.Builder addContactsBuilder(int index) { + return getContactsFieldBuilder() + .addBuilder(index, com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance()); + } + /** + * + * + *
+     * The contacts for the specified resource.
+     * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + public java.util.List + getContactsBuilderList() { + return getContactsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder> + getContactsFieldBuilder() { + if (contactsBuilder_ == null) { + contactsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder>( + contacts_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + contacts_ = null; + } + return contactsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * 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; + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * If there are more results than those appearing in this response, then
+     * `next_page_token` is included. To get the next set of results, call this
+     * method again using the value of `next_page_token` as `page_token` and the
+     * rest of the parameters the same as the original request.
+     * 
+ * + * 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.cloud.essentialcontacts.v1.ListContactsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.ListContactsResponse) + private static final com.google.cloud.essentialcontacts.v1.ListContactsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.ListContactsResponse(); + } + + public static com.google.cloud.essentialcontacts.v1.ListContactsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListContactsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListContactsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ListContactsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsResponseOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsResponseOrBuilder.java new file mode 100644 index 00000000..be9b0e65 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ListContactsResponseOrBuilder.java @@ -0,0 +1,108 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface ListContactsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.ListContactsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + java.util.List getContactsList(); + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + com.google.cloud.essentialcontacts.v1.Contact getContacts(int index); + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + int getContactsCount(); + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + java.util.List + getContactsOrBuilderList(); + /** + * + * + *
+   * The contacts for the specified resource.
+   * 
+ * + * repeated .google.cloud.essentialcontacts.v1.Contact contacts = 1; + */ + com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactsOrBuilder(int index); + + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included. To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token` and the
+   * rest of the parameters the same as the original request.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * If there are more results than those appearing in this response, then
+   * `next_page_token` is included. To get the next set of results, call this
+   * method again using the value of `next_page_token` as `page_token` and the
+   * rest of the parameters the same as the original request.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/NotificationCategory.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/NotificationCategory.java new file mode 100644 index 00000000..ab1a48d9 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/NotificationCategory.java @@ -0,0 +1,328 @@ +/* + * 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/cloud/essentialcontacts/v1/enums.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * The notification categories that an essential contact can be subscribed to.
+ * Each notification will be categorized by the sender into one of the following
+ * categories. All contacts that are subscribed to that category will receive
+ * the notification.
+ * 
+ * + * Protobuf enum {@code google.cloud.essentialcontacts.v1.NotificationCategory} + */ +public enum NotificationCategory implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Notification category is unrecognized or unspecified.
+   * 
+ * + * NOTIFICATION_CATEGORY_UNSPECIFIED = 0; + */ + NOTIFICATION_CATEGORY_UNSPECIFIED(0), + /** + * + * + *
+   * All notifications related to the resource, including notifications
+   * pertaining to categories added in the future.
+   * 
+ * + * ALL = 2; + */ + ALL(2), + /** + * + * + *
+   * Notifications related to imminent account suspension.
+   * 
+ * + * SUSPENSION = 3; + */ + SUSPENSION(3), + /** + * + * + *
+   * Notifications related to security/privacy incidents, notifications, and
+   * vulnerabilities.
+   * 
+ * + * SECURITY = 5; + */ + SECURITY(5), + /** + * + * + *
+   * Notifications related to technical events and issues such as outages,
+   * errors, or bugs.
+   * 
+ * + * TECHNICAL = 6; + */ + TECHNICAL(6), + /** + * + * + *
+   * Notifications related to billing and payments notifications, price updates,
+   * errors, or credits.
+   * 
+ * + * BILLING = 7; + */ + BILLING(7), + /** + * + * + *
+   * Notifications related to enforcement actions, regulatory compliance, or
+   * government notices.
+   * 
+ * + * LEGAL = 8; + */ + LEGAL(8), + /** + * + * + *
+   * Notifications related to new versions, product terms updates, or
+   * deprecations.
+   * 
+ * + * PRODUCT_UPDATES = 9; + */ + PRODUCT_UPDATES(9), + /** + * + * + *
+   * Child category of TECHNICAL. If assigned, technical incident notifications
+   * will go to these contacts instead of TECHNICAL.
+   * 
+ * + * TECHNICAL_INCIDENTS = 10; + */ + TECHNICAL_INCIDENTS(10), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Notification category is unrecognized or unspecified.
+   * 
+ * + * NOTIFICATION_CATEGORY_UNSPECIFIED = 0; + */ + public static final int NOTIFICATION_CATEGORY_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * All notifications related to the resource, including notifications
+   * pertaining to categories added in the future.
+   * 
+ * + * ALL = 2; + */ + public static final int ALL_VALUE = 2; + /** + * + * + *
+   * Notifications related to imminent account suspension.
+   * 
+ * + * SUSPENSION = 3; + */ + public static final int SUSPENSION_VALUE = 3; + /** + * + * + *
+   * Notifications related to security/privacy incidents, notifications, and
+   * vulnerabilities.
+   * 
+ * + * SECURITY = 5; + */ + public static final int SECURITY_VALUE = 5; + /** + * + * + *
+   * Notifications related to technical events and issues such as outages,
+   * errors, or bugs.
+   * 
+ * + * TECHNICAL = 6; + */ + public static final int TECHNICAL_VALUE = 6; + /** + * + * + *
+   * Notifications related to billing and payments notifications, price updates,
+   * errors, or credits.
+   * 
+ * + * BILLING = 7; + */ + public static final int BILLING_VALUE = 7; + /** + * + * + *
+   * Notifications related to enforcement actions, regulatory compliance, or
+   * government notices.
+   * 
+ * + * LEGAL = 8; + */ + public static final int LEGAL_VALUE = 8; + /** + * + * + *
+   * Notifications related to new versions, product terms updates, or
+   * deprecations.
+   * 
+ * + * PRODUCT_UPDATES = 9; + */ + public static final int PRODUCT_UPDATES_VALUE = 9; + /** + * + * + *
+   * Child category of TECHNICAL. If assigned, technical incident notifications
+   * will go to these contacts instead of TECHNICAL.
+   * 
+ * + * TECHNICAL_INCIDENTS = 10; + */ + public static final int TECHNICAL_INCIDENTS_VALUE = 10; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static NotificationCategory valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static NotificationCategory forNumber(int value) { + switch (value) { + case 0: + return NOTIFICATION_CATEGORY_UNSPECIFIED; + case 2: + return ALL; + case 3: + return SUSPENSION; + case 5: + return SECURITY; + case 6: + return TECHNICAL; + case 7: + return BILLING; + case 8: + return LEGAL; + case 9: + return PRODUCT_UPDATES; + case 10: + return TECHNICAL_INCIDENTS; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public NotificationCategory findValueByNumber(int number) { + return NotificationCategory.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.EnumsProto.getDescriptor().getEnumTypes().get(0); + } + + private static final NotificationCategory[] VALUES = values(); + + public static NotificationCategory valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private NotificationCategory(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.essentialcontacts.v1.NotificationCategory) +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/OrganizationName.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/OrganizationName.java new file mode 100644 index 00000000..3e6664ac --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/OrganizationName.java @@ -0,0 +1,168 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +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 OrganizationName implements ResourceName { + private static final PathTemplate ORGANIZATION = + PathTemplate.createWithoutUrlEncoding("organizations/{organization}"); + private volatile Map fieldValuesMap; + private final String organization; + + @Deprecated + protected OrganizationName() { + organization = null; + } + + private OrganizationName(Builder builder) { + organization = Preconditions.checkNotNull(builder.getOrganization()); + } + + public String getOrganization() { + return organization; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static OrganizationName of(String organization) { + return newBuilder().setOrganization(organization).build(); + } + + public static String format(String organization) { + return newBuilder().setOrganization(organization).build().toString(); + } + + public static OrganizationName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + ORGANIZATION.validatedMatch( + formattedString, "OrganizationName.parse: formattedString not in valid format"); + return of(matchMap.get("organization")); + } + + 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 (OrganizationName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return ORGANIZATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (organization != null) { + fieldMapBuilder.put("organization", organization); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return ORGANIZATION.instantiate("organization", organization); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + OrganizationName that = ((OrganizationName) o); + return Objects.equals(this.organization, that.organization); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(organization); + return h; + } + + /** Builder for organizations/{organization}. */ + public static class Builder { + private String organization; + + protected Builder() {} + + public String getOrganization() { + return organization; + } + + public Builder setOrganization(String organization) { + this.organization = organization; + return this; + } + + private Builder(OrganizationName organizationName) { + organization = organizationName.organization; + } + + public OrganizationName build() { + return new OrganizationName(this); + } + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ProjectName.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ProjectName.java new file mode 100644 index 00000000..f18435be --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ProjectName.java @@ -0,0 +1,168 @@ +/* + * 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. + */ + +package com.google.cloud.essentialcontacts.v1; + +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 ProjectName implements ResourceName { + private static final PathTemplate PROJECT = + PathTemplate.createWithoutUrlEncoding("projects/{project}"); + private volatile Map fieldValuesMap; + private final String project; + + @Deprecated + protected ProjectName() { + project = null; + } + + private ProjectName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + } + + public String getProject() { + return project; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ProjectName of(String project) { + return newBuilder().setProject(project).build(); + } + + public static String format(String project) { + return newBuilder().setProject(project).build().toString(); + } + + public static ProjectName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT.validatedMatch( + formattedString, "ProjectName.parse: formattedString not in valid format"); + return of(matchMap.get("project")); + } + + 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 (ProjectName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT.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); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT.instantiate("project", project); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ProjectName that = ((ProjectName) o); + return Objects.equals(this.project, that.project); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + return h; + } + + /** Builder for projects/{project}. */ + public static class Builder { + private String project; + + protected Builder() {} + + public String getProject() { + return project; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + private Builder(ProjectName projectName) { + project = projectName.project; + } + + public ProjectName build() { + return new ProjectName(this); + } + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/SendTestMessageRequest.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/SendTestMessageRequest.java new file mode 100644 index 00000000..74aeb638 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/SendTestMessageRequest.java @@ -0,0 +1,1209 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Request message for the SendTestMessage method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.SendTestMessageRequest} + */ +public final class SendTestMessageRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.SendTestMessageRequest) + SendTestMessageRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use SendTestMessageRequest.newBuilder() to construct. + private SendTestMessageRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private SendTestMessageRequest() { + contacts_ = com.google.protobuf.LazyStringArrayList.EMPTY; + resource_ = ""; + notificationCategory_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new SendTestMessageRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private SendTestMessageRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + contacts_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + contacts_.add(s); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + resource_ = s; + break; + } + case 24: + { + int rawValue = input.readEnum(); + + notificationCategory_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + contacts_ = contacts_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest.class, + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest.Builder.class); + } + + public static final int CONTACTS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList contacts_; + /** + * + * + *
+   * Required. The list of names of the contacts to send a test message to.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return A list containing the contacts. + */ + public com.google.protobuf.ProtocolStringList getContactsList() { + return contacts_; + } + /** + * + * + *
+   * Required. The list of names of the contacts to send a test message to.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The count of contacts. + */ + public int getContactsCount() { + return contacts_.size(); + } + /** + * + * + *
+   * Required. The list of names of the contacts to send a test message to.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param index The index of the element to return. + * @return The contacts at the given index. + */ + public java.lang.String getContacts(int index) { + return contacts_.get(index); + } + /** + * + * + *
+   * Required. The list of names of the contacts to send a test message to.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param index The index of the value to return. + * @return The bytes of the contacts at the given index. + */ + public com.google.protobuf.ByteString getContactsBytes(int index) { + return contacts_.getByteString(index); + } + + public static final int RESOURCE_FIELD_NUMBER = 2; + private volatile java.lang.Object resource_; + /** + * + * + *
+   * Required. The name of the resource to send the test message for. All
+   * contacts must either be set directly on this resource or inherited from
+   * another resource that is an ancestor of this one. Format:
+   * organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The resource. + */ + @java.lang.Override + public java.lang.String getResource() { + java.lang.Object ref = resource_; + 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(); + resource_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the resource to send the test message for. All
+   * contacts must either be set directly on this resource or inherited from
+   * another resource that is an ancestor of this one. Format:
+   * organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for resource. + */ + @java.lang.Override + public com.google.protobuf.ByteString getResourceBytes() { + java.lang.Object ref = resource_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NOTIFICATION_CATEGORY_FIELD_NUMBER = 3; + private int notificationCategory_; + /** + * + * + *
+   * Required. The notification category to send the test message for. All
+   * contacts must be subscribed to this category.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for notificationCategory. + */ + @java.lang.Override + public int getNotificationCategoryValue() { + return notificationCategory_; + } + /** + * + * + *
+   * Required. The notification category to send the test message for. All
+   * contacts must be subscribed to this category.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The notificationCategory. + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.NotificationCategory getNotificationCategory() { + @SuppressWarnings("deprecation") + com.google.cloud.essentialcontacts.v1.NotificationCategory result = + com.google.cloud.essentialcontacts.v1.NotificationCategory.valueOf(notificationCategory_); + return result == null + ? com.google.cloud.essentialcontacts.v1.NotificationCategory.UNRECOGNIZED + : result; + } + + 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 < contacts_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, contacts_.getRaw(i)); + } + if (!getResourceBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, resource_); + } + if (notificationCategory_ + != com.google.cloud.essentialcontacts.v1.NotificationCategory + .NOTIFICATION_CATEGORY_UNSPECIFIED + .getNumber()) { + output.writeEnum(3, notificationCategory_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < contacts_.size(); i++) { + dataSize += computeStringSizeNoTag(contacts_.getRaw(i)); + } + size += dataSize; + size += 1 * getContactsList().size(); + } + if (!getResourceBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, resource_); + } + if (notificationCategory_ + != com.google.cloud.essentialcontacts.v1.NotificationCategory + .NOTIFICATION_CATEGORY_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, notificationCategory_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.SendTestMessageRequest)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest other = + (com.google.cloud.essentialcontacts.v1.SendTestMessageRequest) obj; + + if (!getContactsList().equals(other.getContactsList())) return false; + if (!getResource().equals(other.getResource())) return false; + if (notificationCategory_ != other.notificationCategory_) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getContactsCount() > 0) { + hash = (37 * hash) + CONTACTS_FIELD_NUMBER; + hash = (53 * hash) + getContactsList().hashCode(); + } + hash = (37 * hash) + RESOURCE_FIELD_NUMBER; + hash = (53 * hash) + getResource().hashCode(); + hash = (37 * hash) + NOTIFICATION_CATEGORY_FIELD_NUMBER; + hash = (53 * hash) + notificationCategory_; + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest 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.cloud.essentialcontacts.v1.SendTestMessageRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest 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.cloud.essentialcontacts.v1.SendTestMessageRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest 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.cloud.essentialcontacts.v1.SendTestMessageRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest 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.cloud.essentialcontacts.v1.SendTestMessageRequest 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 the SendTestMessage method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.SendTestMessageRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.SendTestMessageRequest) + com.google.cloud.essentialcontacts.v1.SendTestMessageRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest.class, + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.SendTestMessageRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + contacts_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + resource_ = ""; + + notificationCategory_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.SendTestMessageRequest + getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.SendTestMessageRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.SendTestMessageRequest build() { + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.SendTestMessageRequest buildPartial() { + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest result = + new com.google.cloud.essentialcontacts.v1.SendTestMessageRequest(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + contacts_ = contacts_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.contacts_ = contacts_; + result.resource_ = resource_; + result.notificationCategory_ = notificationCategory_; + 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.cloud.essentialcontacts.v1.SendTestMessageRequest) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.SendTestMessageRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.SendTestMessageRequest other) { + if (other + == com.google.cloud.essentialcontacts.v1.SendTestMessageRequest.getDefaultInstance()) + return this; + if (!other.contacts_.isEmpty()) { + if (contacts_.isEmpty()) { + contacts_ = other.contacts_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureContactsIsMutable(); + contacts_.addAll(other.contacts_); + } + onChanged(); + } + if (!other.getResource().isEmpty()) { + resource_ = other.resource_; + onChanged(); + } + if (other.notificationCategory_ != 0) { + setNotificationCategoryValue(other.getNotificationCategoryValue()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.SendTestMessageRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.SendTestMessageRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList contacts_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureContactsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + contacts_ = new com.google.protobuf.LazyStringArrayList(contacts_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return A list containing the contacts. + */ + public com.google.protobuf.ProtocolStringList getContactsList() { + return contacts_.getUnmodifiableView(); + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The count of contacts. + */ + public int getContactsCount() { + return contacts_.size(); + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param index The index of the element to return. + * @return The contacts at the given index. + */ + public java.lang.String getContacts(int index) { + return contacts_.get(index); + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param index The index of the value to return. + * @return The bytes of the contacts at the given index. + */ + public com.google.protobuf.ByteString getContactsBytes(int index) { + return contacts_.getByteString(index); + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param index The index to set the value at. + * @param value The contacts to set. + * @return This builder for chaining. + */ + public Builder setContacts(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureContactsIsMutable(); + contacts_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The contacts to add. + * @return This builder for chaining. + */ + public Builder addContacts(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureContactsIsMutable(); + contacts_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param values The contacts to add. + * @return This builder for chaining. + */ + public Builder addAllContacts(java.lang.Iterable values) { + ensureContactsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, contacts_); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearContacts() { + contacts_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The list of names of the contacts to send a test message to.
+     * Format: organizations/{organization_id}/contacts/{contact_id},
+     * folders/{folder_id}/contacts/{contact_id} or
+     * projects/{project_id}/contacts/{contact_id}
+     * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes of the contacts to add. + * @return This builder for chaining. + */ + public Builder addContactsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureContactsIsMutable(); + contacts_.add(value); + onChanged(); + return this; + } + + private java.lang.Object resource_ = ""; + /** + * + * + *
+     * Required. The name of the resource to send the test message for. All
+     * contacts must either be set directly on this resource or inherited from
+     * another resource that is an ancestor of this one. Format:
+     * organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The resource. + */ + public java.lang.String getResource() { + java.lang.Object ref = resource_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resource_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the resource to send the test message for. All
+     * contacts must either be set directly on this resource or inherited from
+     * another resource that is an ancestor of this one. Format:
+     * organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for resource. + */ + public com.google.protobuf.ByteString getResourceBytes() { + java.lang.Object ref = resource_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resource_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the resource to send the test message for. All
+     * contacts must either be set directly on this resource or inherited from
+     * another resource that is an ancestor of this one. Format:
+     * organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The resource to set. + * @return This builder for chaining. + */ + public Builder setResource(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + resource_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the resource to send the test message for. All
+     * contacts must either be set directly on this resource or inherited from
+     * another resource that is an ancestor of this one. Format:
+     * organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearResource() { + + resource_ = getDefaultInstance().getResource(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the resource to send the test message for. All
+     * contacts must either be set directly on this resource or inherited from
+     * another resource that is an ancestor of this one. Format:
+     * organizations/{organization_id}, folders/{folder_id} or
+     * projects/{project_id}
+     * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for resource to set. + * @return This builder for chaining. + */ + public Builder setResourceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + resource_ = value; + onChanged(); + return this; + } + + private int notificationCategory_ = 0; + /** + * + * + *
+     * Required. The notification category to send the test message for. All
+     * contacts must be subscribed to this category.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for notificationCategory. + */ + @java.lang.Override + public int getNotificationCategoryValue() { + return notificationCategory_; + } + /** + * + * + *
+     * Required. The notification category to send the test message for. All
+     * contacts must be subscribed to this category.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The enum numeric value on the wire for notificationCategory to set. + * @return This builder for chaining. + */ + public Builder setNotificationCategoryValue(int value) { + + notificationCategory_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The notification category to send the test message for. All
+     * contacts must be subscribed to this category.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The notificationCategory. + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.NotificationCategory getNotificationCategory() { + @SuppressWarnings("deprecation") + com.google.cloud.essentialcontacts.v1.NotificationCategory result = + com.google.cloud.essentialcontacts.v1.NotificationCategory.valueOf(notificationCategory_); + return result == null + ? com.google.cloud.essentialcontacts.v1.NotificationCategory.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Required. The notification category to send the test message for. All
+     * contacts must be subscribed to this category.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @param value The notificationCategory to set. + * @return This builder for chaining. + */ + public Builder setNotificationCategory( + com.google.cloud.essentialcontacts.v1.NotificationCategory value) { + if (value == null) { + throw new NullPointerException(); + } + + notificationCategory_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The notification category to send the test message for. All
+     * contacts must be subscribed to this category.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return This builder for chaining. + */ + public Builder clearNotificationCategory() { + + notificationCategory_ = 0; + 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.cloud.essentialcontacts.v1.SendTestMessageRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.SendTestMessageRequest) + private static final com.google.cloud.essentialcontacts.v1.SendTestMessageRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.SendTestMessageRequest(); + } + + public static com.google.cloud.essentialcontacts.v1.SendTestMessageRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SendTestMessageRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SendTestMessageRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.SendTestMessageRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/SendTestMessageRequestOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/SendTestMessageRequestOrBuilder.java new file mode 100644 index 00000000..02b73f21 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/SendTestMessageRequestOrBuilder.java @@ -0,0 +1,164 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface SendTestMessageRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.SendTestMessageRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The list of names of the contacts to send a test message to.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return A list containing the contacts. + */ + java.util.List getContactsList(); + /** + * + * + *
+   * Required. The list of names of the contacts to send a test message to.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The count of contacts. + */ + int getContactsCount(); + /** + * + * + *
+   * Required. The list of names of the contacts to send a test message to.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param index The index of the element to return. + * @return The contacts at the given index. + */ + java.lang.String getContacts(int index); + /** + * + * + *
+   * Required. The list of names of the contacts to send a test message to.
+   * Format: organizations/{organization_id}/contacts/{contact_id},
+   * folders/{folder_id}/contacts/{contact_id} or
+   * projects/{project_id}/contacts/{contact_id}
+   * 
+ * + * + * repeated string contacts = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param index The index of the value to return. + * @return The bytes of the contacts at the given index. + */ + com.google.protobuf.ByteString getContactsBytes(int index); + + /** + * + * + *
+   * Required. The name of the resource to send the test message for. All
+   * contacts must either be set directly on this resource or inherited from
+   * another resource that is an ancestor of this one. Format:
+   * organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The resource. + */ + java.lang.String getResource(); + /** + * + * + *
+   * Required. The name of the resource to send the test message for. All
+   * contacts must either be set directly on this resource or inherited from
+   * another resource that is an ancestor of this one. Format:
+   * organizations/{organization_id}, folders/{folder_id} or
+   * projects/{project_id}
+   * 
+ * + * + * string resource = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for resource. + */ + com.google.protobuf.ByteString getResourceBytes(); + + /** + * + * + *
+   * Required. The notification category to send the test message for. All
+   * contacts must be subscribed to this category.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The enum numeric value on the wire for notificationCategory. + */ + int getNotificationCategoryValue(); + /** + * + * + *
+   * Required. The notification category to send the test message for. All
+   * contacts must be subscribed to this category.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.NotificationCategory notification_category = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The notificationCategory. + */ + com.google.cloud.essentialcontacts.v1.NotificationCategory getNotificationCategory(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/Service.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/Service.java new file mode 100644 index 00000000..17ab0cce --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/Service.java @@ -0,0 +1,310 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public final class Service { + private Service() {} + + 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_cloud_essentialcontacts_v1_Contact_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_Contact_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_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/cloud/essentialcontacts/v1/serv" + + "ice.proto\022!google.cloud.essentialcontact" + + "s.v1\032\034google/api/annotations.proto\032\027goog" + + "le/api/client.proto\032\037google/api/field_be" + + "havior.proto\032\031google/api/resource.proto\032" + + "-google/cloud/essentialcontacts/v1/enums" + + ".proto\032\033google/protobuf/empty.proto\032 goo" + + "gle/protobuf/field_mask.proto\032\037google/pr" + + "otobuf/timestamp.proto\"\321\003\n\007Contact\022\014\n\004na" + + "me\030\001 \001(\t\022\r\n\005email\030\002 \001(\t\022d\n#notification_" + + "category_subscriptions\030\003 \003(\01627.google.cl" + + "oud.essentialcontacts.v1.NotificationCat" + + "egory\022\024\n\014language_tag\030\004 \001(\t\022L\n\020validatio" + + "n_state\030\010 \001(\01622.google.cloud.essentialco" + + "ntacts.v1.ValidationState\0221\n\rvalidate_ti" + + "me\030\t \001(\0132\032.google.protobuf.Timestamp:\253\001\352" + + "A\247\001\n(essentialcontacts.googleapis.com/Co" + + "ntact\022%projects/{project}/contacts/{cont" + + "act}\022#folders/{folder}/contacts/{contact" + + "}\022/organizations/{organization}/contacts" + + "/{contact}\"\210\001\n\023ListContactsRequest\022@\n\006pa" + + "rent\030\001 \001(\tB0\340A\002\372A*\022(essentialcontacts.go" + + "ogleapis.com/Contact\022\026\n\tpage_size\030\002 \001(\005B" + + "\003\340A\001\022\027\n\npage_token\030\003 \001(\tB\003\340A\001\"m\n\024ListCon" + + "tactsResponse\022<\n\010contacts\030\001 \003(\0132*.google" + + ".cloud.essentialcontacts.v1.Contact\022\027\n\017n" + + "ext_page_token\030\002 \001(\t\"S\n\021GetContactReques" + + "t\022>\n\004name\030\001 \001(\tB0\340A\002\372A*\n(essentialcontac" + + "ts.googleapis.com/Contact\"V\n\024DeleteConta" + + "ctRequest\022>\n\004name\030\001 \001(\tB0\340A\002\372A*\n(essenti" + + "alcontacts.googleapis.com/Contact\"\232\001\n\024Cr" + + "eateContactRequest\022@\n\006parent\030\001 \001(\tB0\340A\002\372" + + "A*\022(essentialcontacts.googleapis.com/Con" + + "tact\022@\n\007contact\030\002 \001(\0132*.google.cloud.ess" + + "entialcontacts.v1.ContactB\003\340A\002\"\216\001\n\024Updat" + + "eContactRequest\022@\n\007contact\030\002 \001(\0132*.googl" + + "e.cloud.essentialcontacts.v1.ContactB\003\340A" + + "\002\0224\n\013update_mask\030\003 \001(\0132\032.google.protobuf" + + ".FieldMaskB\003\340A\001\"\345\001\n\026ComputeContactsReque" + + "st\022@\n\006parent\030\001 \001(\tB0\340A\002\372A*\022(essentialcon" + + "tacts.googleapis.com/Contact\022X\n\027notifica" + + "tion_categories\030\006 \003(\01627.google.cloud.ess" + + "entialcontacts.v1.NotificationCategory\022\026" + + "\n\tpage_size\030\003 \001(\005B\003\340A\001\022\027\n\npage_token\030\004 \001" + + "(\tB\003\340A\001\"p\n\027ComputeContactsResponse\022<\n\010co" + + "ntacts\030\001 \003(\0132*.google.cloud.essentialcon" + + "tacts.v1.Contact\022\027\n\017next_page_token\030\002 \001(" + + "\t\"\375\001\n\026SendTestMessageRequest\022B\n\010contacts" + + "\030\001 \003(\tB0\340A\002\372A*\n(essentialcontacts.google" + + "apis.com/Contact\022B\n\010resource\030\002 \001(\tB0\340A\002\372" + + "A*\022(essentialcontacts.googleapis.com/Con" + + "tact\022[\n\025notification_category\030\003 \001(\01627.go" + + "ogle.cloud.essentialcontacts.v1.Notifica" + + "tionCategoryB\003\340A\0022\313\017\n\030EssentialContactsS" + + "ervice\022\230\002\n\rCreateContact\0227.google.cloud." + + "essentialcontacts.v1.CreateContactReques" + + "t\032*.google.cloud.essentialcontacts.v1.Co" + + "ntact\"\241\001\202\323\344\223\002\211\001\" /v1/{parent=projects/*}" + + "/contacts:\007contactZ*\"\037/v1/{parent=folder" + + "s/*}/contacts:\007contactZ0\"%/v1/{parent=or" + + "ganizations/*}/contacts:\007contact\332A\016paren" + + "t,contact\022\265\002\n\rUpdateContact\0227.google.clo" + + "ud.essentialcontacts.v1.UpdateContactReq" + + "uest\032*.google.cloud.essentialcontacts.v1" + + ".Contact\"\276\001\202\323\344\223\002\241\0012(/v1/{contact.name=pr" + + "ojects/*/contacts/*}:\007contactZ22\'/v1/{co" + + "ntact.name=folders/*/contacts/*}:\007contac" + + "tZ82-/v1/{contact.name=organizations/*/c" + + "ontacts/*}:\007contact\332A\023contact,update_mas" + + "k\022\376\001\n\014ListContacts\0226.google.cloud.essent" + + "ialcontacts.v1.ListContactsRequest\0327.goo" + + "gle.cloud.essentialcontacts.v1.ListConta" + + "ctsResponse\"}\202\323\344\223\002n\022 /v1/{parent=project" + + "s/*}/contactsZ!\022\037/v1/{parent=folders/*}/" + + "contactsZ\'\022%/v1/{parent=organizations/*}" + + "/contacts\332A\006parent\022\353\001\n\nGetContact\0224.goog" + + "le.cloud.essentialcontacts.v1.GetContact" + + "Request\032*.google.cloud.essentialcontacts" + + ".v1.Contact\"{\202\323\344\223\002n\022 /v1/{name=projects/" + + "*/contacts/*}Z!\022\037/v1/{name=folders/*/con" + + "tacts/*}Z\'\022%/v1/{name=organizations/*/co" + + "ntacts/*}\332A\004name\022\335\001\n\rDeleteContact\0227.goo" + + "gle.cloud.essentialcontacts.v1.DeleteCon" + + "tactRequest\032\026.google.protobuf.Empty\"{\202\323\344" + + "\223\002n* /v1/{name=projects/*/contacts/*}Z!*" + + "\037/v1/{name=folders/*/contacts/*}Z\'*%/v1/" + + "{name=organizations/*/contacts/*}\332A\004name" + + "\022\230\002\n\017ComputeContacts\0229.google.cloud.esse" + + "ntialcontacts.v1.ComputeContactsRequest\032" + + ":.google.cloud.essentialcontacts.v1.Comp" + + "uteContactsResponse\"\215\001\202\323\344\223\002\206\001\022(/v1/{pare" + + "nt=projects/*}/contacts:computeZ)\022\'/v1/{" + + "parent=folders/*}/contacts:computeZ/\022-/v" + + "1/{parent=organizations/*}/contacts:comp" + + "ute\022\233\002\n\017SendTestMessage\0229.google.cloud.e" + + "ssentialcontacts.v1.SendTestMessageReque" + + "st\032\026.google.protobuf.Empty\"\264\001\202\323\344\223\002\255\001\"2/v" + + "1/{resource=projects/*}/contacts:sendTes" + + "tMessage:\001*Z6\"1/v1/{resource=folders/*}/" + + "contacts:sendTestMessage:\001*Z<\"7/v1/{reso" + + "urce=organizations/*}/contacts:sendTestM" + + "essage:\001*\032T\312A essentialcontacts.googleap" + + "is.com\322A.https://www.googleapis.com/auth" + + "/cloud-platformB\354\001\n%com.google.cloud.ess" + + "entialcontacts.v1P\001ZRgoogle.golang.org/g" + + "enproto/googleapis/cloud/essentialcontac" + + "ts/v1;essentialcontacts\252\002!Google.Cloud.E" + + "ssentialContacts.V1\312\002!Google\\Cloud\\Essen" + + "tialContacts\\V1\352\002$Google::Cloud::Essenti" + + "alContacts::V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.essentialcontacts.v1.EnumsProto.getDescriptor(), + com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_cloud_essentialcontacts_v1_Contact_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_essentialcontacts_v1_Contact_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_Contact_descriptor, + new java.lang.String[] { + "Name", + "Email", + "NotificationCategorySubscriptions", + "LanguageTag", + "ValidationState", + "ValidateTime", + }); + internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_ListContactsRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", + }); + internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_ListContactsResponse_descriptor, + new java.lang.String[] { + "Contacts", "NextPageToken", + }); + internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_GetContactRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_DeleteContactRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_CreateContactRequest_descriptor, + new java.lang.String[] { + "Parent", "Contact", + }); + internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_descriptor, + new java.lang.String[] { + "Contact", "UpdateMask", + }); + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsRequest_descriptor, + new java.lang.String[] { + "Parent", "NotificationCategories", "PageSize", "PageToken", + }); + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_ComputeContactsResponse_descriptor, + new java.lang.String[] { + "Contacts", "NextPageToken", + }); + internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_essentialcontacts_v1_SendTestMessageRequest_descriptor, + new java.lang.String[] { + "Contacts", "Resource", "NotificationCategory", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.essentialcontacts.v1.EnumsProto.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/UpdateContactRequest.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/UpdateContactRequest.java new file mode 100644 index 00000000..6cf7d484 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/UpdateContactRequest.java @@ -0,0 +1,1079 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * Request message for the UpdateContact method.
+ * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.UpdateContactRequest} + */ +public final class UpdateContactRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.essentialcontacts.v1.UpdateContactRequest) + UpdateContactRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateContactRequest.newBuilder() to construct. + private UpdateContactRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateContactRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateContactRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateContactRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 18: + { + com.google.cloud.essentialcontacts.v1.Contact.Builder subBuilder = null; + if (contact_ != null) { + subBuilder = contact_.toBuilder(); + } + contact_ = + input.readMessage( + com.google.cloud.essentialcontacts.v1.Contact.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(contact_); + contact_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.UpdateContactRequest.class, + com.google.cloud.essentialcontacts.v1.UpdateContactRequest.Builder.class); + } + + public static final int CONTACT_FIELD_NUMBER = 2; + private com.google.cloud.essentialcontacts.v1.Contact contact_; + /** + * + * + *
+   * Required. The contact resource to replace the existing saved contact. Note:
+   * the email address of the contact cannot be modified.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the contact field is set. + */ + @java.lang.Override + public boolean hasContact() { + return contact_ != null; + } + /** + * + * + *
+   * Required. The contact resource to replace the existing saved contact. Note:
+   * the email address of the contact cannot be modified.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The contact. + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.Contact getContact() { + return contact_ == null + ? com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance() + : contact_; + } + /** + * + * + *
+   * Required. The contact resource to replace the existing saved contact. Note:
+   * the email address of the contact cannot be modified.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactOrBuilder() { + return getContact(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 3; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Optional. The update mask applied to the resource. For the `FieldMask`
+   * definition, see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Optional. The update mask applied to the resource. For the `FieldMask`
+   * definition, see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Optional. The update mask applied to the resource. For the `FieldMask`
+   * definition, see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @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 (contact_ != null) { + output.writeMessage(2, getContact()); + } + if (updateMask_ != null) { + output.writeMessage(3, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (contact_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getContact()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.essentialcontacts.v1.UpdateContactRequest)) { + return super.equals(obj); + } + com.google.cloud.essentialcontacts.v1.UpdateContactRequest other = + (com.google.cloud.essentialcontacts.v1.UpdateContactRequest) obj; + + if (hasContact() != other.hasContact()) return false; + if (hasContact()) { + if (!getContact().equals(other.getContact())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasContact()) { + hash = (37 * hash) + CONTACT_FIELD_NUMBER; + hash = (53 * hash) + getContact().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest 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.cloud.essentialcontacts.v1.UpdateContactRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest 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.cloud.essentialcontacts.v1.UpdateContactRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest 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.cloud.essentialcontacts.v1.UpdateContactRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest 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.cloud.essentialcontacts.v1.UpdateContactRequest 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 the UpdateContact method.
+   * 
+ * + * Protobuf type {@code google.cloud.essentialcontacts.v1.UpdateContactRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.essentialcontacts.v1.UpdateContactRequest) + com.google.cloud.essentialcontacts.v1.UpdateContactRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.essentialcontacts.v1.UpdateContactRequest.class, + com.google.cloud.essentialcontacts.v1.UpdateContactRequest.Builder.class); + } + + // Construct using com.google.cloud.essentialcontacts.v1.UpdateContactRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (contactBuilder_ == null) { + contact_ = null; + } else { + contact_ = null; + contactBuilder_ = 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.cloud.essentialcontacts.v1.Service + .internal_static_google_cloud_essentialcontacts_v1_UpdateContactRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.UpdateContactRequest getDefaultInstanceForType() { + return com.google.cloud.essentialcontacts.v1.UpdateContactRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.UpdateContactRequest build() { + com.google.cloud.essentialcontacts.v1.UpdateContactRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.UpdateContactRequest buildPartial() { + com.google.cloud.essentialcontacts.v1.UpdateContactRequest result = + new com.google.cloud.essentialcontacts.v1.UpdateContactRequest(this); + if (contactBuilder_ == null) { + result.contact_ = contact_; + } else { + result.contact_ = contactBuilder_.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.cloud.essentialcontacts.v1.UpdateContactRequest) { + return mergeFrom((com.google.cloud.essentialcontacts.v1.UpdateContactRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.essentialcontacts.v1.UpdateContactRequest other) { + if (other == com.google.cloud.essentialcontacts.v1.UpdateContactRequest.getDefaultInstance()) + return this; + if (other.hasContact()) { + mergeContact(other.getContact()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.essentialcontacts.v1.UpdateContactRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.essentialcontacts.v1.UpdateContactRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.essentialcontacts.v1.Contact contact_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder> + contactBuilder_; + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the contact field is set. + */ + public boolean hasContact() { + return contactBuilder_ != null || contact_ != null; + } + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The contact. + */ + public com.google.cloud.essentialcontacts.v1.Contact getContact() { + if (contactBuilder_ == null) { + return contact_ == null + ? com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance() + : contact_; + } else { + return contactBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setContact(com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + contact_ = value; + onChanged(); + } else { + contactBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setContact( + com.google.cloud.essentialcontacts.v1.Contact.Builder builderForValue) { + if (contactBuilder_ == null) { + contact_ = builderForValue.build(); + onChanged(); + } else { + contactBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeContact(com.google.cloud.essentialcontacts.v1.Contact value) { + if (contactBuilder_ == null) { + if (contact_ != null) { + contact_ = + com.google.cloud.essentialcontacts.v1.Contact.newBuilder(contact_) + .mergeFrom(value) + .buildPartial(); + } else { + contact_ = value; + } + onChanged(); + } else { + contactBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearContact() { + if (contactBuilder_ == null) { + contact_ = null; + onChanged(); + } else { + contact_ = null; + contactBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.essentialcontacts.v1.Contact.Builder getContactBuilder() { + + onChanged(); + return getContactFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactOrBuilder() { + if (contactBuilder_ != null) { + return contactBuilder_.getMessageOrBuilder(); + } else { + return contact_ == null + ? com.google.cloud.essentialcontacts.v1.Contact.getDefaultInstance() + : contact_; + } + } + /** + * + * + *
+     * Required. The contact resource to replace the existing saved contact. Note:
+     * the email address of the contact cannot be modified.
+     * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder> + getContactFieldBuilder() { + if (contactBuilder_ == null) { + contactBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.essentialcontacts.v1.Contact, + com.google.cloud.essentialcontacts.v1.Contact.Builder, + com.google.cloud.essentialcontacts.v1.ContactOrBuilder>( + getContact(), getParentForChildren(), isClean()); + contact_ = null; + } + return contactBuilder_; + } + + 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_; + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @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(); + } + } + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + 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; + } + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + 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; + } + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Optional. The update mask applied to the resource. For the `FieldMask`
+     * definition, see
+     * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + 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.cloud.essentialcontacts.v1.UpdateContactRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.essentialcontacts.v1.UpdateContactRequest) + private static final com.google.cloud.essentialcontacts.v1.UpdateContactRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.essentialcontacts.v1.UpdateContactRequest(); + } + + public static com.google.cloud.essentialcontacts.v1.UpdateContactRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateContactRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateContactRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.essentialcontacts.v1.UpdateContactRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/UpdateContactRequestOrBuilder.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/UpdateContactRequestOrBuilder.java new file mode 100644 index 00000000..c378a7e1 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/UpdateContactRequestOrBuilder.java @@ -0,0 +1,113 @@ +/* + * 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/cloud/essentialcontacts/v1/service.proto + +package com.google.cloud.essentialcontacts.v1; + +public interface UpdateContactRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.essentialcontacts.v1.UpdateContactRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The contact resource to replace the existing saved contact. Note:
+   * the email address of the contact cannot be modified.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the contact field is set. + */ + boolean hasContact(); + /** + * + * + *
+   * Required. The contact resource to replace the existing saved contact. Note:
+   * the email address of the contact cannot be modified.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The contact. + */ + com.google.cloud.essentialcontacts.v1.Contact getContact(); + /** + * + * + *
+   * Required. The contact resource to replace the existing saved contact. Note:
+   * the email address of the contact cannot be modified.
+   * 
+ * + * + * .google.cloud.essentialcontacts.v1.Contact contact = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.essentialcontacts.v1.ContactOrBuilder getContactOrBuilder(); + + /** + * + * + *
+   * Optional. The update mask applied to the resource. For the `FieldMask`
+   * definition, see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Optional. The update mask applied to the resource. For the `FieldMask`
+   * definition, see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Optional. The update mask applied to the resource. For the `FieldMask`
+   * definition, see
+   * https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ValidationState.java b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ValidationState.java new file mode 100644 index 00000000..b17553fa --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/java/com/google/cloud/essentialcontacts/v1/ValidationState.java @@ -0,0 +1,181 @@ +/* + * 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/cloud/essentialcontacts/v1/enums.proto + +package com.google.cloud.essentialcontacts.v1; + +/** + * + * + *
+ * A contact's validation state indicates whether or not it is the correct
+ * contact to be receiving notifications for a particular resource.
+ * 
+ * + * Protobuf enum {@code google.cloud.essentialcontacts.v1.ValidationState} + */ +public enum ValidationState implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * The validation state is unknown or unspecified.
+   * 
+ * + * VALIDATION_STATE_UNSPECIFIED = 0; + */ + VALIDATION_STATE_UNSPECIFIED(0), + /** + * + * + *
+   * The contact is marked as valid. This is usually done manually by the
+   * contact admin. All new contacts begin in the valid state.
+   * 
+ * + * VALID = 1; + */ + VALID(1), + /** + * + * + *
+   * The contact is considered invalid. This may become the state if the
+   * contact's email is found to be unreachable.
+   * 
+ * + * INVALID = 2; + */ + INVALID(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * The validation state is unknown or unspecified.
+   * 
+ * + * VALIDATION_STATE_UNSPECIFIED = 0; + */ + public static final int VALIDATION_STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * The contact is marked as valid. This is usually done manually by the
+   * contact admin. All new contacts begin in the valid state.
+   * 
+ * + * VALID = 1; + */ + public static final int VALID_VALUE = 1; + /** + * + * + *
+   * The contact is considered invalid. This may become the state if the
+   * contact's email is found to be unreachable.
+   * 
+ * + * INVALID = 2; + */ + public static final int INVALID_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ValidationState valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static ValidationState forNumber(int value) { + switch (value) { + case 0: + return VALIDATION_STATE_UNSPECIFIED; + case 1: + return VALID; + case 2: + return INVALID; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ValidationState findValueByNumber(int number) { + return ValidationState.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.essentialcontacts.v1.EnumsProto.getDescriptor().getEnumTypes().get(1); + } + + private static final ValidationState[] VALUES = values(); + + public static ValidationState valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private ValidationState(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.essentialcontacts.v1.ValidationState) +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/proto/google/cloud/essentialcontacts/v1/enums.proto b/proto-google-cloud-essential-contacts-v1/src/main/proto/google/cloud/essentialcontacts/v1/enums.proto new file mode 100644 index 00000000..6fcdeb37 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/proto/google/cloud/essentialcontacts/v1/enums.proto @@ -0,0 +1,80 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.essentialcontacts.v1; + +option go_package = "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1;essentialcontacts"; +option java_multiple_files = true; +option java_outer_classname = "EnumsProto"; +option java_package = "com.google.cloud.essentialcontacts.v1"; +option csharp_namespace = "Google.Cloud.EssentialContacts.V1"; +option php_namespace = "Google\\Cloud\\EssentialContacts\\V1"; +option ruby_package = "Google::Cloud::EssentialContacts::V1"; + +// The notification categories that an essential contact can be subscribed to. +// Each notification will be categorized by the sender into one of the following +// categories. All contacts that are subscribed to that category will receive +// the notification. +enum NotificationCategory { + // Notification category is unrecognized or unspecified. + NOTIFICATION_CATEGORY_UNSPECIFIED = 0; + + // All notifications related to the resource, including notifications + // pertaining to categories added in the future. + ALL = 2; + + // Notifications related to imminent account suspension. + SUSPENSION = 3; + + // Notifications related to security/privacy incidents, notifications, and + // vulnerabilities. + SECURITY = 5; + + // Notifications related to technical events and issues such as outages, + // errors, or bugs. + TECHNICAL = 6; + + // Notifications related to billing and payments notifications, price updates, + // errors, or credits. + BILLING = 7; + + // Notifications related to enforcement actions, regulatory compliance, or + // government notices. + LEGAL = 8; + + // Notifications related to new versions, product terms updates, or + // deprecations. + PRODUCT_UPDATES = 9; + + // Child category of TECHNICAL. If assigned, technical incident notifications + // will go to these contacts instead of TECHNICAL. + TECHNICAL_INCIDENTS = 10; +} + +// A contact's validation state indicates whether or not it is the correct +// contact to be receiving notifications for a particular resource. +enum ValidationState { + // The validation state is unknown or unspecified. + VALIDATION_STATE_UNSPECIFIED = 0; + + // The contact is marked as valid. This is usually done manually by the + // contact admin. All new contacts begin in the valid state. + VALID = 1; + + // The contact is considered invalid. This may become the state if the + // contact's email is found to be unreachable. + INVALID = 2; +} diff --git a/proto-google-cloud-essential-contacts-v1/src/main/proto/google/cloud/essentialcontacts/v1/service.proto b/proto-google-cloud-essential-contacts-v1/src/main/proto/google/cloud/essentialcontacts/v1/service.proto new file mode 100644 index 00000000..2bd0f1a6 --- /dev/null +++ b/proto-google-cloud-essential-contacts-v1/src/main/proto/google/cloud/essentialcontacts/v1/service.proto @@ -0,0 +1,343 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.essentialcontacts.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/essentialcontacts/v1/enums.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1;essentialcontacts"; +option java_multiple_files = true; +option java_package = "com.google.cloud.essentialcontacts.v1"; +option csharp_namespace = "Google.Cloud.EssentialContacts.V1"; +option php_namespace = "Google\\Cloud\\EssentialContacts\\V1"; +option ruby_package = "Google::Cloud::EssentialContacts::V1"; + +// Manages contacts for important Google Cloud notifications. +service EssentialContactsService { + option (google.api.default_host) = "essentialcontacts.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Adds a new contact for a resource. + rpc CreateContact(CreateContactRequest) returns (Contact) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/contacts" + body: "contact" + additional_bindings { + post: "/v1/{parent=folders/*}/contacts" + body: "contact" + } + additional_bindings { + post: "/v1/{parent=organizations/*}/contacts" + body: "contact" + } + }; + option (google.api.method_signature) = "parent,contact"; + } + + // Updates a contact. + // Note: A contact's email address cannot be changed. + rpc UpdateContact(UpdateContactRequest) returns (Contact) { + option (google.api.http) = { + patch: "/v1/{contact.name=projects/*/contacts/*}" + body: "contact" + additional_bindings { + patch: "/v1/{contact.name=folders/*/contacts/*}" + body: "contact" + } + additional_bindings { + patch: "/v1/{contact.name=organizations/*/contacts/*}" + body: "contact" + } + }; + option (google.api.method_signature) = "contact,update_mask"; + } + + // Lists the contacts that have been set on a resource. + rpc ListContacts(ListContactsRequest) returns (ListContactsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/contacts" + additional_bindings { get: "/v1/{parent=folders/*}/contacts" } + additional_bindings { get: "/v1/{parent=organizations/*}/contacts" } + }; + option (google.api.method_signature) = "parent"; + } + + // Gets a single contact. + rpc GetContact(GetContactRequest) returns (Contact) { + option (google.api.http) = { + get: "/v1/{name=projects/*/contacts/*}" + additional_bindings { get: "/v1/{name=folders/*/contacts/*}" } + additional_bindings { get: "/v1/{name=organizations/*/contacts/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Deletes a contact. + rpc DeleteContact(DeleteContactRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/contacts/*}" + additional_bindings { delete: "/v1/{name=folders/*/contacts/*}" } + additional_bindings { delete: "/v1/{name=organizations/*/contacts/*}" } + }; + option (google.api.method_signature) = "name"; + } + + // Lists all contacts for the resource that are subscribed to the + // specified notification categories, including contacts inherited from + // any parent resources. + rpc ComputeContacts(ComputeContactsRequest) + returns (ComputeContactsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/contacts:compute" + additional_bindings { get: "/v1/{parent=folders/*}/contacts:compute" } + additional_bindings { + get: "/v1/{parent=organizations/*}/contacts:compute" + } + }; + } + + // Allows a contact admin to send a test message to contact to verify that it + // has been configured correctly. + rpc SendTestMessage(SendTestMessageRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/{resource=projects/*}/contacts:sendTestMessage" + body: "*" + additional_bindings { + post: "/v1/{resource=folders/*}/contacts:sendTestMessage" + body: "*" + } + additional_bindings { + post: "/v1/{resource=organizations/*}/contacts:sendTestMessage" + body: "*" + } + }; + } +} + +// A contact that will receive notifications from Google Cloud. +message Contact { + option (google.api.resource) = { + type: "essentialcontacts.googleapis.com/Contact" + pattern: "projects/{project}/contacts/{contact}" + pattern: "folders/{folder}/contacts/{contact}" + pattern: "organizations/{organization}/contacts/{contact}" + }; + + // The identifier for the contact. + // Format: {resource_type}/{resource_id}/contacts/{contact_id} + string name = 1; + + // Required. The email address to send notifications to. This does not need to + // be a Google account. + string email = 2; + + // The categories of notifications that the contact will receive + // communications for. + repeated NotificationCategory notification_category_subscriptions = 3; + + // The preferred language for notifications, as a ISO 639-1 language code. See + // [Supported + // languages](https://cloud.google.com/resource-manager/docs/managing-notification-contacts#supported-languages) + // for a list of supported languages. + string language_tag = 4; + + // The validity of the contact. A contact is considered valid if it is the + // correct recipient for notifications for a particular resource. + ValidationState validation_state = 8; + + // The last time the validation_state was updated, either manually or + // automatically. A contact is considered stale if its validation state was + // updated more than 1 year ago. + google.protobuf.Timestamp validate_time = 9; +} + +// Request message for the ListContacts method. +message ListContactsRequest { + // Required. The parent resource name. + // Format: organizations/{organization_id}, folders/{folder_id} or + // projects/{project_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "essentialcontacts.googleapis.com/Contact" + } + ]; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `next_page_token` in the + // response indicates that more results might be available. + // If not specified, the default page_size is 100. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, retrieves the next batch of results from the + // preceding call to this method. `page_token` must be the value of + // `next_page_token` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for the ListContacts method. +message ListContactsResponse { + // The contacts for the specified resource. + repeated Contact contacts = 1; + + // If there are more results than those appearing in this response, then + // `next_page_token` is included. To get the next set of results, call this + // method again using the value of `next_page_token` as `page_token` and the + // rest of the parameters the same as the original request. + string next_page_token = 2; +} + +// Request message for the GetContact method. +message GetContactRequest { + // Required. The name of the contact to retrieve. + // Format: organizations/{organization_id}/contacts/{contact_id}, + // folders/{folder_id}/contacts/{contact_id} or + // projects/{project_id}/contacts/{contact_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "essentialcontacts.googleapis.com/Contact" + } + ]; +} + +// Request message for the DeleteContact method. +message DeleteContactRequest { + // Required. The name of the contact to delete. + // Format: organizations/{organization_id}/contacts/{contact_id}, + // folders/{folder_id}/contacts/{contact_id} or + // projects/{project_id}/contacts/{contact_id} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "essentialcontacts.googleapis.com/Contact" + } + ]; +} + +// Request message for the CreateContact method. +message CreateContactRequest { + // Required. The resource to save this contact for. + // Format: organizations/{organization_id}, folders/{folder_id} or + // projects/{project_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "essentialcontacts.googleapis.com/Contact" + } + ]; + + // Required. The contact to create. Must specify an email address and language + // tag. + Contact contact = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for the UpdateContact method. +message UpdateContactRequest { + // Required. The contact resource to replace the existing saved contact. Note: + // the email address of the contact cannot be modified. + Contact contact = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The update mask applied to the resource. For the `FieldMask` + // definition, see + // https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask + google.protobuf.FieldMask update_mask = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for the ComputeContacts method. +message ComputeContactsRequest { + // Required. The name of the resource to compute contacts for. + // Format: organizations/{organization_id}, + // folders/{folder_id} or projects/{project_id} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "essentialcontacts.googleapis.com/Contact" + } + ]; + + // The categories of notifications to compute contacts for. If ALL is included + // in this list, contacts subscribed to any notification category will be + // returned. + repeated NotificationCategory notification_categories = 6; + + // Optional. The maximum number of results to return from this request. + // Non-positive values are ignored. The presence of `next_page_token` in the + // response indicates that more results might be available. + // If not specified, the default page_size is 100. + int32 page_size = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If present, retrieves the next batch of results from the + // preceding call to this method. `page_token` must be the value of + // `next_page_token` from the previous response. The values of other method + // parameters should be identical to those in the previous call. + string page_token = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for the ComputeContacts method. +message ComputeContactsResponse { + // All contacts for the resource that are subscribed to the specified + // notification categories, including contacts inherited from any parent + // resources. + repeated Contact contacts = 1; + + // If there are more results than those appearing in this response, then + // `next_page_token` is included. To get the next set of results, call this + // method again using the value of `next_page_token` as `page_token` and the + // rest of the parameters the same as the original request. + string next_page_token = 2; +} + +// Request message for the SendTestMessage method. +message SendTestMessageRequest { + // Required. The list of names of the contacts to send a test message to. + // Format: organizations/{organization_id}/contacts/{contact_id}, + // folders/{folder_id}/contacts/{contact_id} or + // projects/{project_id}/contacts/{contact_id} + repeated string contacts = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "essentialcontacts.googleapis.com/Contact" + } + ]; + + // Required. The name of the resource to send the test message for. All + // contacts must either be set directly on this resource or inherited from + // another resource that is an ancestor of this one. Format: + // organizations/{organization_id}, folders/{folder_id} or + // projects/{project_id} + string resource = 2 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "essentialcontacts.googleapis.com/Contact" + } + ]; + + // Required. The notification category to send the test message for. All + // contacts must be subscribed to this category. + NotificationCategory notification_category = 3 + [(google.api.field_behavior) = REQUIRED]; +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..aa670198 --- /dev/null +++ b/renovate.json @@ -0,0 +1,73 @@ +{ + "extends": [ + ":separateMajorReleases", + ":combinePatchMinorReleases", + ":ignoreUnstable", + ":prImmediately", + ":updateNotScheduled", + ":automergeDisabled", + ":ignoreModulesAndTests", + ":maintainLockFilesDisabled", + ":autodetectPinVersions" + ], + "packageRules": [ + { + "packagePatterns": [ + "^com.google.guava:" + ], + "versionScheme": "docker" + }, + { + "packagePatterns": [ + "*" + ], + "semanticCommitType": "deps", + "semanticCommitScope": null + }, + { + "packagePatterns": [ + "^org.apache.maven", + "^org.jacoco:", + "^org.codehaus.mojo:", + "^org.sonatype.plugins:", + "^com.coveo:", + "^com.google.cloud:google-cloud-shared-config" + ], + "semanticCommitType": "build", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-essential-contacts", + "^com.google.cloud:libraries-bom", + "^com.google.cloud.samples:shared-configuration" + ], + "semanticCommitType": "chore", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^junit:junit", + "^com.google.truth:truth", + "^org.mockito:mockito-core", + "^org.objenesis:objenesis" + ], + "semanticCommitType": "test", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-" + ], + "ignoreUnstable": false + }, + { + "packagePatterns": [ + "^com.fasterxml.jackson.core" + ], + "groupName": "jackson dependencies" + } + ], + "semanticCommits": true, + "masterIssue": true +} diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml new file mode 100644 index 00000000..40fdfc7c --- /dev/null +++ b/samples/install-without-bom/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.google.cloud + essential-contacts-install-without-bom + jar + Google Essential Contacts API Install Without Bom + https://github.com/googleapis/java-essential-contacts + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + + com.google.cloud + google-cloud-essential-contacts + 0.0.0 + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.1.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + diff --git a/samples/pom.xml b/samples/pom.xml new file mode 100644 index 00000000..7430f117 --- /dev/null +++ b/samples/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + com.google.cloud + google-cloud-essential-contacts-samples + 0.0.1-SNAPSHOT + pom + Google Essential Contacts API Samples Parent + https://github.com/googleapis/java-essential-contacts + + Java idiomatic client for Google Cloud Platform services. + + + + + com.google.cloud.samples + shared-configuration + 1.0.18 + + + + 1.8 + 1.8 + UTF-8 + + + + install-without-bom + snapshot + snippets + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + true + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.8 + + true + + + + + diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml new file mode 100644 index 00000000..86f0fc54 --- /dev/null +++ b/samples/snapshot/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + com.google.cloud + essential-contacts-snapshot + jar + Google Essential Contacts API Snapshot Samples + https://github.com/googleapis/java-essential-contacts + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-essential-contacts + 0.0.0 + + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.1.0 + + + add-snippets-source + + add-source + + + + ../snippets/src/main/java + + + + + add-snippets-tests + + add-test-source + + + + ../snippets/src/test/java + + + + + + + + \ No newline at end of file diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml new file mode 100644 index 00000000..22585a92 --- /dev/null +++ b/samples/snippets/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + com.google.cloud + essential-contacts-snippets + jar + Google Essential Contacts API Snippets + https://github.com/googleapis/java-essential-contacts + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-essential-contacts + 0.0.0 + + + + junit + junit + 4.13 + test + + + com.google.truth + truth + 1.0.1 + test + + + diff --git a/versions.txt b/versions.txt new file mode 100644 index 00000000..88f35918 --- /dev/null +++ b/versions.txt @@ -0,0 +1,6 @@ +# Format: +# module:released-version:current-version + +google-cloud-essential-contacts:0.0.0:0.0.1-SNAPSHOT +grpc-google-cloud-essential-contacts-v1:0.0.0:0.0.1-SNAPSHOT +proto-google-cloud-essential-contacts-v1:0.0.0:0.0.1-SNAPSHOT