diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml new file mode 100644 index 00000000..046c008e --- /dev/null +++ b/.github/.OwlBot.lock.yaml @@ -0,0 +1,3 @@ +docker: + digest: sha256:3796fe5c26bbf814f0a82a2eab2749b5710f87e7197dc011e5fa3c694e532462 + 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..03c719ea --- /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/eventarc/(v.*)/.*-java/proto-google-.*/src" + dest: "/owl-bot-staging/$1/proto-google-cloud-eventarc-$1/src" +- source: "/google/cloud/eventarc/(v.*)/.*-java/grpc-google-.*/src" + dest: "/owl-bot-staging/$1/grpc-google-cloud-eventarc-$1/src" +- source: "/google/cloud/eventarc/(v.*)/.*-java/gapic-google-.*/src" + dest: "/owl-bot-staging/$1/google-cloud-eventarc/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..978ad0a6 --- /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-eventarc/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. eventarc 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..37b6bd07 --- /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-eventarc/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..c644a24e --- /dev/null +++ b/.github/generated-files-bot.yml @@ -0,0 +1,12 @@ +externalManifests: +- type: json + file: 'synth.metadata' + jsonpath: '$.generatedFiles[*]' +- type: json + file: '.github/readme/synth.metadata/synth.metadata' + jsonpath: '$.generatedFiles[*]' +ignoreAuthors: +- 'renovate-bot' +- 'yoshi-automation' +- 'release-please[bot]' +- 'gcf-owl-bot[bot]' diff --git a/.github/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..8ca7f9ca --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,3 @@ +bumpMinorPreMajor: true +handleGHRelease: true +releaseType: java-yoshi 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..0195b32f --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,79 @@ +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 + 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 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..eb92feba --- /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 Maven & Java version +mvn -version +echo ${JOB_TYPE} + +# attempt to install 3 times with exponential backoff (starting with 10 seconds) +retry_with_backoff 3 10 \ + mvn install -B -V -ntp \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it +if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then + export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +RETURN_CODE=0 +set +e + +case ${JOB_TYPE} in +test) + mvn test -B -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-eventarc +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..40d3d536 --- /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-eventarc/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-eventarc/.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..5122379c --- /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-eventarc/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-eventarc/.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..ee064c88 --- /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-eventarc/.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..a7e999d3 --- /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/ --.*//' >.org-list.txt + + # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) + msg "Generating dependency list using flattened pom..." + mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt + + # Compare two dependency lists + msg "Comparing dependency lists..." + diff .org-list.txt .new-list.txt >.diff.txt + if [[ $? == 0 ]] + then + msg "Success. No diff!" + else + msg "Diff found. See below: " + msg "You can also check .diff.txt file located in $1." + cat .diff.txt + return 1 + fi +} + +# Allow failures to continue running the script +set +e + +error_count=0 +for path in **/.flattened-pom.xml +do + # Check flattened pom in each dir that contains it for completeness + dir=$(dirname "$path") + pushd "$dir" + completenessCheck "$dir" + error_count=$(($error_count + $?)) + popd +done + +if [[ $error_count == 0 ]] +then + msg "All checks passed." + exit 0 +else + msg "Errors found. See log statements above." + exit 1 +fi diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg new file mode 100644 index 00000000..5122379c --- /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-eventarc/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-eventarc/.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..6d9aab5d --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-eventarc/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 00000000..1ead6584 --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-eventarc/.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..36cf5c82 --- /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-eventarc/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-eventarc/.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..9d91f4fe --- /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-eventarc/.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..6d9aab5d --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-eventarc/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 00000000..1ead6584 --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-eventarc/.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..adda05a8 --- /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-eventarc/.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..ff55a686 --- /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-eventarc + +# 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-eventarc \ + --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..eda60afb --- /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-eventarc/.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-eventarc/.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..294e3c48 --- /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-eventarc/.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..eb6ba5c8 --- /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-eventarc/.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..f1dee1dd --- /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-eventarc/.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..244a8343 --- /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-eventarc/.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..a99b86f0 --- /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-eventarc +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..64fe4451 --- /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-eventarc/.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..2fb64e56 --- /dev/null +++ b/.kokoro/release/publish_javadoc11.sh @@ -0,0 +1,67 @@ +#!/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-eventarc +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 +# copy CHANGELOG to docfx-yml dir and rename history.md +cp CHANGELOG.md target/docfx-yml/history.md + +pushd target/docfx-yml + +# create metadata +python3 -m docuploader create-metadata \ + --name ${NAME} \ + --version ${VERSION} \ + --xrefs devsite://java/gax \ + --xrefs devsite://java/google-cloud-core \ + --xrefs devsite://java/api-common \ + --xrefs devsite://java/proto-google-common-protos \ + --xrefs devsite://java/google-api-client \ + --xrefs devsite://java/google-http-client \ + --xrefs devsite://java/protobuf \ + --language java + +# upload yml to production bucket +python3 -m docuploader upload . \ + --credentials ${CREDENTIALS} \ + --staging-bucket ${STAGING_BUCKET_V2} \ + --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg new file mode 100644 index 00000000..e7d926b0 --- /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-eventarc/.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..6875b7ae --- /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-eventarc/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-eventarc/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-eventarc" + } +} + +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..7afaf1e7 --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,15 @@ +{ + "name": "eventarc", + "name_pretty": "Eventarc", + "product_documentation": "https://cloud.google.com/eventarc/docs", + "api_description": "lets you asynchronously deliver events from Google services, SaaS, and your own apps using loosely coupled services that react to state changes.", + "client_documentation": "https://googleapis.dev/java/google-cloud-eventarc/latest/index.html", + "release_level": "ga", + "transport": "grpc", + "language": "java", + "repo": "googleapis/java-eventarc", + "repo_short": "java-eventarc", + "distribution_name": "com.google.cloud:google-cloud-eventarc", + "api_id": "eventarc.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/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..8b58ae9c --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +# Security Policy + +To report a security issue, please use [g.co/vulnz](https://g.co/vulnz). + +The Google Security Team will respond within 5 working days of your report on g.co/vulnz. + +We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue. diff --git a/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-eventarc-bom/pom.xml b/google-cloud-eventarc-bom/pom.xml new file mode 100644 index 00000000..aed147a5 --- /dev/null +++ b/google-cloud-eventarc-bom/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + com.google.cloud + google-cloud-eventarc-bom + 0.0.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 0.11.0 + + + Google Eventarc BOM + https://github.com/googleapis/java-eventarc + + BOM for Eventarc + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-eventarc.git + scm:git:git@github.com:googleapis/java-eventarc.git + https://github.com/googleapis/java-eventarc + + + + true + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + com.google.cloud + google-cloud-eventarc + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-eventarc-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-eventarc-v1 + 0.0.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + diff --git a/google-cloud-eventarc/pom.xml b/google-cloud-eventarc/pom.xml new file mode 100644 index 00000000..dd76ddac --- /dev/null +++ b/google-cloud-eventarc/pom.xml @@ -0,0 +1,111 @@ + + + 4.0.0 + com.google.cloud + google-cloud-eventarc + 0.0.1-SNAPSHOT + jar + Google Eventarc + https://github.com/googleapis/java-eventarc + Eventarc lets you asynchronously deliver events from Google services, SaaS, and your own apps using loosely coupled services that react to state changes. + + com.google.cloud + google-cloud-eventarc-parent + 0.0.1-SNAPSHOT + + + google-cloud-eventarc + + + + 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-eventarc-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-eventarc-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-eventarc/src/main/java/com/google/cloud/eventarc/v1/EventarcClient.java b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/EventarcClient.java new file mode 100644 index 00000000..2d44db36 --- /dev/null +++ b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/EventarcClient.java @@ -0,0 +1,889 @@ +/* + * 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.eventarc.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.longrunning.OperationFuture; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.eventarc.v1.stub.EventarcStub; +import com.google.cloud.eventarc.v1.stub.EventarcStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.longrunning.Operation; +import com.google.longrunning.OperationsClient; +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: Eventarc allows users to subscribe to various events that are provided by + * Google Cloud services and forward them to supported destinations. + * + *

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 (EventarcClient eventarcClient = EventarcClient.create()) {
+ *   TriggerName name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]");
+ *   Trigger response = eventarcClient.getTrigger(name);
+ * }
+ * }
+ * + *

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

To customize credentials: + * + *

{@code
+ * EventarcSettings eventarcSettings =
+ *     EventarcSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * EventarcClient eventarcClient = EventarcClient.create(eventarcSettings);
+ * }
+ * + *

To customize the endpoint: + * + *

{@code
+ * EventarcSettings eventarcSettings =
+ *     EventarcSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * EventarcClient eventarcClient = EventarcClient.create(eventarcSettings);
+ * }
+ * + *

Please refer to the GitHub repository's samples for more quickstart code snippets. + */ +@Generated("by gapic-generator-java") +public class EventarcClient implements BackgroundResource { + private final EventarcSettings settings; + private final EventarcStub stub; + private final OperationsClient operationsClient; + + /** Constructs an instance of EventarcClient with default settings. */ + public static final EventarcClient create() throws IOException { + return create(EventarcSettings.newBuilder().build()); + } + + /** + * Constructs an instance of EventarcClient, 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 EventarcClient create(EventarcSettings settings) throws IOException { + return new EventarcClient(settings); + } + + /** + * Constructs an instance of EventarcClient, using the given stub for making calls. This is for + * advanced usage - prefer using create(EventarcSettings). + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final EventarcClient create(EventarcStub stub) { + return new EventarcClient(stub); + } + + /** + * Constructs an instance of EventarcClient, 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 EventarcClient(EventarcSettings settings) throws IOException { + this.settings = settings; + this.stub = ((EventarcStubSettings) settings.getStubSettings()).createStub(); + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected EventarcClient(EventarcStub stub) { + this.settings = null; + this.stub = stub; + this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + } + + public final EventarcSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public EventarcStub getStub() { + return stub; + } + + /** + * Returns the OperationsClient that can be used to query the status of a long-running operation + * returned by another API method call. + */ + public final OperationsClient getOperationsClient() { + return operationsClient; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   TriggerName name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]");
+   *   Trigger response = eventarcClient.getTrigger(name);
+   * }
+   * }
+ * + * @param name Required. The name of the trigger to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Trigger getTrigger(TriggerName name) { + GetTriggerRequest request = + GetTriggerRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getTrigger(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   String name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString();
+   *   Trigger response = eventarcClient.getTrigger(name);
+   * }
+   * }
+ * + * @param name Required. The name of the trigger to get. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Trigger getTrigger(String name) { + GetTriggerRequest request = GetTriggerRequest.newBuilder().setName(name).build(); + return getTrigger(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   GetTriggerRequest request =
+   *       GetTriggerRequest.newBuilder()
+   *           .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .build();
+   *   Trigger response = eventarcClient.getTrigger(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 Trigger getTrigger(GetTriggerRequest request) { + return getTriggerCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Get a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   GetTriggerRequest request =
+   *       GetTriggerRequest.newBuilder()
+   *           .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .build();
+   *   ApiFuture future = eventarcClient.getTriggerCallable().futureCall(request);
+   *   // Do something.
+   *   Trigger response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable getTriggerCallable() { + return stub.getTriggerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List triggers. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   for (Trigger element : eventarcClient.listTriggers(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The parent collection to list triggers on. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTriggersPagedResponse listTriggers(LocationName parent) { + ListTriggersRequest request = + ListTriggersRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .build(); + return listTriggers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List triggers. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   String parent = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString();
+   *   for (Trigger element : eventarcClient.listTriggers(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ * + * @param parent Required. The parent collection to list triggers on. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTriggersPagedResponse listTriggers(String parent) { + ListTriggersRequest request = ListTriggersRequest.newBuilder().setParent(parent).build(); + return listTriggers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List triggers. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   ListTriggersRequest request =
+   *       ListTriggersRequest.newBuilder()
+   *           .setParent(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   for (Trigger element : eventarcClient.listTriggers(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 ListTriggersPagedResponse listTriggers(ListTriggersRequest request) { + return listTriggersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List triggers. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   ListTriggersRequest request =
+   *       ListTriggersRequest.newBuilder()
+   *           .setParent(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   ApiFuture future = eventarcClient.listTriggersPagedCallable().futureCall(request);
+   *   // Do something.
+   *   for (Trigger element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable + listTriggersPagedCallable() { + return stub.listTriggersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * List triggers. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   ListTriggersRequest request =
+   *       ListTriggersRequest.newBuilder()
+   *           .setParent(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setPageSize(883849137)
+   *           .setPageToken("pageToken873572522")
+   *           .setOrderBy("orderBy-1207110587")
+   *           .build();
+   *   while (true) {
+   *     ListTriggersResponse response = eventarcClient.listTriggersCallable().call(request);
+   *     for (Trigger element : response.getResponsesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * }
+ */ + public final UnaryCallable listTriggersCallable() { + return stub.listTriggersCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create a new trigger in a particular project and location. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+   *   Trigger trigger = Trigger.newBuilder().build();
+   *   String triggerId = "triggerId-648752909";
+   *   Trigger response = eventarcClient.createTriggerAsync(parent, trigger, triggerId).get();
+   * }
+   * }
+ * + * @param parent Required. The parent collection in which to add this trigger. + * @param trigger Required. The trigger to create. + * @param triggerId Required. The user-provided ID to be assigned to the trigger. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createTriggerAsync( + LocationName parent, Trigger trigger, String triggerId) { + CreateTriggerRequest request = + CreateTriggerRequest.newBuilder() + .setParent(parent == null ? null : parent.toString()) + .setTrigger(trigger) + .setTriggerId(triggerId) + .build(); + return createTriggerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create a new trigger in a particular project and location. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   String parent = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString();
+   *   Trigger trigger = Trigger.newBuilder().build();
+   *   String triggerId = "triggerId-648752909";
+   *   Trigger response = eventarcClient.createTriggerAsync(parent, trigger, triggerId).get();
+   * }
+   * }
+ * + * @param parent Required. The parent collection in which to add this trigger. + * @param trigger Required. The trigger to create. + * @param triggerId Required. The user-provided ID to be assigned to the trigger. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createTriggerAsync( + String parent, Trigger trigger, String triggerId) { + CreateTriggerRequest request = + CreateTriggerRequest.newBuilder() + .setParent(parent) + .setTrigger(trigger) + .setTriggerId(triggerId) + .build(); + return createTriggerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create a new trigger in a particular project and location. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   CreateTriggerRequest request =
+   *       CreateTriggerRequest.newBuilder()
+   *           .setParent(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setTrigger(Trigger.newBuilder().build())
+   *           .setTriggerId("triggerId-648752909")
+   *           .setValidateOnly(true)
+   *           .build();
+   *   Trigger response = eventarcClient.createTriggerAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture createTriggerAsync( + CreateTriggerRequest request) { + return createTriggerOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create a new trigger in a particular project and location. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   CreateTriggerRequest request =
+   *       CreateTriggerRequest.newBuilder()
+   *           .setParent(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setTrigger(Trigger.newBuilder().build())
+   *           .setTriggerId("triggerId-648752909")
+   *           .setValidateOnly(true)
+   *           .build();
+   *   OperationFuture future =
+   *       eventarcClient.createTriggerOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Trigger response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + createTriggerOperationCallable() { + return stub.createTriggerOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Create a new trigger in a particular project and location. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   CreateTriggerRequest request =
+   *       CreateTriggerRequest.newBuilder()
+   *           .setParent(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setTrigger(Trigger.newBuilder().build())
+   *           .setTriggerId("triggerId-648752909")
+   *           .setValidateOnly(true)
+   *           .build();
+   *   ApiFuture future = eventarcClient.createTriggerCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable createTriggerCallable() { + return stub.createTriggerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Update a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   Trigger trigger = Trigger.newBuilder().build();
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   boolean allowMissing = true;
+   *   Trigger response = eventarcClient.updateTriggerAsync(trigger, updateMask, allowMissing).get();
+   * }
+   * }
+ * + * @param trigger The trigger to be updated. + * @param updateMask The fields to be updated; only fields explicitly provided will be updated. If + * no field mask is provided, all provided fields in the request will be updated. To update + * all fields, provide a field mask of "*". + * @param allowMissing If set to true, and the trigger is not found, a new trigger will be + * created. In this situation, `update_mask` is ignored. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updateTriggerAsync( + Trigger trigger, FieldMask updateMask, boolean allowMissing) { + UpdateTriggerRequest request = + UpdateTriggerRequest.newBuilder() + .setTrigger(trigger) + .setUpdateMask(updateMask) + .setAllowMissing(allowMissing) + .build(); + return updateTriggerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Update a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   UpdateTriggerRequest request =
+   *       UpdateTriggerRequest.newBuilder()
+   *           .setTrigger(Trigger.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setAllowMissing(true)
+   *           .setValidateOnly(true)
+   *           .build();
+   *   Trigger response = eventarcClient.updateTriggerAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture updateTriggerAsync( + UpdateTriggerRequest request) { + return updateTriggerOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Update a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   UpdateTriggerRequest request =
+   *       UpdateTriggerRequest.newBuilder()
+   *           .setTrigger(Trigger.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setAllowMissing(true)
+   *           .setValidateOnly(true)
+   *           .build();
+   *   OperationFuture future =
+   *       eventarcClient.updateTriggerOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Trigger response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + updateTriggerOperationCallable() { + return stub.updateTriggerOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Update a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   UpdateTriggerRequest request =
+   *       UpdateTriggerRequest.newBuilder()
+   *           .setTrigger(Trigger.newBuilder().build())
+   *           .setUpdateMask(FieldMask.newBuilder().build())
+   *           .setAllowMissing(true)
+   *           .setValidateOnly(true)
+   *           .build();
+   *   ApiFuture future = eventarcClient.updateTriggerCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable updateTriggerCallable() { + return stub.updateTriggerCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   TriggerName name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]");
+   *   boolean allowMissing = true;
+   *   Trigger response = eventarcClient.deleteTriggerAsync(name, allowMissing).get();
+   * }
+   * }
+ * + * @param name Required. The name of the trigger to be deleted. + * @param allowMissing If set to true, and the trigger is not found, the request will succeed but + * no action will be taken on the server. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteTriggerAsync( + TriggerName name, boolean allowMissing) { + DeleteTriggerRequest request = + DeleteTriggerRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setAllowMissing(allowMissing) + .build(); + return deleteTriggerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   String name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString();
+   *   boolean allowMissing = true;
+   *   Trigger response = eventarcClient.deleteTriggerAsync(name, allowMissing).get();
+   * }
+   * }
+ * + * @param name Required. The name of the trigger to be deleted. + * @param allowMissing If set to true, and the trigger is not found, the request will succeed but + * no action will be taken on the server. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteTriggerAsync( + String name, boolean allowMissing) { + DeleteTriggerRequest request = + DeleteTriggerRequest.newBuilder().setName(name).setAllowMissing(allowMissing).build(); + return deleteTriggerAsync(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   DeleteTriggerRequest request =
+   *       DeleteTriggerRequest.newBuilder()
+   *           .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setEtag("etag3123477")
+   *           .setAllowMissing(true)
+   *           .setValidateOnly(true)
+   *           .build();
+   *   Trigger response = eventarcClient.deleteTriggerAsync(request).get();
+   * }
+   * }
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final OperationFuture deleteTriggerAsync( + DeleteTriggerRequest request) { + return deleteTriggerOperationCallable().futureCall(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   DeleteTriggerRequest request =
+   *       DeleteTriggerRequest.newBuilder()
+   *           .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setEtag("etag3123477")
+   *           .setAllowMissing(true)
+   *           .setValidateOnly(true)
+   *           .build();
+   *   OperationFuture future =
+   *       eventarcClient.deleteTriggerOperationCallable().futureCall(request);
+   *   // Do something.
+   *   Trigger response = future.get();
+   * }
+   * }
+ */ + public final OperationCallable + deleteTriggerOperationCallable() { + return stub.deleteTriggerOperationCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Delete a single trigger. + * + *

Sample code: + * + *

{@code
+   * try (EventarcClient eventarcClient = EventarcClient.create()) {
+   *   DeleteTriggerRequest request =
+   *       DeleteTriggerRequest.newBuilder()
+   *           .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString())
+   *           .setEtag("etag3123477")
+   *           .setAllowMissing(true)
+   *           .setValidateOnly(true)
+   *           .build();
+   *   ApiFuture future = eventarcClient.deleteTriggerCallable().futureCall(request);
+   *   // Do something.
+   *   Operation response = future.get();
+   * }
+   * }
+ */ + public final UnaryCallable deleteTriggerCallable() { + return stub.deleteTriggerCallable(); + } + + @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 ListTriggersPagedResponse + extends AbstractPagedListResponse< + ListTriggersRequest, + ListTriggersResponse, + Trigger, + ListTriggersPage, + ListTriggersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTriggersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTriggersPagedResponse apply(ListTriggersPage input) { + return new ListTriggersPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListTriggersPagedResponse(ListTriggersPage page) { + super(page, ListTriggersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTriggersPage + extends AbstractPage { + + private ListTriggersPage( + PageContext context, + ListTriggersResponse response) { + super(context, response); + } + + private static ListTriggersPage createEmptyPage() { + return new ListTriggersPage(null, null); + } + + @Override + protected ListTriggersPage createPage( + PageContext context, + ListTriggersResponse response) { + return new ListTriggersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTriggersFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTriggersRequest, + ListTriggersResponse, + Trigger, + ListTriggersPage, + ListTriggersFixedSizeCollection> { + + private ListTriggersFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTriggersFixedSizeCollection createEmptyCollection() { + return new ListTriggersFixedSizeCollection(null, 0); + } + + @Override + protected ListTriggersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTriggersFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/EventarcSettings.java b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/EventarcSettings.java new file mode 100644 index 00000000..48597c46 --- /dev/null +++ b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/EventarcSettings.java @@ -0,0 +1,264 @@ +/* + * 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.eventarc.v1; + +import static com.google.cloud.eventarc.v1.EventarcClient.ListTriggersPagedResponse; + +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.OperationCallSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.eventarc.v1.stub.EventarcStubSettings; +import com.google.longrunning.Operation; +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 EventarcClient}. + * + *

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

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

{@code
+ * EventarcSettings.Builder eventarcSettingsBuilder = EventarcSettings.newBuilder();
+ * eventarcSettingsBuilder
+ *     .getTriggerSettings()
+ *     .setRetrySettings(
+ *         eventarcSettingsBuilder
+ *             .getTriggerSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * EventarcSettings eventarcSettings = eventarcSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class EventarcSettings extends ClientSettings { + + /** Returns the object with the settings used for calls to getTrigger. */ + public UnaryCallSettings getTriggerSettings() { + return ((EventarcStubSettings) getStubSettings()).getTriggerSettings(); + } + + /** Returns the object with the settings used for calls to listTriggers. */ + public PagedCallSettings + listTriggersSettings() { + return ((EventarcStubSettings) getStubSettings()).listTriggersSettings(); + } + + /** Returns the object with the settings used for calls to createTrigger. */ + public UnaryCallSettings createTriggerSettings() { + return ((EventarcStubSettings) getStubSettings()).createTriggerSettings(); + } + + /** Returns the object with the settings used for calls to createTrigger. */ + public OperationCallSettings + createTriggerOperationSettings() { + return ((EventarcStubSettings) getStubSettings()).createTriggerOperationSettings(); + } + + /** Returns the object with the settings used for calls to updateTrigger. */ + public UnaryCallSettings updateTriggerSettings() { + return ((EventarcStubSettings) getStubSettings()).updateTriggerSettings(); + } + + /** Returns the object with the settings used for calls to updateTrigger. */ + public OperationCallSettings + updateTriggerOperationSettings() { + return ((EventarcStubSettings) getStubSettings()).updateTriggerOperationSettings(); + } + + /** Returns the object with the settings used for calls to deleteTrigger. */ + public UnaryCallSettings deleteTriggerSettings() { + return ((EventarcStubSettings) getStubSettings()).deleteTriggerSettings(); + } + + /** Returns the object with the settings used for calls to deleteTrigger. */ + public OperationCallSettings + deleteTriggerOperationSettings() { + return ((EventarcStubSettings) getStubSettings()).deleteTriggerOperationSettings(); + } + + public static final EventarcSettings create(EventarcStubSettings stub) throws IOException { + return new EventarcSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return EventarcStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return EventarcStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return EventarcStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return EventarcStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return EventarcStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return EventarcStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return EventarcStubSettings.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 EventarcSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for EventarcSettings. */ + public static class Builder extends ClientSettings.Builder { + + protected Builder() throws IOException { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(EventarcStubSettings.newBuilder(clientContext)); + } + + protected Builder(EventarcSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(EventarcStubSettings.Builder stubSettings) { + super(stubSettings); + } + + private static Builder createDefault() { + return new Builder(EventarcStubSettings.newBuilder()); + } + + public EventarcStubSettings.Builder getStubSettingsBuilder() { + return ((EventarcStubSettings.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 getTrigger. */ + public UnaryCallSettings.Builder getTriggerSettings() { + return getStubSettingsBuilder().getTriggerSettings(); + } + + /** Returns the builder for the settings used for calls to listTriggers. */ + public PagedCallSettings.Builder< + ListTriggersRequest, ListTriggersResponse, ListTriggersPagedResponse> + listTriggersSettings() { + return getStubSettingsBuilder().listTriggersSettings(); + } + + /** Returns the builder for the settings used for calls to createTrigger. */ + public UnaryCallSettings.Builder createTriggerSettings() { + return getStubSettingsBuilder().createTriggerSettings(); + } + + /** Returns the builder for the settings used for calls to createTrigger. */ + public OperationCallSettings.Builder + createTriggerOperationSettings() { + return getStubSettingsBuilder().createTriggerOperationSettings(); + } + + /** Returns the builder for the settings used for calls to updateTrigger. */ + public UnaryCallSettings.Builder updateTriggerSettings() { + return getStubSettingsBuilder().updateTriggerSettings(); + } + + /** Returns the builder for the settings used for calls to updateTrigger. */ + public OperationCallSettings.Builder + updateTriggerOperationSettings() { + return getStubSettingsBuilder().updateTriggerOperationSettings(); + } + + /** Returns the builder for the settings used for calls to deleteTrigger. */ + public UnaryCallSettings.Builder deleteTriggerSettings() { + return getStubSettingsBuilder().deleteTriggerSettings(); + } + + /** Returns the builder for the settings used for calls to deleteTrigger. */ + public OperationCallSettings.Builder + deleteTriggerOperationSettings() { + return getStubSettingsBuilder().deleteTriggerOperationSettings(); + } + + @Override + public EventarcSettings build() throws IOException { + return new EventarcSettings(this); + } + } +} diff --git a/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/gapic_metadata.json b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/gapic_metadata.json new file mode 100644 index 00000000..9a3dffde --- /dev/null +++ b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/gapic_metadata.json @@ -0,0 +1,33 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "java", + "protoPackage": "google.cloud.eventarc.v1", + "libraryPackage": "com.google.cloud.eventarc.v1", + "services": { + "Eventarc": { + "clients": { + "grpc": { + "libraryClient": "EventarcClient", + "rpcs": { + "CreateTrigger": { + "methods": ["createTriggerAsync", "createTriggerAsync", "createTriggerAsync", "createTriggerOperationCallable", "createTriggerCallable"] + }, + "DeleteTrigger": { + "methods": ["deleteTriggerAsync", "deleteTriggerAsync", "deleteTriggerAsync", "deleteTriggerOperationCallable", "deleteTriggerCallable"] + }, + "GetTrigger": { + "methods": ["getTrigger", "getTrigger", "getTrigger", "getTriggerCallable"] + }, + "ListTriggers": { + "methods": ["listTriggers", "listTriggers", "listTriggers", "listTriggersPagedCallable", "listTriggersCallable"] + }, + "UpdateTrigger": { + "methods": ["updateTriggerAsync", "updateTriggerAsync", "updateTriggerOperationCallable", "updateTriggerCallable"] + } + } + } + } + } + } +} \ No newline at end of file diff --git a/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/package-info.java b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/package-info.java new file mode 100644 index 00000000..99fadd51 --- /dev/null +++ b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/package-info.java @@ -0,0 +1,37 @@ +/* + * 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. + * + *

======================= EventarcClient ======================= + * + *

Service Description: Eventarc allows users to subscribe to various events that are provided by + * Google Cloud services and forward them to supported destinations. + * + *

Sample for EventarcClient: + * + *

{@code
+ * try (EventarcClient eventarcClient = EventarcClient.create()) {
+ *   TriggerName name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]");
+ *   Trigger response = eventarcClient.getTrigger(name);
+ * }
+ * }
+ */ +@Generated("by gapic-generator-java") +package com.google.cloud.eventarc.v1; + +import javax.annotation.Generated; diff --git a/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/EventarcStub.java b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/EventarcStub.java new file mode 100644 index 00000000..c0f8f582 --- /dev/null +++ b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/EventarcStub.java @@ -0,0 +1,90 @@ +/* + * 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.eventarc.v1.stub; + +import static com.google.cloud.eventarc.v1.EventarcClient.ListTriggersPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.eventarc.v1.CreateTriggerRequest; +import com.google.cloud.eventarc.v1.DeleteTriggerRequest; +import com.google.cloud.eventarc.v1.GetTriggerRequest; +import com.google.cloud.eventarc.v1.ListTriggersRequest; +import com.google.cloud.eventarc.v1.ListTriggersResponse; +import com.google.cloud.eventarc.v1.OperationMetadata; +import com.google.cloud.eventarc.v1.Trigger; +import com.google.cloud.eventarc.v1.UpdateTriggerRequest; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * Base stub class for the Eventarc service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public abstract class EventarcStub implements BackgroundResource { + + public OperationsStub getOperationsStub() { + throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + } + + public UnaryCallable getTriggerCallable() { + throw new UnsupportedOperationException("Not implemented: getTriggerCallable()"); + } + + public UnaryCallable listTriggersPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listTriggersPagedCallable()"); + } + + public UnaryCallable listTriggersCallable() { + throw new UnsupportedOperationException("Not implemented: listTriggersCallable()"); + } + + public OperationCallable + createTriggerOperationCallable() { + throw new UnsupportedOperationException("Not implemented: createTriggerOperationCallable()"); + } + + public UnaryCallable createTriggerCallable() { + throw new UnsupportedOperationException("Not implemented: createTriggerCallable()"); + } + + public OperationCallable + updateTriggerOperationCallable() { + throw new UnsupportedOperationException("Not implemented: updateTriggerOperationCallable()"); + } + + public UnaryCallable updateTriggerCallable() { + throw new UnsupportedOperationException("Not implemented: updateTriggerCallable()"); + } + + public OperationCallable + deleteTriggerOperationCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTriggerOperationCallable()"); + } + + public UnaryCallable deleteTriggerCallable() { + throw new UnsupportedOperationException("Not implemented: deleteTriggerCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/EventarcStubSettings.java b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/EventarcStubSettings.java new file mode 100644 index 00000000..726d65f6 --- /dev/null +++ b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/EventarcStubSettings.java @@ -0,0 +1,565 @@ +/* + * 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.eventarc.v1.stub; + +import static com.google.cloud.eventarc.v1.EventarcClient.ListTriggersPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.longrunning.OperationSnapshot; +import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.eventarc.v1.CreateTriggerRequest; +import com.google.cloud.eventarc.v1.DeleteTriggerRequest; +import com.google.cloud.eventarc.v1.GetTriggerRequest; +import com.google.cloud.eventarc.v1.ListTriggersRequest; +import com.google.cloud.eventarc.v1.ListTriggersResponse; +import com.google.cloud.eventarc.v1.OperationMetadata; +import com.google.cloud.eventarc.v1.Trigger; +import com.google.cloud.eventarc.v1.UpdateTriggerRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import 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 EventarcStub}. + * + *

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

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

{@code
+ * EventarcStubSettings.Builder eventarcSettingsBuilder = EventarcStubSettings.newBuilder();
+ * eventarcSettingsBuilder
+ *     .getTriggerSettings()
+ *     .setRetrySettings(
+ *         eventarcSettingsBuilder
+ *             .getTriggerSettings()
+ *             .getRetrySettings()
+ *             .toBuilder()
+ *             .setTotalTimeout(Duration.ofSeconds(30))
+ *             .build());
+ * EventarcStubSettings eventarcSettings = eventarcSettingsBuilder.build();
+ * }
+ */ +@Generated("by gapic-generator-java") +public class EventarcStubSettings 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 getTriggerSettings; + private final PagedCallSettings< + ListTriggersRequest, ListTriggersResponse, ListTriggersPagedResponse> + listTriggersSettings; + private final UnaryCallSettings createTriggerSettings; + private final OperationCallSettings + createTriggerOperationSettings; + private final UnaryCallSettings updateTriggerSettings; + private final OperationCallSettings + updateTriggerOperationSettings; + private final UnaryCallSettings deleteTriggerSettings; + private final OperationCallSettings + deleteTriggerOperationSettings; + + private static final PagedListDescriptor + LIST_TRIGGERS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTriggersRequest injectToken(ListTriggersRequest payload, String token) { + return ListTriggersRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListTriggersRequest injectPageSize(ListTriggersRequest payload, int pageSize) { + return ListTriggersRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListTriggersRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListTriggersResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListTriggersResponse payload) { + return payload.getTriggersList() == null + ? ImmutableList.of() + : payload.getTriggersList(); + } + }; + + private static final PagedListResponseFactory< + ListTriggersRequest, ListTriggersResponse, ListTriggersPagedResponse> + LIST_TRIGGERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTriggersRequest, ListTriggersResponse, ListTriggersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTriggersRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_TRIGGERS_PAGE_STR_DESC, request, context); + return ListTriggersPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Returns the object with the settings used for calls to getTrigger. */ + public UnaryCallSettings getTriggerSettings() { + return getTriggerSettings; + } + + /** Returns the object with the settings used for calls to listTriggers. */ + public PagedCallSettings + listTriggersSettings() { + return listTriggersSettings; + } + + /** Returns the object with the settings used for calls to createTrigger. */ + public UnaryCallSettings createTriggerSettings() { + return createTriggerSettings; + } + + /** Returns the object with the settings used for calls to createTrigger. */ + public OperationCallSettings + createTriggerOperationSettings() { + return createTriggerOperationSettings; + } + + /** Returns the object with the settings used for calls to updateTrigger. */ + public UnaryCallSettings updateTriggerSettings() { + return updateTriggerSettings; + } + + /** Returns the object with the settings used for calls to updateTrigger. */ + public OperationCallSettings + updateTriggerOperationSettings() { + return updateTriggerOperationSettings; + } + + /** Returns the object with the settings used for calls to deleteTrigger. */ + public UnaryCallSettings deleteTriggerSettings() { + return deleteTriggerSettings; + } + + /** Returns the object with the settings used for calls to deleteTrigger. */ + public OperationCallSettings + deleteTriggerOperationSettings() { + return deleteTriggerOperationSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public EventarcStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcEventarcStub.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 "eventarc.googleapis.com:443"; + } + + /** Returns the default mTLS service endpoint. */ + public static String getDefaultMtlsEndpoint() { + return "eventarc.mtls.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** 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(EventarcStubSettings.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 EventarcStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getTriggerSettings = settingsBuilder.getTriggerSettings().build(); + listTriggersSettings = settingsBuilder.listTriggersSettings().build(); + createTriggerSettings = settingsBuilder.createTriggerSettings().build(); + createTriggerOperationSettings = settingsBuilder.createTriggerOperationSettings().build(); + updateTriggerSettings = settingsBuilder.updateTriggerSettings().build(); + updateTriggerOperationSettings = settingsBuilder.updateTriggerOperationSettings().build(); + deleteTriggerSettings = settingsBuilder.deleteTriggerSettings().build(); + deleteTriggerOperationSettings = settingsBuilder.deleteTriggerOperationSettings().build(); + } + + /** Builder for EventarcStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + private final UnaryCallSettings.Builder getTriggerSettings; + private final PagedCallSettings.Builder< + ListTriggersRequest, ListTriggersResponse, ListTriggersPagedResponse> + listTriggersSettings; + private final UnaryCallSettings.Builder createTriggerSettings; + private final OperationCallSettings.Builder + createTriggerOperationSettings; + private final UnaryCallSettings.Builder updateTriggerSettings; + private final OperationCallSettings.Builder + updateTriggerOperationSettings; + private final UnaryCallSettings.Builder deleteTriggerSettings; + private final OperationCallSettings.Builder + deleteTriggerOperationSettings; + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); + definitions.put("no_retry_params", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this(((ClientContext) null)); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + getTriggerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + listTriggersSettings = PagedCallSettings.newBuilder(LIST_TRIGGERS_PAGE_STR_FACT); + createTriggerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + createTriggerOperationSettings = OperationCallSettings.newBuilder(); + updateTriggerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + updateTriggerOperationSettings = OperationCallSettings.newBuilder(); + deleteTriggerSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + deleteTriggerOperationSettings = OperationCallSettings.newBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getTriggerSettings, + listTriggersSettings, + createTriggerSettings, + updateTriggerSettings, + deleteTriggerSettings); + initDefaults(this); + } + + protected Builder(EventarcStubSettings settings) { + super(settings); + + getTriggerSettings = settings.getTriggerSettings.toBuilder(); + listTriggersSettings = settings.listTriggersSettings.toBuilder(); + createTriggerSettings = settings.createTriggerSettings.toBuilder(); + createTriggerOperationSettings = settings.createTriggerOperationSettings.toBuilder(); + updateTriggerSettings = settings.updateTriggerSettings.toBuilder(); + updateTriggerOperationSettings = settings.updateTriggerOperationSettings.toBuilder(); + deleteTriggerSettings = settings.deleteTriggerSettings.toBuilder(); + deleteTriggerOperationSettings = settings.deleteTriggerOperationSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getTriggerSettings, + listTriggersSettings, + createTriggerSettings, + updateTriggerSettings, + deleteTriggerSettings); + } + + private static Builder createDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + builder + .getTriggerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .listTriggersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .createTriggerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .updateTriggerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .deleteTriggerSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")); + + builder + .createTriggerOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Trigger.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .updateTriggerOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Trigger.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + builder + .deleteTriggerOperationSettings() + .setInitialCallSettings( + UnaryCallSettings + .newUnaryCallSettingsBuilder() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_params")) + .build()) + .setResponseTransformer( + ProtoOperationTransformers.ResponseTransformer.create(Trigger.class)) + .setMetadataTransformer( + ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class)) + .setPollingAlgorithm( + OperationTimedPollAlgorithm.create( + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(5000L)) + .setRetryDelayMultiplier(1.5) + .setMaxRetryDelay(Duration.ofMillis(45000L)) + .setInitialRpcTimeout(Duration.ZERO) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ZERO) + .setTotalTimeout(Duration.ofMillis(300000L)) + .build())); + + return builder; + } + + // 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 getTrigger. */ + public UnaryCallSettings.Builder getTriggerSettings() { + return getTriggerSettings; + } + + /** Returns the builder for the settings used for calls to listTriggers. */ + public PagedCallSettings.Builder< + ListTriggersRequest, ListTriggersResponse, ListTriggersPagedResponse> + listTriggersSettings() { + return listTriggersSettings; + } + + /** Returns the builder for the settings used for calls to createTrigger. */ + public UnaryCallSettings.Builder createTriggerSettings() { + return createTriggerSettings; + } + + /** Returns the builder for the settings used for calls to createTrigger. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + createTriggerOperationSettings() { + return createTriggerOperationSettings; + } + + /** Returns the builder for the settings used for calls to updateTrigger. */ + public UnaryCallSettings.Builder updateTriggerSettings() { + return updateTriggerSettings; + } + + /** Returns the builder for the settings used for calls to updateTrigger. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + updateTriggerOperationSettings() { + return updateTriggerOperationSettings; + } + + /** Returns the builder for the settings used for calls to deleteTrigger. */ + public UnaryCallSettings.Builder deleteTriggerSettings() { + return deleteTriggerSettings; + } + + /** Returns the builder for the settings used for calls to deleteTrigger. */ + @BetaApi( + "The surface for use by generated code is not stable yet and may change in the future.") + public OperationCallSettings.Builder + deleteTriggerOperationSettings() { + return deleteTriggerOperationSettings; + } + + @Override + public EventarcStubSettings build() throws IOException { + return new EventarcStubSettings(this); + } + } +} diff --git a/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/GrpcEventarcCallableFactory.java b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/GrpcEventarcCallableFactory.java new file mode 100644 index 00000000..a4e83836 --- /dev/null +++ b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/GrpcEventarcCallableFactory.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.eventarc.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 Eventarc service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +public class GrpcEventarcCallableFactory 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-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/GrpcEventarcStub.java b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/GrpcEventarcStub.java new file mode 100644 index 00000000..28880bc8 --- /dev/null +++ b/google-cloud-eventarc/src/main/java/com/google/cloud/eventarc/v1/stub/GrpcEventarcStub.java @@ -0,0 +1,344 @@ +/* + * 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.eventarc.v1.stub; + +import static com.google.cloud.eventarc.v1.EventarcClient.ListTriggersPagedResponse; + +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.eventarc.v1.CreateTriggerRequest; +import com.google.cloud.eventarc.v1.DeleteTriggerRequest; +import com.google.cloud.eventarc.v1.GetTriggerRequest; +import com.google.cloud.eventarc.v1.ListTriggersRequest; +import com.google.cloud.eventarc.v1.ListTriggersResponse; +import com.google.cloud.eventarc.v1.OperationMetadata; +import com.google.cloud.eventarc.v1.Trigger; +import com.google.cloud.eventarc.v1.UpdateTriggerRequest; +import com.google.common.collect.ImmutableMap; +import com.google.longrunning.Operation; +import com.google.longrunning.stub.GrpcOperationsStub; +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 Eventarc service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +public class GrpcEventarcStub extends EventarcStub { + private static final MethodDescriptor getTriggerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.eventarc.v1.Eventarc/GetTrigger") + .setRequestMarshaller(ProtoUtils.marshaller(GetTriggerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Trigger.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + listTriggersMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.eventarc.v1.Eventarc/ListTriggers") + .setRequestMarshaller(ProtoUtils.marshaller(ListTriggersRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListTriggersResponse.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + createTriggerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.eventarc.v1.Eventarc/CreateTrigger") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateTriggerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + updateTriggerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.eventarc.v1.Eventarc/UpdateTrigger") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateTriggerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private static final MethodDescriptor + deleteTriggerMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.eventarc.v1.Eventarc/DeleteTrigger") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteTriggerRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance())) + .build(); + + private final UnaryCallable getTriggerCallable; + private final UnaryCallable listTriggersCallable; + private final UnaryCallable + listTriggersPagedCallable; + private final UnaryCallable createTriggerCallable; + private final OperationCallable + createTriggerOperationCallable; + private final UnaryCallable updateTriggerCallable; + private final OperationCallable + updateTriggerOperationCallable; + private final UnaryCallable deleteTriggerCallable; + private final OperationCallable + deleteTriggerOperationCallable; + + private final BackgroundResource backgroundResources; + private final GrpcOperationsStub operationsStub; + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcEventarcStub create(EventarcStubSettings settings) throws IOException { + return new GrpcEventarcStub(settings, ClientContext.create(settings)); + } + + public static final GrpcEventarcStub create(ClientContext clientContext) throws IOException { + return new GrpcEventarcStub(EventarcStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcEventarcStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcEventarcStub( + EventarcStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcEventarcStub, 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 GrpcEventarcStub(EventarcStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcEventarcCallableFactory()); + } + + /** + * Constructs an instance of GrpcEventarcStub, 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 GrpcEventarcStub( + EventarcStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); + + GrpcCallSettings getTriggerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getTriggerMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetTriggerRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings listTriggersTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listTriggersMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListTriggersRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings createTriggerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createTriggerMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateTriggerRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateTriggerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateTriggerMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateTriggerRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("trigger.name", String.valueOf(request.getTrigger().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteTriggerTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteTriggerMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteTriggerRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + + this.getTriggerCallable = + callableFactory.createUnaryCallable( + getTriggerTransportSettings, settings.getTriggerSettings(), clientContext); + this.listTriggersCallable = + callableFactory.createUnaryCallable( + listTriggersTransportSettings, settings.listTriggersSettings(), clientContext); + this.listTriggersPagedCallable = + callableFactory.createPagedCallable( + listTriggersTransportSettings, settings.listTriggersSettings(), clientContext); + this.createTriggerCallable = + callableFactory.createUnaryCallable( + createTriggerTransportSettings, settings.createTriggerSettings(), clientContext); + this.createTriggerOperationCallable = + callableFactory.createOperationCallable( + createTriggerTransportSettings, + settings.createTriggerOperationSettings(), + clientContext, + operationsStub); + this.updateTriggerCallable = + callableFactory.createUnaryCallable( + updateTriggerTransportSettings, settings.updateTriggerSettings(), clientContext); + this.updateTriggerOperationCallable = + callableFactory.createOperationCallable( + updateTriggerTransportSettings, + settings.updateTriggerOperationSettings(), + clientContext, + operationsStub); + this.deleteTriggerCallable = + callableFactory.createUnaryCallable( + deleteTriggerTransportSettings, settings.deleteTriggerSettings(), clientContext); + this.deleteTriggerOperationCallable = + callableFactory.createOperationCallable( + deleteTriggerTransportSettings, + settings.deleteTriggerOperationSettings(), + clientContext, + operationsStub); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public GrpcOperationsStub getOperationsStub() { + return operationsStub; + } + + @Override + public UnaryCallable getTriggerCallable() { + return getTriggerCallable; + } + + @Override + public UnaryCallable listTriggersCallable() { + return listTriggersCallable; + } + + @Override + public UnaryCallable listTriggersPagedCallable() { + return listTriggersPagedCallable; + } + + @Override + public UnaryCallable createTriggerCallable() { + return createTriggerCallable; + } + + @Override + public OperationCallable + createTriggerOperationCallable() { + return createTriggerOperationCallable; + } + + @Override + public UnaryCallable updateTriggerCallable() { + return updateTriggerCallable; + } + + @Override + public OperationCallable + updateTriggerOperationCallable() { + return updateTriggerOperationCallable; + } + + @Override + public UnaryCallable deleteTriggerCallable() { + return deleteTriggerCallable; + } + + @Override + public OperationCallable + deleteTriggerOperationCallable() { + return deleteTriggerOperationCallable; + } + + @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-eventarc/src/test/java/com/google/cloud/eventarc/v1/EventarcClientTest.java b/google-cloud-eventarc/src/test/java/com/google/cloud/eventarc/v1/EventarcClientTest.java new file mode 100644 index 00000000..62d1e161 --- /dev/null +++ b/google-cloud-eventarc/src/test/java/com/google/cloud/eventarc/v1/EventarcClientTest.java @@ -0,0 +1,569 @@ +/* + * 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.eventarc.v1; + +import static com.google.cloud.eventarc.v1.EventarcClient.ListTriggersPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Any; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class EventarcClientTest { + private static MockEventarc mockEventarc; + private static MockServiceHelper mockServiceHelper; + private LocalChannelProvider channelProvider; + private EventarcClient client; + + @BeforeClass + public static void startStaticServer() { + mockEventarc = new MockEventarc(); + mockServiceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), Arrays.asList(mockEventarc)); + mockServiceHelper.start(); + } + + @AfterClass + public static void stopServer() { + mockServiceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + mockServiceHelper.reset(); + channelProvider = mockServiceHelper.createChannelProvider(); + EventarcSettings settings = + EventarcSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = EventarcClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + public void getTriggerTest() throws Exception { + Trigger expectedResponse = + Trigger.newBuilder() + .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString()) + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllEventFilters(new ArrayList()) + .setServiceAccount(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()) + .setDestination(Destination.newBuilder().build()) + .setTransport(Transport.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEtag("etag3123477") + .build(); + mockEventarc.addResponse(expectedResponse); + + TriggerName name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]"); + + Trigger actualResponse = client.getTrigger(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetTriggerRequest actualRequest = ((GetTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + TriggerName name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]"); + client.getTrigger(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getTriggerTest2() throws Exception { + Trigger expectedResponse = + Trigger.newBuilder() + .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString()) + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllEventFilters(new ArrayList()) + .setServiceAccount(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()) + .setDestination(Destination.newBuilder().build()) + .setTransport(Transport.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEtag("etag3123477") + .build(); + mockEventarc.addResponse(expectedResponse); + + String name = "name3373707"; + + Trigger actualResponse = client.getTrigger(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetTriggerRequest actualRequest = ((GetTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void getTriggerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + String name = "name3373707"; + client.getTrigger(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTriggersTest() throws Exception { + Trigger responsesElement = Trigger.newBuilder().build(); + ListTriggersResponse expectedResponse = + ListTriggersResponse.newBuilder() + .setNextPageToken("") + .addAllTriggers(Arrays.asList(responsesElement)) + .build(); + mockEventarc.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListTriggersPagedResponse pagedListResponse = client.listTriggers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTriggersList().get(0), resources.get(0)); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTriggersRequest actualRequest = ((ListTriggersRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTriggersExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listTriggers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listTriggersTest2() throws Exception { + Trigger responsesElement = Trigger.newBuilder().build(); + ListTriggersResponse expectedResponse = + ListTriggersResponse.newBuilder() + .setNextPageToken("") + .addAllTriggers(Arrays.asList(responsesElement)) + .build(); + mockEventarc.addResponse(expectedResponse); + + String parent = "parent-995424086"; + + ListTriggersPagedResponse pagedListResponse = client.listTriggers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTriggersList().get(0), resources.get(0)); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTriggersRequest actualRequest = ((ListTriggersRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void listTriggersExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + String parent = "parent-995424086"; + client.listTriggers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createTriggerTest() throws Exception { + Trigger expectedResponse = + Trigger.newBuilder() + .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString()) + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllEventFilters(new ArrayList()) + .setServiceAccount(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()) + .setDestination(Destination.newBuilder().build()) + .setTransport(Transport.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createTriggerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockEventarc.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Trigger trigger = Trigger.newBuilder().build(); + String triggerId = "triggerId-648752909"; + + Trigger actualResponse = client.createTriggerAsync(parent, trigger, triggerId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateTriggerRequest actualRequest = ((CreateTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(parent.toString(), actualRequest.getParent()); + Assert.assertEquals(trigger, actualRequest.getTrigger()); + Assert.assertEquals(triggerId, actualRequest.getTriggerId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Trigger trigger = Trigger.newBuilder().build(); + String triggerId = "triggerId-648752909"; + client.createTriggerAsync(parent, trigger, triggerId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void createTriggerTest2() throws Exception { + Trigger expectedResponse = + Trigger.newBuilder() + .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString()) + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllEventFilters(new ArrayList()) + .setServiceAccount(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()) + .setDestination(Destination.newBuilder().build()) + .setTransport(Transport.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createTriggerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockEventarc.addResponse(resultOperation); + + String parent = "parent-995424086"; + Trigger trigger = Trigger.newBuilder().build(); + String triggerId = "triggerId-648752909"; + + Trigger actualResponse = client.createTriggerAsync(parent, trigger, triggerId).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateTriggerRequest actualRequest = ((CreateTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(parent, actualRequest.getParent()); + Assert.assertEquals(trigger, actualRequest.getTrigger()); + Assert.assertEquals(triggerId, actualRequest.getTriggerId()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void createTriggerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + String parent = "parent-995424086"; + Trigger trigger = Trigger.newBuilder().build(); + String triggerId = "triggerId-648752909"; + client.createTriggerAsync(parent, trigger, triggerId).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void updateTriggerTest() throws Exception { + Trigger expectedResponse = + Trigger.newBuilder() + .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString()) + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllEventFilters(new ArrayList()) + .setServiceAccount(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()) + .setDestination(Destination.newBuilder().build()) + .setTransport(Transport.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("updateTriggerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockEventarc.addResponse(resultOperation); + + Trigger trigger = Trigger.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + boolean allowMissing = true; + + Trigger actualResponse = client.updateTriggerAsync(trigger, updateMask, allowMissing).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateTriggerRequest actualRequest = ((UpdateTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(trigger, actualRequest.getTrigger()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertEquals(allowMissing, actualRequest.getAllowMissing()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + Trigger trigger = Trigger.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + boolean allowMissing = true; + client.updateTriggerAsync(trigger, updateMask, allowMissing).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteTriggerTest() throws Exception { + Trigger expectedResponse = + Trigger.newBuilder() + .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString()) + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllEventFilters(new ArrayList()) + .setServiceAccount(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()) + .setDestination(Destination.newBuilder().build()) + .setTransport(Transport.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteTriggerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockEventarc.addResponse(resultOperation); + + TriggerName name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]"); + boolean allowMissing = true; + + Trigger actualResponse = client.deleteTriggerAsync(name, allowMissing).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteTriggerRequest actualRequest = ((DeleteTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name.toString(), actualRequest.getName()); + Assert.assertEquals(allowMissing, actualRequest.getAllowMissing()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteTriggerExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + TriggerName name = TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]"); + boolean allowMissing = true; + client.deleteTriggerAsync(name, allowMissing).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } + + @Test + public void deleteTriggerTest2() throws Exception { + Trigger expectedResponse = + Trigger.newBuilder() + .setName(TriggerName.of("[PROJECT]", "[LOCATION]", "[TRIGGER]").toString()) + .setUid("uid115792") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .addAllEventFilters(new ArrayList()) + .setServiceAccount(ServiceAccountName.of("[PROJECT]", "[SERVICE_ACCOUNT]").toString()) + .setDestination(Destination.newBuilder().build()) + .setTransport(Transport.newBuilder().build()) + .putAllLabels(new HashMap()) + .setEtag("etag3123477") + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteTriggerTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockEventarc.addResponse(resultOperation); + + String name = "name3373707"; + boolean allowMissing = true; + + Trigger actualResponse = client.deleteTriggerAsync(name, allowMissing).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockEventarc.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteTriggerRequest actualRequest = ((DeleteTriggerRequest) actualRequests.get(0)); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(allowMissing, actualRequest.getAllowMissing()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void deleteTriggerExceptionTest2() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockEventarc.addException(exception); + + try { + String name = "name3373707"; + boolean allowMissing = true; + client.deleteTriggerAsync(name, allowMissing).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass()); + InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause()); + Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode()); + } + } +} diff --git a/google-cloud-eventarc/src/test/java/com/google/cloud/eventarc/v1/MockEventarc.java b/google-cloud-eventarc/src/test/java/com/google/cloud/eventarc/v1/MockEventarc.java new file mode 100644 index 00000000..3b5eb31f --- /dev/null +++ b/google-cloud-eventarc/src/test/java/com/google/cloud/eventarc/v1/MockEventarc.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.eventarc.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 MockEventarc implements MockGrpcService { + private final MockEventarcImpl serviceImpl; + + public MockEventarc() { + serviceImpl = new MockEventarcImpl(); + } + + @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-eventarc/src/test/java/com/google/cloud/eventarc/v1/MockEventarcImpl.java b/google-cloud-eventarc/src/test/java/com/google/cloud/eventarc/v1/MockEventarcImpl.java new file mode 100644 index 00000000..197cc67d --- /dev/null +++ b/google-cloud-eventarc/src/test/java/com/google/cloud/eventarc/v1/MockEventarcImpl.java @@ -0,0 +1,165 @@ +/* + * 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.eventarc.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.eventarc.v1.EventarcGrpc.EventarcImplBase; +import com.google.longrunning.Operation; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import javax.annotation.Generated; + +@BetaApi +@Generated("by gapic-generator-java") +public class MockEventarcImpl extends EventarcImplBase { + private List requests; + private Queue responses; + + public MockEventarcImpl() { + 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 getTrigger(GetTriggerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Trigger) { + requests.add(request); + responseObserver.onNext(((Trigger) 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 GetTrigger, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Trigger.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listTriggers( + ListTriggersRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListTriggersResponse) { + requests.add(request); + responseObserver.onNext(((ListTriggersResponse) 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 ListTriggers, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListTriggersResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void createTrigger( + CreateTriggerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateTrigger, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateTrigger( + UpdateTriggerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateTrigger, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteTrigger( + DeleteTriggerRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteTrigger, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } +} diff --git a/grpc-google-cloud-eventarc-v1/pom.xml b/grpc-google-cloud-eventarc-v1/pom.xml new file mode 100644 index 00000000..6a01ae9c --- /dev/null +++ b/grpc-google-cloud-eventarc-v1/pom.xml @@ -0,0 +1,69 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-eventarc-v1 + 0.0.1-SNAPSHOT + grpc-google-cloud-eventarc-v1 + GRPC library for google-cloud-eventarc + + com.google.cloud + google-cloud-eventarc-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-eventarc-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-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventarcGrpc.java b/grpc-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventarcGrpc.java new file mode 100644 index 00000000..41438508 --- /dev/null +++ b/grpc-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventarcGrpc.java @@ -0,0 +1,800 @@ +/* + * 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.eventarc.v1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; + +/** + * + * + *
+ * Eventarc allows users to subscribe to various events that are provided by
+ * Google Cloud services and forward them to supported destinations.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/eventarc/v1/eventarc.proto") +public final class EventarcGrpc { + + private EventarcGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.eventarc.v1.Eventarc"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.GetTriggerRequest, com.google.cloud.eventarc.v1.Trigger> + getGetTriggerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetTrigger", + requestType = com.google.cloud.eventarc.v1.GetTriggerRequest.class, + responseType = com.google.cloud.eventarc.v1.Trigger.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.GetTriggerRequest, com.google.cloud.eventarc.v1.Trigger> + getGetTriggerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.GetTriggerRequest, com.google.cloud.eventarc.v1.Trigger> + getGetTriggerMethod; + if ((getGetTriggerMethod = EventarcGrpc.getGetTriggerMethod) == null) { + synchronized (EventarcGrpc.class) { + if ((getGetTriggerMethod = EventarcGrpc.getGetTriggerMethod) == null) { + EventarcGrpc.getGetTriggerMethod = + getGetTriggerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetTrigger")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.eventarc.v1.GetTriggerRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.eventarc.v1.Trigger.getDefaultInstance())) + .setSchemaDescriptor(new EventarcMethodDescriptorSupplier("GetTrigger")) + .build(); + } + } + } + return getGetTriggerMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.ListTriggersRequest, + com.google.cloud.eventarc.v1.ListTriggersResponse> + getListTriggersMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListTriggers", + requestType = com.google.cloud.eventarc.v1.ListTriggersRequest.class, + responseType = com.google.cloud.eventarc.v1.ListTriggersResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.ListTriggersRequest, + com.google.cloud.eventarc.v1.ListTriggersResponse> + getListTriggersMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.ListTriggersRequest, + com.google.cloud.eventarc.v1.ListTriggersResponse> + getListTriggersMethod; + if ((getListTriggersMethod = EventarcGrpc.getListTriggersMethod) == null) { + synchronized (EventarcGrpc.class) { + if ((getListTriggersMethod = EventarcGrpc.getListTriggersMethod) == null) { + EventarcGrpc.getListTriggersMethod = + getListTriggersMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListTriggers")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.eventarc.v1.ListTriggersRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.eventarc.v1.ListTriggersResponse + .getDefaultInstance())) + .setSchemaDescriptor(new EventarcMethodDescriptorSupplier("ListTriggers")) + .build(); + } + } + } + return getListTriggersMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.CreateTriggerRequest, com.google.longrunning.Operation> + getCreateTriggerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateTrigger", + requestType = com.google.cloud.eventarc.v1.CreateTriggerRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.CreateTriggerRequest, com.google.longrunning.Operation> + getCreateTriggerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.CreateTriggerRequest, com.google.longrunning.Operation> + getCreateTriggerMethod; + if ((getCreateTriggerMethod = EventarcGrpc.getCreateTriggerMethod) == null) { + synchronized (EventarcGrpc.class) { + if ((getCreateTriggerMethod = EventarcGrpc.getCreateTriggerMethod) == null) { + EventarcGrpc.getCreateTriggerMethod = + getCreateTriggerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateTrigger")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.eventarc.v1.CreateTriggerRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new EventarcMethodDescriptorSupplier("CreateTrigger")) + .build(); + } + } + } + return getCreateTriggerMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.UpdateTriggerRequest, com.google.longrunning.Operation> + getUpdateTriggerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateTrigger", + requestType = com.google.cloud.eventarc.v1.UpdateTriggerRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.UpdateTriggerRequest, com.google.longrunning.Operation> + getUpdateTriggerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.UpdateTriggerRequest, com.google.longrunning.Operation> + getUpdateTriggerMethod; + if ((getUpdateTriggerMethod = EventarcGrpc.getUpdateTriggerMethod) == null) { + synchronized (EventarcGrpc.class) { + if ((getUpdateTriggerMethod = EventarcGrpc.getUpdateTriggerMethod) == null) { + EventarcGrpc.getUpdateTriggerMethod = + getUpdateTriggerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateTrigger")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.eventarc.v1.UpdateTriggerRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new EventarcMethodDescriptorSupplier("UpdateTrigger")) + .build(); + } + } + } + return getUpdateTriggerMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.DeleteTriggerRequest, com.google.longrunning.Operation> + getDeleteTriggerMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteTrigger", + requestType = com.google.cloud.eventarc.v1.DeleteTriggerRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.DeleteTriggerRequest, com.google.longrunning.Operation> + getDeleteTriggerMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.eventarc.v1.DeleteTriggerRequest, com.google.longrunning.Operation> + getDeleteTriggerMethod; + if ((getDeleteTriggerMethod = EventarcGrpc.getDeleteTriggerMethod) == null) { + synchronized (EventarcGrpc.class) { + if ((getDeleteTriggerMethod = EventarcGrpc.getDeleteTriggerMethod) == null) { + EventarcGrpc.getDeleteTriggerMethod = + getDeleteTriggerMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteTrigger")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.eventarc.v1.DeleteTriggerRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor(new EventarcMethodDescriptorSupplier("DeleteTrigger")) + .build(); + } + } + } + return getDeleteTriggerMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static EventarcStub newStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EventarcStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EventarcStub(channel, callOptions); + } + }; + return EventarcStub.newStub(factory, channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static EventarcBlockingStub newBlockingStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EventarcBlockingStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EventarcBlockingStub(channel, callOptions); + } + }; + return EventarcBlockingStub.newStub(factory, channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static EventarcFutureStub newFutureStub(io.grpc.Channel channel) { + io.grpc.stub.AbstractStub.StubFactory factory = + new io.grpc.stub.AbstractStub.StubFactory() { + @java.lang.Override + public EventarcFutureStub newStub( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EventarcFutureStub(channel, callOptions); + } + }; + return EventarcFutureStub.newStub(factory, channel); + } + + /** + * + * + *
+   * Eventarc allows users to subscribe to various events that are provided by
+   * Google Cloud services and forward them to supported destinations.
+   * 
+ */ + public abstract static class EventarcImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Get a single trigger.
+     * 
+ */ + public void getTrigger( + com.google.cloud.eventarc.v1.GetTriggerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetTriggerMethod(), responseObserver); + } + + /** + * + * + *
+     * List triggers.
+     * 
+ */ + public void listTriggers( + com.google.cloud.eventarc.v1.ListTriggersRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListTriggersMethod(), responseObserver); + } + + /** + * + * + *
+     * Create a new trigger in a particular project and location.
+     * 
+ */ + public void createTrigger( + com.google.cloud.eventarc.v1.CreateTriggerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateTriggerMethod(), responseObserver); + } + + /** + * + * + *
+     * Update a single trigger.
+     * 
+ */ + public void updateTrigger( + com.google.cloud.eventarc.v1.UpdateTriggerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateTriggerMethod(), responseObserver); + } + + /** + * + * + *
+     * Delete a single trigger.
+     * 
+ */ + public void deleteTrigger( + com.google.cloud.eventarc.v1.DeleteTriggerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteTriggerMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetTriggerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.eventarc.v1.GetTriggerRequest, + com.google.cloud.eventarc.v1.Trigger>(this, METHODID_GET_TRIGGER))) + .addMethod( + getListTriggersMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.eventarc.v1.ListTriggersRequest, + com.google.cloud.eventarc.v1.ListTriggersResponse>( + this, METHODID_LIST_TRIGGERS))) + .addMethod( + getCreateTriggerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.eventarc.v1.CreateTriggerRequest, + com.google.longrunning.Operation>(this, METHODID_CREATE_TRIGGER))) + .addMethod( + getUpdateTriggerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.eventarc.v1.UpdateTriggerRequest, + com.google.longrunning.Operation>(this, METHODID_UPDATE_TRIGGER))) + .addMethod( + getDeleteTriggerMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.eventarc.v1.DeleteTriggerRequest, + com.google.longrunning.Operation>(this, METHODID_DELETE_TRIGGER))) + .build(); + } + } + + /** + * + * + *
+   * Eventarc allows users to subscribe to various events that are provided by
+   * Google Cloud services and forward them to supported destinations.
+   * 
+ */ + public static final class EventarcStub extends io.grpc.stub.AbstractAsyncStub { + private EventarcStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EventarcStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EventarcStub(channel, callOptions); + } + + /** + * + * + *
+     * Get a single trigger.
+     * 
+ */ + public void getTrigger( + com.google.cloud.eventarc.v1.GetTriggerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetTriggerMethod(), getCallOptions()), request, responseObserver); + } + + /** + * + * + *
+     * List triggers.
+     * 
+ */ + public void listTriggers( + com.google.cloud.eventarc.v1.ListTriggersRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListTriggersMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Create a new trigger in a particular project and location.
+     * 
+ */ + public void createTrigger( + com.google.cloud.eventarc.v1.CreateTriggerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateTriggerMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Update a single trigger.
+     * 
+ */ + public void updateTrigger( + com.google.cloud.eventarc.v1.UpdateTriggerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateTriggerMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Delete a single trigger.
+     * 
+ */ + public void deleteTrigger( + com.google.cloud.eventarc.v1.DeleteTriggerRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteTriggerMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Eventarc allows users to subscribe to various events that are provided by
+   * Google Cloud services and forward them to supported destinations.
+   * 
+ */ + public static final class EventarcBlockingStub + extends io.grpc.stub.AbstractBlockingStub { + private EventarcBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EventarcBlockingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EventarcBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Get a single trigger.
+     * 
+ */ + public com.google.cloud.eventarc.v1.Trigger getTrigger( + com.google.cloud.eventarc.v1.GetTriggerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetTriggerMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * List triggers.
+     * 
+ */ + public com.google.cloud.eventarc.v1.ListTriggersResponse listTriggers( + com.google.cloud.eventarc.v1.ListTriggersRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListTriggersMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Create a new trigger in a particular project and location.
+     * 
+ */ + public com.google.longrunning.Operation createTrigger( + com.google.cloud.eventarc.v1.CreateTriggerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateTriggerMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Update a single trigger.
+     * 
+ */ + public com.google.longrunning.Operation updateTrigger( + com.google.cloud.eventarc.v1.UpdateTriggerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateTriggerMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Delete a single trigger.
+     * 
+ */ + public com.google.longrunning.Operation deleteTrigger( + com.google.cloud.eventarc.v1.DeleteTriggerRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteTriggerMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Eventarc allows users to subscribe to various events that are provided by
+   * Google Cloud services and forward them to supported destinations.
+   * 
+ */ + public static final class EventarcFutureStub + extends io.grpc.stub.AbstractFutureStub { + private EventarcFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected EventarcFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new EventarcFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Get a single trigger.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getTrigger(com.google.cloud.eventarc.v1.GetTriggerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetTriggerMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * List triggers.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.eventarc.v1.ListTriggersResponse> + listTriggers(com.google.cloud.eventarc.v1.ListTriggersRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListTriggersMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Create a new trigger in a particular project and location.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + createTrigger(com.google.cloud.eventarc.v1.CreateTriggerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateTriggerMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Update a single trigger.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + updateTrigger(com.google.cloud.eventarc.v1.UpdateTriggerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateTriggerMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Delete a single trigger.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteTrigger(com.google.cloud.eventarc.v1.DeleteTriggerRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteTriggerMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_GET_TRIGGER = 0; + private static final int METHODID_LIST_TRIGGERS = 1; + private static final int METHODID_CREATE_TRIGGER = 2; + private static final int METHODID_UPDATE_TRIGGER = 3; + private static final int METHODID_DELETE_TRIGGER = 4; + + 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 EventarcImplBase serviceImpl; + private final int methodId; + + MethodHandlers(EventarcImplBase 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_GET_TRIGGER: + serviceImpl.getTrigger( + (com.google.cloud.eventarc.v1.GetTriggerRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_TRIGGERS: + serviceImpl.listTriggers( + (com.google.cloud.eventarc.v1.ListTriggersRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_CREATE_TRIGGER: + serviceImpl.createTrigger( + (com.google.cloud.eventarc.v1.CreateTriggerRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_UPDATE_TRIGGER: + serviceImpl.updateTrigger( + (com.google.cloud.eventarc.v1.UpdateTriggerRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_DELETE_TRIGGER: + serviceImpl.deleteTrigger( + (com.google.cloud.eventarc.v1.DeleteTriggerRequest) 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 EventarcBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + EventarcBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("Eventarc"); + } + } + + private static final class EventarcFileDescriptorSupplier extends EventarcBaseDescriptorSupplier { + EventarcFileDescriptorSupplier() {} + } + + private static final class EventarcMethodDescriptorSupplier extends EventarcBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + EventarcMethodDescriptorSupplier(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 (EventarcGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new EventarcFileDescriptorSupplier()) + .addMethod(getGetTriggerMethod()) + .addMethod(getListTriggersMethod()) + .addMethod(getCreateTriggerMethod()) + .addMethod(getUpdateTriggerMethod()) + .addMethod(getDeleteTriggerMethod()) + .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..c8788ae3 --- /dev/null +++ b/pom.xml @@ -0,0 +1,179 @@ + + + 4.0.0 + com.google.cloud + google-cloud-eventarc-parent + pom + 0.0.1-SNAPSHOT + Google Eventarc Parent + https://github.com/googleapis/java-eventarc + + 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-eventarc.git + scm:git:git@github.com:googleapis/java-eventarc.git + https://github.com/googleapis/java-eventarc + HEAD + + + https://github.com/googleapis/java-eventarc/issues + GitHub Issues + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-eventarc-parent + + + + + + com.google.cloud + google-cloud-eventarc + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-eventarc-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-eventarc-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-eventarc + grpc-google-cloud-eventarc-v1 + proto-google-cloud-eventarc-v1 + google-cloud-eventarc-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-eventarc-v1/clirr-ignored-differences.xml b/proto-google-cloud-eventarc-v1/clirr-ignored-differences.xml new file mode 100644 index 00000000..ea169713 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/clirr-ignored-differences.xml @@ -0,0 +1,19 @@ + + + + + 7012 + com/google/cloud/eventarc/v1/*OrBuilder + * get*(*) + + + 7012 + com/google/cloud/eventarc/v1/*OrBuilder + boolean contains*(*) + + + 7012 + com/google/cloud/eventarc/v1/*OrBuilder + boolean has*(*) + + diff --git a/proto-google-cloud-eventarc-v1/pom.xml b/proto-google-cloud-eventarc-v1/pom.xml new file mode 100644 index 00000000..7f53b3af --- /dev/null +++ b/proto-google-cloud-eventarc-v1/pom.xml @@ -0,0 +1,46 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-eventarc-v1 + 0.0.1-SNAPSHOT + proto-google-cloud-eventarc-v1 + Proto library for google-cloud-eventarc + + com.google.cloud + google-cloud-eventarc-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-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CloudRun.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CloudRun.java new file mode 100644 index 00000000..808bdd90 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CloudRun.java @@ -0,0 +1,1046 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * Represents a Cloud Run destination.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.CloudRun} + */ +public final class CloudRun extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.CloudRun) + CloudRunOrBuilder { + private static final long serialVersionUID = 0L; + // Use CloudRun.newBuilder() to construct. + private CloudRun(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CloudRun() { + service_ = ""; + path_ = ""; + region_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CloudRun(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CloudRun( + 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(); + + service_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + path_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + region_ = 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.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_CloudRun_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_CloudRun_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.CloudRun.class, + com.google.cloud.eventarc.v1.CloudRun.Builder.class); + } + + public static final int SERVICE_FIELD_NUMBER = 1; + private volatile java.lang.Object service_; + /** + * + * + *
+   * Required. The name of the Cloud Run service being addressed. See
+   * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+   * Only services located in the same project of the trigger object
+   * can be addressed.
+   * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The service. + */ + @java.lang.Override + public java.lang.String getService() { + java.lang.Object ref = service_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + service_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Cloud Run service being addressed. See
+   * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+   * Only services located in the same project of the trigger object
+   * can be addressed.
+   * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for service. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceBytes() { + java.lang.Object ref = service_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + service_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PATH_FIELD_NUMBER = 2; + private volatile java.lang.Object path_; + /** + * + * + *
+   * Optional. The relative path on the Cloud Run service the events should be
+   * sent to.
+   * The value must conform to the definition of URI path segment (section 3.3
+   * of RFC2396). Examples: "/route", "route", "route/subroute".
+   * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The path. + */ + @java.lang.Override + public java.lang.String getPath() { + java.lang.Object ref = path_; + 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(); + path_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The relative path on the Cloud Run service the events should be
+   * sent to.
+   * The value must conform to the definition of URI path segment (section 3.3
+   * of RFC2396). Examples: "/route", "route", "route/subroute".
+   * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for path. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REGION_FIELD_NUMBER = 3; + private volatile java.lang.Object region_; + /** + * + * + *
+   * Required. The region the Cloud Run service is deployed in.
+   * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The region. + */ + @java.lang.Override + public java.lang.String getRegion() { + java.lang.Object ref = region_; + 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(); + region_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The region the Cloud Run service is deployed in.
+   * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for region. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRegionBytes() { + java.lang.Object ref = region_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + region_ = 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 (!getServiceBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, service_); + } + if (!getPathBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, path_); + } + if (!getRegionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, region_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getServiceBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, service_); + } + if (!getPathBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, path_); + } + if (!getRegionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, region_); + } + 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.eventarc.v1.CloudRun)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.CloudRun other = (com.google.cloud.eventarc.v1.CloudRun) obj; + + if (!getService().equals(other.getService())) return false; + if (!getPath().equals(other.getPath())) return false; + if (!getRegion().equals(other.getRegion())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SERVICE_FIELD_NUMBER; + hash = (53 * hash) + getService().hashCode(); + hash = (37 * hash) + PATH_FIELD_NUMBER; + hash = (53 * hash) + getPath().hashCode(); + hash = (37 * hash) + REGION_FIELD_NUMBER; + hash = (53 * hash) + getRegion().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.CloudRun parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.CloudRun 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.eventarc.v1.CloudRun parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.CloudRun 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.eventarc.v1.CloudRun parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.CloudRun parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.CloudRun parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.CloudRun 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.eventarc.v1.CloudRun parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.CloudRun 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.eventarc.v1.CloudRun parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.CloudRun 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.eventarc.v1.CloudRun 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; + } + /** + * + * + *
+   * Represents a Cloud Run destination.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.CloudRun} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.CloudRun) + com.google.cloud.eventarc.v1.CloudRunOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_CloudRun_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_CloudRun_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.CloudRun.class, + com.google.cloud.eventarc.v1.CloudRun.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.CloudRun.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + service_ = ""; + + path_ = ""; + + region_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_CloudRun_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.CloudRun getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.CloudRun build() { + com.google.cloud.eventarc.v1.CloudRun result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.CloudRun buildPartial() { + com.google.cloud.eventarc.v1.CloudRun result = + new com.google.cloud.eventarc.v1.CloudRun(this); + result.service_ = service_; + result.path_ = path_; + result.region_ = region_; + 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.eventarc.v1.CloudRun) { + return mergeFrom((com.google.cloud.eventarc.v1.CloudRun) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.CloudRun other) { + if (other == com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance()) return this; + if (!other.getService().isEmpty()) { + service_ = other.service_; + onChanged(); + } + if (!other.getPath().isEmpty()) { + path_ = other.path_; + onChanged(); + } + if (!other.getRegion().isEmpty()) { + region_ = other.region_; + 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.eventarc.v1.CloudRun parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.CloudRun) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object service_ = ""; + /** + * + * + *
+     * Required. The name of the Cloud Run service being addressed. See
+     * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+     * Only services located in the same project of the trigger object
+     * can be addressed.
+     * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The service. + */ + public java.lang.String getService() { + java.lang.Object ref = service_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + service_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Cloud Run service being addressed. See
+     * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+     * Only services located in the same project of the trigger object
+     * can be addressed.
+     * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for service. + */ + public com.google.protobuf.ByteString getServiceBytes() { + java.lang.Object ref = service_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + service_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Cloud Run service being addressed. See
+     * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+     * Only services located in the same project of the trigger object
+     * can be addressed.
+     * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The service to set. + * @return This builder for chaining. + */ + public Builder setService(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + service_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Cloud Run service being addressed. See
+     * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+     * Only services located in the same project of the trigger object
+     * can be addressed.
+     * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearService() { + + service_ = getDefaultInstance().getService(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Cloud Run service being addressed. See
+     * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+     * Only services located in the same project of the trigger object
+     * can be addressed.
+     * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for service to set. + * @return This builder for chaining. + */ + public Builder setServiceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + service_ = value; + onChanged(); + return this; + } + + private java.lang.Object path_ = ""; + /** + * + * + *
+     * Optional. The relative path on the Cloud Run service the events should be
+     * sent to.
+     * The value must conform to the definition of URI path segment (section 3.3
+     * of RFC2396). Examples: "/route", "route", "route/subroute".
+     * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The path. + */ + public java.lang.String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + path_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The relative path on the Cloud Run service the events should be
+     * sent to.
+     * The value must conform to the definition of URI path segment (section 3.3
+     * of RFC2396). Examples: "/route", "route", "route/subroute".
+     * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for path. + */ + public com.google.protobuf.ByteString getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The relative path on the Cloud Run service the events should be
+     * sent to.
+     * The value must conform to the definition of URI path segment (section 3.3
+     * of RFC2396). Examples: "/route", "route", "route/subroute".
+     * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The path to set. + * @return This builder for chaining. + */ + public Builder setPath(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + path_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The relative path on the Cloud Run service the events should be
+     * sent to.
+     * The value must conform to the definition of URI path segment (section 3.3
+     * of RFC2396). Examples: "/route", "route", "route/subroute".
+     * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPath() { + + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The relative path on the Cloud Run service the events should be
+     * sent to.
+     * The value must conform to the definition of URI path segment (section 3.3
+     * of RFC2396). Examples: "/route", "route", "route/subroute".
+     * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for path to set. + * @return This builder for chaining. + */ + public Builder setPathBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + path_ = value; + onChanged(); + return this; + } + + private java.lang.Object region_ = ""; + /** + * + * + *
+     * Required. The region the Cloud Run service is deployed in.
+     * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The region. + */ + public java.lang.String getRegion() { + java.lang.Object ref = region_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + region_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The region the Cloud Run service is deployed in.
+     * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for region. + */ + public com.google.protobuf.ByteString getRegionBytes() { + java.lang.Object ref = region_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + region_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The region the Cloud Run service is deployed in.
+     * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The region to set. + * @return This builder for chaining. + */ + public Builder setRegion(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + region_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The region the Cloud Run service is deployed in.
+     * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearRegion() { + + region_ = getDefaultInstance().getRegion(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The region the Cloud Run service is deployed in.
+     * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for region to set. + * @return This builder for chaining. + */ + public Builder setRegionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + region_ = 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.eventarc.v1.CloudRun) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.CloudRun) + private static final com.google.cloud.eventarc.v1.CloudRun DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.CloudRun(); + } + + public static com.google.cloud.eventarc.v1.CloudRun getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CloudRun parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CloudRun(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.eventarc.v1.CloudRun getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CloudRunOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CloudRunOrBuilder.java new file mode 100644 index 00000000..d9682d3b --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CloudRunOrBuilder.java @@ -0,0 +1,116 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +public interface CloudRunOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.CloudRun) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Cloud Run service being addressed. See
+   * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+   * Only services located in the same project of the trigger object
+   * can be addressed.
+   * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The service. + */ + java.lang.String getService(); + /** + * + * + *
+   * Required. The name of the Cloud Run service being addressed. See
+   * https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services.
+   * Only services located in the same project of the trigger object
+   * can be addressed.
+   * 
+ * + * + * string service = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for service. + */ + com.google.protobuf.ByteString getServiceBytes(); + + /** + * + * + *
+   * Optional. The relative path on the Cloud Run service the events should be
+   * sent to.
+   * The value must conform to the definition of URI path segment (section 3.3
+   * of RFC2396). Examples: "/route", "route", "route/subroute".
+   * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The path. + */ + java.lang.String getPath(); + /** + * + * + *
+   * Optional. The relative path on the Cloud Run service the events should be
+   * sent to.
+   * The value must conform to the definition of URI path segment (section 3.3
+   * of RFC2396). Examples: "/route", "route", "route/subroute".
+   * 
+ * + * string path = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for path. + */ + com.google.protobuf.ByteString getPathBytes(); + + /** + * + * + *
+   * Required. The region the Cloud Run service is deployed in.
+   * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The region. + */ + java.lang.String getRegion(); + /** + * + * + *
+   * Required. The region the Cloud Run service is deployed in.
+   * 
+ * + * string region = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for region. + */ + com.google.protobuf.ByteString getRegionBytes(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CreateTriggerRequest.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CreateTriggerRequest.java new file mode 100644 index 00000000..a8aeb13c --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CreateTriggerRequest.java @@ -0,0 +1,1219 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * The request message for the CreateTrigger method.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.CreateTriggerRequest} + */ +public final class CreateTriggerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.CreateTriggerRequest) + CreateTriggerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateTriggerRequest.newBuilder() to construct. + private CreateTriggerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateTriggerRequest() { + parent_ = ""; + triggerId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateTriggerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateTriggerRequest( + 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.eventarc.v1.Trigger.Builder subBuilder = null; + if (trigger_ != null) { + subBuilder = trigger_.toBuilder(); + } + trigger_ = + input.readMessage( + com.google.cloud.eventarc.v1.Trigger.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(trigger_); + trigger_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + triggerId_ = s; + break; + } + case 32: + { + validateOnly_ = input.readBool(); + 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.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.CreateTriggerRequest.class, + com.google.cloud.eventarc.v1.CreateTriggerRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The parent collection in which to add this trigger.
+   * 
+ * + * + * 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 collection in which to add this trigger.
+   * 
+ * + * + * 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 TRIGGER_FIELD_NUMBER = 2; + private com.google.cloud.eventarc.v1.Trigger trigger_; + /** + * + * + *
+   * Required. The trigger to create.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the trigger field is set. + */ + @java.lang.Override + public boolean hasTrigger() { + return trigger_ != null; + } + /** + * + * + *
+   * Required. The trigger to create.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The trigger. + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.Trigger getTrigger() { + return trigger_ == null ? com.google.cloud.eventarc.v1.Trigger.getDefaultInstance() : trigger_; + } + /** + * + * + *
+   * Required. The trigger to create.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggerOrBuilder() { + return getTrigger(); + } + + public static final int TRIGGER_ID_FIELD_NUMBER = 3; + private volatile java.lang.Object triggerId_; + /** + * + * + *
+   * Required. The user-provided ID to be assigned to the trigger.
+   * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The triggerId. + */ + @java.lang.Override + public java.lang.String getTriggerId() { + java.lang.Object ref = triggerId_; + 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(); + triggerId_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The user-provided ID to be assigned to the trigger.
+   * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for triggerId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTriggerIdBytes() { + java.lang.Object ref = triggerId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + triggerId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; + private boolean validateOnly_; + /** + * + * + *
+   * Required. If set, validate the request and preview the review, but do not actually
+   * post it.
+   * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + 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 (trigger_ != null) { + output.writeMessage(2, getTrigger()); + } + if (!getTriggerIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, triggerId_); + } + if (validateOnly_ != false) { + output.writeBool(4, validateOnly_); + } + 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 (trigger_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getTrigger()); + } + if (!getTriggerIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, triggerId_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); + } + 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.eventarc.v1.CreateTriggerRequest)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.CreateTriggerRequest other = + (com.google.cloud.eventarc.v1.CreateTriggerRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasTrigger() != other.hasTrigger()) return false; + if (hasTrigger()) { + if (!getTrigger().equals(other.getTrigger())) return false; + } + if (!getTriggerId().equals(other.getTriggerId())) return false; + if (getValidateOnly() != other.getValidateOnly()) 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 (hasTrigger()) { + hash = (37 * hash) + TRIGGER_FIELD_NUMBER; + hash = (53 * hash) + getTrigger().hashCode(); + } + hash = (37 * hash) + TRIGGER_ID_FIELD_NUMBER; + hash = (53 * hash) + getTriggerId().hashCode(); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest 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.eventarc.v1.CreateTriggerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest 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.eventarc.v1.CreateTriggerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest 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.eventarc.v1.CreateTriggerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest 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.eventarc.v1.CreateTriggerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest 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.eventarc.v1.CreateTriggerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request message for the CreateTrigger method.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.CreateTriggerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.CreateTriggerRequest) + com.google.cloud.eventarc.v1.CreateTriggerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.CreateTriggerRequest.class, + com.google.cloud.eventarc.v1.CreateTriggerRequest.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.CreateTriggerRequest.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 (triggerBuilder_ == null) { + trigger_ = null; + } else { + trigger_ = null; + triggerBuilder_ = null; + } + triggerId_ = ""; + + validateOnly_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.CreateTriggerRequest getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.CreateTriggerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.CreateTriggerRequest build() { + com.google.cloud.eventarc.v1.CreateTriggerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.CreateTriggerRequest buildPartial() { + com.google.cloud.eventarc.v1.CreateTriggerRequest result = + new com.google.cloud.eventarc.v1.CreateTriggerRequest(this); + result.parent_ = parent_; + if (triggerBuilder_ == null) { + result.trigger_ = trigger_; + } else { + result.trigger_ = triggerBuilder_.build(); + } + result.triggerId_ = triggerId_; + result.validateOnly_ = validateOnly_; + 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.eventarc.v1.CreateTriggerRequest) { + return mergeFrom((com.google.cloud.eventarc.v1.CreateTriggerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.CreateTriggerRequest other) { + if (other == com.google.cloud.eventarc.v1.CreateTriggerRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasTrigger()) { + mergeTrigger(other.getTrigger()); + } + if (!other.getTriggerId().isEmpty()) { + triggerId_ = other.triggerId_; + onChanged(); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + 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.eventarc.v1.CreateTriggerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.eventarc.v1.CreateTriggerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent collection in which to add this trigger.
+     * 
+ * + * + * 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 collection in which to add this trigger.
+     * 
+ * + * + * 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 collection in which to add this trigger.
+     * 
+ * + * + * 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 collection in which to add this trigger.
+     * 
+ * + * + * 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 collection in which to add this trigger.
+     * 
+ * + * + * 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.eventarc.v1.Trigger trigger_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder> + triggerBuilder_; + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the trigger field is set. + */ + public boolean hasTrigger() { + return triggerBuilder_ != null || trigger_ != null; + } + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The trigger. + */ + public com.google.cloud.eventarc.v1.Trigger getTrigger() { + if (triggerBuilder_ == null) { + return trigger_ == null + ? com.google.cloud.eventarc.v1.Trigger.getDefaultInstance() + : trigger_; + } else { + return triggerBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setTrigger(com.google.cloud.eventarc.v1.Trigger value) { + if (triggerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + trigger_ = value; + onChanged(); + } else { + triggerBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setTrigger(com.google.cloud.eventarc.v1.Trigger.Builder builderForValue) { + if (triggerBuilder_ == null) { + trigger_ = builderForValue.build(); + onChanged(); + } else { + triggerBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeTrigger(com.google.cloud.eventarc.v1.Trigger value) { + if (triggerBuilder_ == null) { + if (trigger_ != null) { + trigger_ = + com.google.cloud.eventarc.v1.Trigger.newBuilder(trigger_) + .mergeFrom(value) + .buildPartial(); + } else { + trigger_ = value; + } + onChanged(); + } else { + triggerBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearTrigger() { + if (triggerBuilder_ == null) { + trigger_ = null; + onChanged(); + } else { + trigger_ = null; + triggerBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.Trigger.Builder getTriggerBuilder() { + + onChanged(); + return getTriggerFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggerOrBuilder() { + if (triggerBuilder_ != null) { + return triggerBuilder_.getMessageOrBuilder(); + } else { + return trigger_ == null + ? com.google.cloud.eventarc.v1.Trigger.getDefaultInstance() + : trigger_; + } + } + /** + * + * + *
+     * Required. The trigger to create.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder> + getTriggerFieldBuilder() { + if (triggerBuilder_ == null) { + triggerBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder>( + getTrigger(), getParentForChildren(), isClean()); + trigger_ = null; + } + return triggerBuilder_; + } + + private java.lang.Object triggerId_ = ""; + /** + * + * + *
+     * Required. The user-provided ID to be assigned to the trigger.
+     * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The triggerId. + */ + public java.lang.String getTriggerId() { + java.lang.Object ref = triggerId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + triggerId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The user-provided ID to be assigned to the trigger.
+     * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for triggerId. + */ + public com.google.protobuf.ByteString getTriggerIdBytes() { + java.lang.Object ref = triggerId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + triggerId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The user-provided ID to be assigned to the trigger.
+     * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The triggerId to set. + * @return This builder for chaining. + */ + public Builder setTriggerId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + triggerId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The user-provided ID to be assigned to the trigger.
+     * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearTriggerId() { + + triggerId_ = getDefaultInstance().getTriggerId(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The user-provided ID to be assigned to the trigger.
+     * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for triggerId to set. + * @return This builder for chaining. + */ + public Builder setTriggerIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + triggerId_ = value; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.eventarc.v1.CreateTriggerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.CreateTriggerRequest) + private static final com.google.cloud.eventarc.v1.CreateTriggerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.CreateTriggerRequest(); + } + + public static com.google.cloud.eventarc.v1.CreateTriggerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateTriggerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateTriggerRequest(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.eventarc.v1.CreateTriggerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CreateTriggerRequestOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CreateTriggerRequestOrBuilder.java new file mode 100644 index 00000000..24a703c2 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/CreateTriggerRequestOrBuilder.java @@ -0,0 +1,131 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +public interface CreateTriggerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.CreateTriggerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent collection in which to add this trigger.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent collection in which to add this trigger.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. The trigger to create.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the trigger field is set. + */ + boolean hasTrigger(); + /** + * + * + *
+   * Required. The trigger to create.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The trigger. + */ + com.google.cloud.eventarc.v1.Trigger getTrigger(); + /** + * + * + *
+   * Required. The trigger to create.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggerOrBuilder(); + + /** + * + * + *
+   * Required. The user-provided ID to be assigned to the trigger.
+   * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The triggerId. + */ + java.lang.String getTriggerId(); + /** + * + * + *
+   * Required. The user-provided ID to be assigned to the trigger.
+   * 
+ * + * string trigger_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for triggerId. + */ + com.google.protobuf.ByteString getTriggerIdBytes(); + + /** + * + * + *
+   * Required. If set, validate the request and preview the review, but do not actually
+   * post it.
+   * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DeleteTriggerRequest.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DeleteTriggerRequest.java new file mode 100644 index 00000000..ca8e0a36 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DeleteTriggerRequest.java @@ -0,0 +1,1024 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * The request message for the DeleteTrigger method.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.DeleteTriggerRequest} + */ +public final class DeleteTriggerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.DeleteTriggerRequest) + DeleteTriggerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteTriggerRequest.newBuilder() to construct. + private DeleteTriggerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteTriggerRequest() { + name_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteTriggerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteTriggerRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + case 24: + { + allowMissing_ = input.readBool(); + break; + } + case 32: + { + validateOnly_ = input.readBool(); + 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.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.DeleteTriggerRequest.class, + com.google.cloud.eventarc.v1.DeleteTriggerRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the trigger to be deleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the trigger to be deleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ETAG_FIELD_NUMBER = 2; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * If provided, the trigger will only be deleted if the etag matches the
+   * current etag on the resource.
+   * 
+ * + * string etag = 2; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * If provided, the trigger will only be deleted if the etag matches the
+   * current etag on the resource.
+   * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ALLOW_MISSING_FIELD_NUMBER = 3; + private boolean allowMissing_; + /** + * + * + *
+   * If set to true, and the trigger is not found, the request will succeed
+   * but no action will be taken on the server.
+   * 
+ * + * bool allow_missing = 3; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; + private boolean validateOnly_; + /** + * + * + *
+   * Required. If set, validate the request and preview the review, but do not actually
+   * post it.
+   * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + 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_); + } + if (!getEtagBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, etag_); + } + if (allowMissing_ != false) { + output.writeBool(3, allowMissing_); + } + if (validateOnly_ != false) { + output.writeBool(4, validateOnly_); + } + 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 (!getEtagBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, etag_); + } + if (allowMissing_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, allowMissing_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); + } + 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.eventarc.v1.DeleteTriggerRequest)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.DeleteTriggerRequest other = + (com.google.cloud.eventarc.v1.DeleteTriggerRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (getAllowMissing() != other.getAllowMissing()) return false; + if (getValidateOnly() != other.getValidateOnly()) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (37 * hash) + ALLOW_MISSING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowMissing()); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest 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.eventarc.v1.DeleteTriggerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest 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.eventarc.v1.DeleteTriggerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest 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.eventarc.v1.DeleteTriggerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest 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.eventarc.v1.DeleteTriggerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest 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.eventarc.v1.DeleteTriggerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request message for the DeleteTrigger method.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.DeleteTriggerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.DeleteTriggerRequest) + com.google.cloud.eventarc.v1.DeleteTriggerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.DeleteTriggerRequest.class, + com.google.cloud.eventarc.v1.DeleteTriggerRequest.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.DeleteTriggerRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + etag_ = ""; + + allowMissing_ = false; + + validateOnly_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.DeleteTriggerRequest getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.DeleteTriggerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.DeleteTriggerRequest build() { + com.google.cloud.eventarc.v1.DeleteTriggerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.DeleteTriggerRequest buildPartial() { + com.google.cloud.eventarc.v1.DeleteTriggerRequest result = + new com.google.cloud.eventarc.v1.DeleteTriggerRequest(this); + result.name_ = name_; + result.etag_ = etag_; + result.allowMissing_ = allowMissing_; + result.validateOnly_ = validateOnly_; + 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.eventarc.v1.DeleteTriggerRequest) { + return mergeFrom((com.google.cloud.eventarc.v1.DeleteTriggerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.DeleteTriggerRequest other) { + if (other == com.google.cloud.eventarc.v1.DeleteTriggerRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + if (other.getAllowMissing() != false) { + setAllowMissing(other.getAllowMissing()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + 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.eventarc.v1.DeleteTriggerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.eventarc.v1.DeleteTriggerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the trigger to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the trigger to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the trigger to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the trigger to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the trigger to be deleted.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * If provided, the trigger will only be deleted if the etag matches the
+     * current etag on the resource.
+     * 
+ * + * string etag = 2; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * If provided, the trigger will only be deleted if the etag matches the
+     * current etag on the resource.
+     * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * If provided, the trigger will only be deleted if the etag matches the
+     * current etag on the resource.
+     * 
+ * + * string etag = 2; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If provided, the trigger will only be deleted if the etag matches the
+     * current etag on the resource.
+     * 
+ * + * string etag = 2; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * If provided, the trigger will only be deleted if the etag matches the
+     * current etag on the resource.
+     * 
+ * + * string etag = 2; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + private boolean allowMissing_; + /** + * + * + *
+     * If set to true, and the trigger is not found, the request will succeed
+     * but no action will be taken on the server.
+     * 
+ * + * bool allow_missing = 3; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + /** + * + * + *
+     * If set to true, and the trigger is not found, the request will succeed
+     * but no action will be taken on the server.
+     * 
+ * + * bool allow_missing = 3; + * + * @param value The allowMissing to set. + * @return This builder for chaining. + */ + public Builder setAllowMissing(boolean value) { + + allowMissing_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set to true, and the trigger is not found, the request will succeed
+     * but no action will be taken on the server.
+     * 
+ * + * bool allow_missing = 3; + * + * @return This builder for chaining. + */ + public Builder clearAllowMissing() { + + allowMissing_ = false; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.eventarc.v1.DeleteTriggerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.DeleteTriggerRequest) + private static final com.google.cloud.eventarc.v1.DeleteTriggerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.DeleteTriggerRequest(); + } + + public static com.google.cloud.eventarc.v1.DeleteTriggerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteTriggerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteTriggerRequest(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.eventarc.v1.DeleteTriggerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DeleteTriggerRequestOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DeleteTriggerRequestOrBuilder.java new file mode 100644 index 00000000..e90686ca --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DeleteTriggerRequestOrBuilder.java @@ -0,0 +1,109 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +public interface DeleteTriggerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.DeleteTriggerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the trigger to be deleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the trigger to be deleted.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * If provided, the trigger will only be deleted if the etag matches the
+   * current etag on the resource.
+   * 
+ * + * string etag = 2; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * If provided, the trigger will only be deleted if the etag matches the
+   * current etag on the resource.
+   * 
+ * + * string etag = 2; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); + + /** + * + * + *
+   * If set to true, and the trigger is not found, the request will succeed
+   * but no action will be taken on the server.
+   * 
+ * + * bool allow_missing = 3; + * + * @return The allowMissing. + */ + boolean getAllowMissing(); + + /** + * + * + *
+   * Required. If set, validate the request and preview the review, but do not actually
+   * post it.
+   * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Destination.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Destination.java new file mode 100644 index 00000000..6e471a98 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Destination.java @@ -0,0 +1,843 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * Represents a target of an invocation over HTTP.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.Destination} + */ +public final class Destination extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.Destination) + DestinationOrBuilder { + private static final long serialVersionUID = 0L; + // Use Destination.newBuilder() to construct. + private Destination(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Destination() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Destination(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Destination( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.eventarc.v1.CloudRun.Builder subBuilder = null; + if (descriptorCase_ == 1) { + subBuilder = ((com.google.cloud.eventarc.v1.CloudRun) descriptor_).toBuilder(); + } + descriptor_ = + input.readMessage( + com.google.cloud.eventarc.v1.CloudRun.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.eventarc.v1.CloudRun) descriptor_); + descriptor_ = subBuilder.buildPartial(); + } + descriptorCase_ = 1; + 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.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Destination_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Destination_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.Destination.class, + com.google.cloud.eventarc.v1.Destination.Builder.class); + } + + private int descriptorCase_ = 0; + private java.lang.Object descriptor_; + + public enum DescriptorCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + CLOUD_RUN(1), + DESCRIPTOR_NOT_SET(0); + private final int value; + + private DescriptorCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DescriptorCase valueOf(int value) { + return forNumber(value); + } + + public static DescriptorCase forNumber(int value) { + switch (value) { + case 1: + return CLOUD_RUN; + case 0: + return DESCRIPTOR_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public DescriptorCase getDescriptorCase() { + return DescriptorCase.forNumber(descriptorCase_); + } + + public static final int CLOUD_RUN_FIELD_NUMBER = 1; + /** + * + * + *
+   * Cloud Run fully-managed service that receives the events. The service
+   * should be running in the same project of the trigger.
+   * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + * + * @return Whether the cloudRun field is set. + */ + @java.lang.Override + public boolean hasCloudRun() { + return descriptorCase_ == 1; + } + /** + * + * + *
+   * Cloud Run fully-managed service that receives the events. The service
+   * should be running in the same project of the trigger.
+   * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + * + * @return The cloudRun. + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.CloudRun getCloudRun() { + if (descriptorCase_ == 1) { + return (com.google.cloud.eventarc.v1.CloudRun) descriptor_; + } + return com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance(); + } + /** + * + * + *
+   * Cloud Run fully-managed service that receives the events. The service
+   * should be running in the same project of the trigger.
+   * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.CloudRunOrBuilder getCloudRunOrBuilder() { + if (descriptorCase_ == 1) { + return (com.google.cloud.eventarc.v1.CloudRun) descriptor_; + } + return com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance(); + } + + 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 (descriptorCase_ == 1) { + output.writeMessage(1, (com.google.cloud.eventarc.v1.CloudRun) descriptor_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (descriptorCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.cloud.eventarc.v1.CloudRun) descriptor_); + } + 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.eventarc.v1.Destination)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.Destination other = (com.google.cloud.eventarc.v1.Destination) obj; + + if (!getDescriptorCase().equals(other.getDescriptorCase())) return false; + switch (descriptorCase_) { + case 1: + if (!getCloudRun().equals(other.getCloudRun())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (descriptorCase_) { + case 1: + hash = (37 * hash) + CLOUD_RUN_FIELD_NUMBER; + hash = (53 * hash) + getCloudRun().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.Destination parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Destination 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.eventarc.v1.Destination parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Destination 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.eventarc.v1.Destination parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Destination parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.Destination parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Destination 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.eventarc.v1.Destination parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Destination 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.eventarc.v1.Destination parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Destination 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.eventarc.v1.Destination 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; + } + /** + * + * + *
+   * Represents a target of an invocation over HTTP.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.Destination} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.Destination) + com.google.cloud.eventarc.v1.DestinationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Destination_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Destination_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.Destination.class, + com.google.cloud.eventarc.v1.Destination.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.Destination.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(); + descriptorCase_ = 0; + descriptor_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Destination_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Destination getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.Destination.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Destination build() { + com.google.cloud.eventarc.v1.Destination result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Destination buildPartial() { + com.google.cloud.eventarc.v1.Destination result = + new com.google.cloud.eventarc.v1.Destination(this); + if (descriptorCase_ == 1) { + if (cloudRunBuilder_ == null) { + result.descriptor_ = descriptor_; + } else { + result.descriptor_ = cloudRunBuilder_.build(); + } + } + result.descriptorCase_ = descriptorCase_; + 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.eventarc.v1.Destination) { + return mergeFrom((com.google.cloud.eventarc.v1.Destination) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.Destination other) { + if (other == com.google.cloud.eventarc.v1.Destination.getDefaultInstance()) return this; + switch (other.getDescriptorCase()) { + case CLOUD_RUN: + { + mergeCloudRun(other.getCloudRun()); + break; + } + case DESCRIPTOR_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.eventarc.v1.Destination parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.Destination) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int descriptorCase_ = 0; + private java.lang.Object descriptor_; + + public DescriptorCase getDescriptorCase() { + return DescriptorCase.forNumber(descriptorCase_); + } + + public Builder clearDescriptor() { + descriptorCase_ = 0; + descriptor_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.CloudRun, + com.google.cloud.eventarc.v1.CloudRun.Builder, + com.google.cloud.eventarc.v1.CloudRunOrBuilder> + cloudRunBuilder_; + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + * + * @return Whether the cloudRun field is set. + */ + @java.lang.Override + public boolean hasCloudRun() { + return descriptorCase_ == 1; + } + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + * + * @return The cloudRun. + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.CloudRun getCloudRun() { + if (cloudRunBuilder_ == null) { + if (descriptorCase_ == 1) { + return (com.google.cloud.eventarc.v1.CloudRun) descriptor_; + } + return com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance(); + } else { + if (descriptorCase_ == 1) { + return cloudRunBuilder_.getMessage(); + } + return com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance(); + } + } + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + public Builder setCloudRun(com.google.cloud.eventarc.v1.CloudRun value) { + if (cloudRunBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + descriptor_ = value; + onChanged(); + } else { + cloudRunBuilder_.setMessage(value); + } + descriptorCase_ = 1; + return this; + } + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + public Builder setCloudRun(com.google.cloud.eventarc.v1.CloudRun.Builder builderForValue) { + if (cloudRunBuilder_ == null) { + descriptor_ = builderForValue.build(); + onChanged(); + } else { + cloudRunBuilder_.setMessage(builderForValue.build()); + } + descriptorCase_ = 1; + return this; + } + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + public Builder mergeCloudRun(com.google.cloud.eventarc.v1.CloudRun value) { + if (cloudRunBuilder_ == null) { + if (descriptorCase_ == 1 + && descriptor_ != com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance()) { + descriptor_ = + com.google.cloud.eventarc.v1.CloudRun.newBuilder( + (com.google.cloud.eventarc.v1.CloudRun) descriptor_) + .mergeFrom(value) + .buildPartial(); + } else { + descriptor_ = value; + } + onChanged(); + } else { + if (descriptorCase_ == 1) { + cloudRunBuilder_.mergeFrom(value); + } + cloudRunBuilder_.setMessage(value); + } + descriptorCase_ = 1; + return this; + } + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + public Builder clearCloudRun() { + if (cloudRunBuilder_ == null) { + if (descriptorCase_ == 1) { + descriptorCase_ = 0; + descriptor_ = null; + onChanged(); + } + } else { + if (descriptorCase_ == 1) { + descriptorCase_ = 0; + descriptor_ = null; + } + cloudRunBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + public com.google.cloud.eventarc.v1.CloudRun.Builder getCloudRunBuilder() { + return getCloudRunFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.CloudRunOrBuilder getCloudRunOrBuilder() { + if ((descriptorCase_ == 1) && (cloudRunBuilder_ != null)) { + return cloudRunBuilder_.getMessageOrBuilder(); + } else { + if (descriptorCase_ == 1) { + return (com.google.cloud.eventarc.v1.CloudRun) descriptor_; + } + return com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance(); + } + } + /** + * + * + *
+     * Cloud Run fully-managed service that receives the events. The service
+     * should be running in the same project of the trigger.
+     * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.CloudRun, + com.google.cloud.eventarc.v1.CloudRun.Builder, + com.google.cloud.eventarc.v1.CloudRunOrBuilder> + getCloudRunFieldBuilder() { + if (cloudRunBuilder_ == null) { + if (!(descriptorCase_ == 1)) { + descriptor_ = com.google.cloud.eventarc.v1.CloudRun.getDefaultInstance(); + } + cloudRunBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.CloudRun, + com.google.cloud.eventarc.v1.CloudRun.Builder, + com.google.cloud.eventarc.v1.CloudRunOrBuilder>( + (com.google.cloud.eventarc.v1.CloudRun) descriptor_, + getParentForChildren(), + isClean()); + descriptor_ = null; + } + descriptorCase_ = 1; + onChanged(); + ; + return cloudRunBuilder_; + } + + @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.eventarc.v1.Destination) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.Destination) + private static final com.google.cloud.eventarc.v1.Destination DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.Destination(); + } + + public static com.google.cloud.eventarc.v1.Destination getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Destination parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Destination(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.eventarc.v1.Destination getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DestinationOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DestinationOrBuilder.java new file mode 100644 index 00000000..c01f9abd --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/DestinationOrBuilder.java @@ -0,0 +1,65 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +public interface DestinationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.Destination) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Cloud Run fully-managed service that receives the events. The service
+   * should be running in the same project of the trigger.
+   * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + * + * @return Whether the cloudRun field is set. + */ + boolean hasCloudRun(); + /** + * + * + *
+   * Cloud Run fully-managed service that receives the events. The service
+   * should be running in the same project of the trigger.
+   * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + * + * @return The cloudRun. + */ + com.google.cloud.eventarc.v1.CloudRun getCloudRun(); + /** + * + * + *
+   * Cloud Run fully-managed service that receives the events. The service
+   * should be running in the same project of the trigger.
+   * 
+ * + * .google.cloud.eventarc.v1.CloudRun cloud_run = 1; + */ + com.google.cloud.eventarc.v1.CloudRunOrBuilder getCloudRunOrBuilder(); + + public com.google.cloud.eventarc.v1.Destination.DescriptorCase getDescriptorCase(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventFilter.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventFilter.java new file mode 100644 index 00000000..046d1306 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventFilter.java @@ -0,0 +1,826 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * Filters events based on exact matches on the CloudEvents attributes.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.EventFilter} + */ +public final class EventFilter extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.EventFilter) + EventFilterOrBuilder { + private static final long serialVersionUID = 0L; + // Use EventFilter.newBuilder() to construct. + private EventFilter(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private EventFilter() { + attribute_ = ""; + value_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new EventFilter(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private EventFilter( + 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(); + + attribute_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + value_ = 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.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_EventFilter_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_EventFilter_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.EventFilter.class, + com.google.cloud.eventarc.v1.EventFilter.Builder.class); + } + + public static final int ATTRIBUTE_FIELD_NUMBER = 1; + private volatile java.lang.Object attribute_; + /** + * + * + *
+   * Required. The name of a CloudEvents attribute. Currently, only a subset of
+   * attributes are supported for filtering.
+   * All triggers MUST provide a filter for the 'type' attribute.
+   * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The attribute. + */ + @java.lang.Override + public java.lang.String getAttribute() { + java.lang.Object ref = attribute_; + 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(); + attribute_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of a CloudEvents attribute. Currently, only a subset of
+   * attributes are supported for filtering.
+   * All triggers MUST provide a filter for the 'type' attribute.
+   * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for attribute. + */ + @java.lang.Override + public com.google.protobuf.ByteString getAttributeBytes() { + java.lang.Object ref = attribute_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attribute_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VALUE_FIELD_NUMBER = 2; + private volatile java.lang.Object value_; + /** + * + * + *
+   * Required. The value for the attribute.
+   * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The value. + */ + @java.lang.Override + public java.lang.String getValue() { + java.lang.Object ref = value_; + 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(); + value_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The value for the attribute.
+   * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for value. + */ + @java.lang.Override + public com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + value_ = 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 (!getAttributeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, attribute_); + } + if (!getValueBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, value_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getAttributeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, attribute_); + } + if (!getValueBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, value_); + } + 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.eventarc.v1.EventFilter)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.EventFilter other = (com.google.cloud.eventarc.v1.EventFilter) obj; + + if (!getAttribute().equals(other.getAttribute())) return false; + if (!getValue().equals(other.getValue())) 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) + ATTRIBUTE_FIELD_NUMBER; + hash = (53 * hash) + getAttribute().hashCode(); + hash = (37 * hash) + VALUE_FIELD_NUMBER; + hash = (53 * hash) + getValue().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.EventFilter parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.EventFilter 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.eventarc.v1.EventFilter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.EventFilter 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.eventarc.v1.EventFilter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.EventFilter parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.EventFilter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.EventFilter 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.eventarc.v1.EventFilter parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.EventFilter 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.eventarc.v1.EventFilter parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.EventFilter 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.eventarc.v1.EventFilter 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; + } + /** + * + * + *
+   * Filters events based on exact matches on the CloudEvents attributes.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.EventFilter} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.EventFilter) + com.google.cloud.eventarc.v1.EventFilterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_EventFilter_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_EventFilter_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.EventFilter.class, + com.google.cloud.eventarc.v1.EventFilter.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.EventFilter.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(); + attribute_ = ""; + + value_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_EventFilter_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.EventFilter getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.EventFilter.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.EventFilter build() { + com.google.cloud.eventarc.v1.EventFilter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.EventFilter buildPartial() { + com.google.cloud.eventarc.v1.EventFilter result = + new com.google.cloud.eventarc.v1.EventFilter(this); + result.attribute_ = attribute_; + result.value_ = value_; + 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.eventarc.v1.EventFilter) { + return mergeFrom((com.google.cloud.eventarc.v1.EventFilter) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.EventFilter other) { + if (other == com.google.cloud.eventarc.v1.EventFilter.getDefaultInstance()) return this; + if (!other.getAttribute().isEmpty()) { + attribute_ = other.attribute_; + onChanged(); + } + if (!other.getValue().isEmpty()) { + value_ = other.value_; + 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.eventarc.v1.EventFilter parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.EventFilter) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object attribute_ = ""; + /** + * + * + *
+     * Required. The name of a CloudEvents attribute. Currently, only a subset of
+     * attributes are supported for filtering.
+     * All triggers MUST provide a filter for the 'type' attribute.
+     * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The attribute. + */ + public java.lang.String getAttribute() { + java.lang.Object ref = attribute_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + attribute_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of a CloudEvents attribute. Currently, only a subset of
+     * attributes are supported for filtering.
+     * All triggers MUST provide a filter for the 'type' attribute.
+     * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for attribute. + */ + public com.google.protobuf.ByteString getAttributeBytes() { + java.lang.Object ref = attribute_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + attribute_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of a CloudEvents attribute. Currently, only a subset of
+     * attributes are supported for filtering.
+     * All triggers MUST provide a filter for the 'type' attribute.
+     * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The attribute to set. + * @return This builder for chaining. + */ + public Builder setAttribute(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + attribute_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of a CloudEvents attribute. Currently, only a subset of
+     * attributes are supported for filtering.
+     * All triggers MUST provide a filter for the 'type' attribute.
+     * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearAttribute() { + + attribute_ = getDefaultInstance().getAttribute(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of a CloudEvents attribute. Currently, only a subset of
+     * attributes are supported for filtering.
+     * All triggers MUST provide a filter for the 'type' attribute.
+     * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for attribute to set. + * @return This builder for chaining. + */ + public Builder setAttributeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + attribute_ = value; + onChanged(); + return this; + } + + private java.lang.Object value_ = ""; + /** + * + * + *
+     * Required. The value for the attribute.
+     * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The value. + */ + public java.lang.String getValue() { + java.lang.Object ref = value_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + value_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The value for the attribute.
+     * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for value. + */ + public com.google.protobuf.ByteString getValueBytes() { + java.lang.Object ref = value_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + value_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The value for the attribute.
+     * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The value to set. + * @return This builder for chaining. + */ + public Builder setValue(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + value_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The value for the attribute.
+     * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearValue() { + + value_ = getDefaultInstance().getValue(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The value for the attribute.
+     * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for value to set. + * @return This builder for chaining. + */ + public Builder setValueBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + value_ = 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.eventarc.v1.EventFilter) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.EventFilter) + private static final com.google.cloud.eventarc.v1.EventFilter DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.EventFilter(); + } + + public static com.google.cloud.eventarc.v1.EventFilter getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public EventFilter parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new EventFilter(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.eventarc.v1.EventFilter getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventFilterOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventFilterOrBuilder.java new file mode 100644 index 00000000..b9a3f858 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventFilterOrBuilder.java @@ -0,0 +1,79 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +public interface EventFilterOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.EventFilter) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of a CloudEvents attribute. Currently, only a subset of
+   * attributes are supported for filtering.
+   * All triggers MUST provide a filter for the 'type' attribute.
+   * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The attribute. + */ + java.lang.String getAttribute(); + /** + * + * + *
+   * Required. The name of a CloudEvents attribute. Currently, only a subset of
+   * attributes are supported for filtering.
+   * All triggers MUST provide a filter for the 'type' attribute.
+   * 
+ * + * string attribute = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for attribute. + */ + com.google.protobuf.ByteString getAttributeBytes(); + + /** + * + * + *
+   * Required. The value for the attribute.
+   * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The value. + */ + java.lang.String getValue(); + /** + * + * + *
+   * Required. The value for the attribute.
+   * 
+ * + * string value = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for value. + */ + com.google.protobuf.ByteString getValueBytes(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventarcProto.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventarcProto.java new file mode 100644 index 00000000..4ef5451d --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/EventarcProto.java @@ -0,0 +1,234 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +public final class EventarcProto { + private EventarcProto() {} + + 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_eventarc_v1_GetTriggerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_GetTriggerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_ListTriggersRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_ListTriggersRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_ListTriggersResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_ListTriggersResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_OperationMetadata_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_OperationMetadata_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/eventarc/v1/eventarc.prot" + + "o\022\030google.cloud.eventarc.v1\032\034google/api/" + + "annotations.proto\032\027google/api/client.pro" + + "to\032\037google/api/field_behavior.proto\032\031goo" + + "gle/api/resource.proto\032&google/cloud/eve" + + "ntarc/v1/trigger.proto\032#google/longrunni" + + "ng/operations.proto\032 google/protobuf/fie" + + "ld_mask.proto\032\037google/protobuf/timestamp" + + ".proto\"J\n\021GetTriggerRequest\0225\n\004name\030\001 \001(" + + "\tB\'\340A\002\372A!\n\037eventarc.googleapis.com/Trigg" + + "er\"\207\001\n\023ListTriggersRequest\0227\n\006parent\030\001 \001" + + "(\tB\'\340A\002\372A!\022\037eventarc.googleapis.com/Trig" + + "ger\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_token\030\003 \001" + + "(\t\022\020\n\010order_by\030\004 \001(\t\"y\n\024ListTriggersResp" + + "onse\0223\n\010triggers\030\001 \003(\0132!.google.cloud.ev" + + "entarc.v1.Trigger\022\027\n\017next_page_token\030\002 \001" + + "(\t\022\023\n\013unreachable\030\003 \003(\t\"\275\001\n\024CreateTrigge" + + "rRequest\0227\n\006parent\030\001 \001(\tB\'\340A\002\372A!\022\037eventa" + + "rc.googleapis.com/Trigger\0227\n\007trigger\030\002 \001" + + "(\0132!.google.cloud.eventarc.v1.TriggerB\003\340" + + "A\002\022\027\n\ntrigger_id\030\003 \001(\tB\003\340A\002\022\032\n\rvalidate_" + + "only\030\004 \001(\010B\003\340A\002\"\256\001\n\024UpdateTriggerRequest" + + "\0222\n\007trigger\030\001 \001(\0132!.google.cloud.eventar" + + "c.v1.Trigger\022/\n\013update_mask\030\002 \001(\0132\032.goog" + + "le.protobuf.FieldMask\022\025\n\rallow_missing\030\003" + + " \001(\010\022\032\n\rvalidate_only\030\004 \001(\010B\003\340A\002\"\216\001\n\024Del" + + "eteTriggerRequest\0225\n\004name\030\001 \001(\tB\'\340A\002\372A!\n" + + "\037eventarc.googleapis.com/Trigger\022\014\n\004etag" + + "\030\002 \001(\t\022\025\n\rallow_missing\030\003 \001(\010\022\032\n\rvalidat" + + "e_only\030\004 \001(\010B\003\340A\002\"\200\002\n\021OperationMetadata\022" + + "4\n\013create_time\030\001 \001(\0132\032.google.protobuf.T" + + "imestampB\003\340A\003\0221\n\010end_time\030\002 \001(\0132\032.google" + + ".protobuf.TimestampB\003\340A\003\022\023\n\006target\030\003 \001(\t" + + "B\003\340A\003\022\021\n\004verb\030\004 \001(\tB\003\340A\003\022\033\n\016status_messa" + + "ge\030\005 \001(\tB\003\340A\003\022#\n\026requested_cancellation\030" + + "\006 \001(\010B\003\340A\003\022\030\n\013api_version\030\007 \001(\tB\003\340A\0032\264\010\n" + + "\010Eventarc\022\231\001\n\nGetTrigger\022+.google.cloud." + + "eventarc.v1.GetTriggerRequest\032!.google.c" + + "loud.eventarc.v1.Trigger\";\202\323\344\223\002.\022,/v1/{n" + + "ame=projects/*/locations/*/triggers/*}\332A" + + "\004name\022\254\001\n\014ListTriggers\022-.google.cloud.ev" + + "entarc.v1.ListTriggersRequest\032..google.c" + + "loud.eventarc.v1.ListTriggersResponse\"=\202" + + "\323\344\223\002.\022,/v1/{parent=projects/*/locations/" + + "*}/triggers\332A\006parent\022\330\001\n\rCreateTrigger\022." + + ".google.cloud.eventarc.v1.CreateTriggerR" + + "equest\032\035.google.longrunning.Operation\"x\202" + + "\323\344\223\0027\",/v1/{parent=projects/*/locations/" + + "*}/triggers:\007trigger\332A\031parent,trigger,tr" + + "igger_id\312A\034\n\007Trigger\022\021OperationMetadata\022" + + "\351\001\n\rUpdateTrigger\022..google.cloud.eventar" + + "c.v1.UpdateTriggerRequest\032\035.google.longr" + + "unning.Operation\"\210\001\202\323\344\223\002?24/v1/{trigger." + + "name=projects/*/locations/*/triggers/*}:" + + "\007trigger\332A!trigger,update_mask,allow_mis" + + "sing\312A\034\n\007Trigger\022\021OperationMetadata\022\310\001\n\r" + + "DeleteTrigger\022..google.cloud.eventarc.v1" + + ".DeleteTriggerRequest\032\035.google.longrunni" + + "ng.Operation\"h\202\323\344\223\002.*,/v1/{name=projects" + + "/*/locations/*/triggers/*}\332A\022name,allow_" + + "missing\312A\034\n\007Trigger\022\021OperationMetadata\032K" + + "\312A\027eventarc.googleapis.com\322A.https://www" + + ".googleapis.com/auth/cloud-platformB\305\001\n\034" + + "com.google.cloud.eventarc.v1B\rEventarcPr" + + "otoP\001Z@google.golang.org/genproto/google" + + "apis/cloud/eventarc/v1;eventarc\252\002\030Google" + + ".Cloud.Eventarc.V1\312\002\030Google\\Cloud\\Eventa" + + "rc\\V1\352\002\033Google::Cloud::Eventarc::V1b\006pro" + + "to3" + }; + 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.eventarc.v1.TriggerProto.getDescriptor(), + com.google.longrunning.OperationsProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_cloud_eventarc_v1_GetTriggerRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_eventarc_v1_GetTriggerRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_eventarc_v1_GetTriggerRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_eventarc_v1_ListTriggersRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_eventarc_v1_ListTriggersRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_eventarc_v1_ListTriggersRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", "OrderBy", + }); + internal_static_google_cloud_eventarc_v1_ListTriggersResponse_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_eventarc_v1_ListTriggersResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_eventarc_v1_ListTriggersResponse_descriptor, + new java.lang.String[] { + "Triggers", "NextPageToken", "Unreachable", + }); + internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_eventarc_v1_CreateTriggerRequest_descriptor, + new java.lang.String[] { + "Parent", "Trigger", "TriggerId", "ValidateOnly", + }); + internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_descriptor, + new java.lang.String[] { + "Trigger", "UpdateMask", "AllowMissing", "ValidateOnly", + }); + internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_eventarc_v1_DeleteTriggerRequest_descriptor, + new java.lang.String[] { + "Name", "Etag", "AllowMissing", "ValidateOnly", + }); + internal_static_google_cloud_eventarc_v1_OperationMetadata_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_eventarc_v1_OperationMetadata_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_eventarc_v1_OperationMetadata_descriptor, + new java.lang.String[] { + "CreateTime", + "EndTime", + "Target", + "Verb", + "StatusMessage", + "RequestedCancellation", + "ApiVersion", + }); + 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.resourceReference); + registry.add(com.google.longrunning.OperationsProto.operationInfo); + 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.eventarc.v1.TriggerProto.getDescriptor(); + com.google.longrunning.OperationsProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/GetTriggerRequest.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/GetTriggerRequest.java new file mode 100644 index 00000000..281c51ea --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/GetTriggerRequest.java @@ -0,0 +1,648 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * The request message for the GetTrigger method.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.GetTriggerRequest} + */ +public final class GetTriggerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.GetTriggerRequest) + GetTriggerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetTriggerRequest.newBuilder() to construct. + private GetTriggerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetTriggerRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetTriggerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetTriggerRequest( + 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.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_GetTriggerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_GetTriggerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.GetTriggerRequest.class, + com.google.cloud.eventarc.v1.GetTriggerRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the trigger to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the trigger to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!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.eventarc.v1.GetTriggerRequest)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.GetTriggerRequest other = + (com.google.cloud.eventarc.v1.GetTriggerRequest) 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.eventarc.v1.GetTriggerRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.GetTriggerRequest 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.eventarc.v1.GetTriggerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.GetTriggerRequest 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.eventarc.v1.GetTriggerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.GetTriggerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.GetTriggerRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.GetTriggerRequest 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.eventarc.v1.GetTriggerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.GetTriggerRequest 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.eventarc.v1.GetTriggerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.GetTriggerRequest 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.eventarc.v1.GetTriggerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request message for the GetTrigger method.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.GetTriggerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.GetTriggerRequest) + com.google.cloud.eventarc.v1.GetTriggerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_GetTriggerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_GetTriggerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.GetTriggerRequest.class, + com.google.cloud.eventarc.v1.GetTriggerRequest.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.GetTriggerRequest.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.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_GetTriggerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.GetTriggerRequest getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.GetTriggerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.GetTriggerRequest build() { + com.google.cloud.eventarc.v1.GetTriggerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.GetTriggerRequest buildPartial() { + com.google.cloud.eventarc.v1.GetTriggerRequest result = + new com.google.cloud.eventarc.v1.GetTriggerRequest(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.eventarc.v1.GetTriggerRequest) { + return mergeFrom((com.google.cloud.eventarc.v1.GetTriggerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.GetTriggerRequest other) { + if (other == com.google.cloud.eventarc.v1.GetTriggerRequest.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.eventarc.v1.GetTriggerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.GetTriggerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the trigger to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the trigger to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the trigger to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the trigger to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the trigger to get.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.eventarc.v1.GetTriggerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.GetTriggerRequest) + private static final com.google.cloud.eventarc.v1.GetTriggerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.GetTriggerRequest(); + } + + public static com.google.cloud.eventarc.v1.GetTriggerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetTriggerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetTriggerRequest(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.eventarc.v1.GetTriggerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/GetTriggerRequestOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/GetTriggerRequestOrBuilder.java new file mode 100644 index 00000000..e9a5a9eb --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/GetTriggerRequestOrBuilder.java @@ -0,0 +1,54 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +public interface GetTriggerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.GetTriggerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the trigger to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the trigger to get.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersRequest.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersRequest.java new file mode 100644 index 00000000..3ab3518d --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersRequest.java @@ -0,0 +1,1143 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * The request message for the ListTriggers method.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.ListTriggersRequest} + */ +public final class ListTriggersRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.ListTriggersRequest) + ListTriggersRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListTriggersRequest.newBuilder() to construct. + private ListTriggersRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListTriggersRequest() { + parent_ = ""; + pageToken_ = ""; + orderBy_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListTriggersRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListTriggersRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + orderBy_ = 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.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.ListTriggersRequest.class, + com.google.cloud.eventarc.v1.ListTriggersRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The parent collection to list triggers on.
+   * 
+ * + * + * 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 collection to list triggers on.
+   * 
+ * + * + * 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_; + /** + * + * + *
+   * The maximum number of triggers to return on each page.
+   * Note: The service may send fewer.
+   * 
+ * + * int32 page_size = 2; + * + * @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_; + /** + * + * + *
+   * The page token; provide the value from the `next_page_token` field in a
+   * previous `ListTriggers` call to retrieve the subsequent page.
+   * When paginating, all other parameters provided to `ListTriggers` must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @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; + } + } + /** + * + * + *
+   * The page token; provide the value from the `next_page_token` field in a
+   * previous `ListTriggers` call to retrieve the subsequent page.
+   * When paginating, all other parameters provided to `ListTriggers` must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ORDER_BY_FIELD_NUMBER = 4; + private volatile java.lang.Object orderBy_; + /** + * + * + *
+   * The sorting order of the resources returned. Value should be a comma
+   * separated list of fields. The default sorting oder is ascending. To specify
+   * descending order for a field, append a ` desc` suffix; for example:
+   * `name desc, trigger_id`.
+   * 
+ * + * string order_by = 4; + * + * @return The orderBy. + */ + @java.lang.Override + public java.lang.String getOrderBy() { + java.lang.Object ref = orderBy_; + 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(); + orderBy_ = s; + return s; + } + } + /** + * + * + *
+   * The sorting order of the resources returned. Value should be a comma
+   * separated list of fields. The default sorting oder is ascending. To specify
+   * descending order for a field, append a ` desc` suffix; for example:
+   * `name desc, trigger_id`.
+   * 
+ * + * string order_by = 4; + * + * @return The bytes for orderBy. + */ + @java.lang.Override + public com.google.protobuf.ByteString getOrderByBytes() { + java.lang.Object ref = orderBy_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + orderBy_ = 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_); + } + if (!getOrderByBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, orderBy_); + } + 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_); + } + if (!getOrderByBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, orderBy_); + } + 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.eventarc.v1.ListTriggersRequest)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.ListTriggersRequest other = + (com.google.cloud.eventarc.v1.ListTriggersRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getOrderBy().equals(other.getOrderBy())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + ORDER_BY_FIELD_NUMBER; + hash = (53 * hash) + getOrderBy().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest 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.eventarc.v1.ListTriggersRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest 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.eventarc.v1.ListTriggersRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest 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.eventarc.v1.ListTriggersRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest 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.eventarc.v1.ListTriggersRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest 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.eventarc.v1.ListTriggersRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request message for the ListTriggers method.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.ListTriggersRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.ListTriggersRequest) + com.google.cloud.eventarc.v1.ListTriggersRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.ListTriggersRequest.class, + com.google.cloud.eventarc.v1.ListTriggersRequest.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.ListTriggersRequest.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_ = ""; + + orderBy_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.ListTriggersRequest getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.ListTriggersRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.ListTriggersRequest build() { + com.google.cloud.eventarc.v1.ListTriggersRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.ListTriggersRequest buildPartial() { + com.google.cloud.eventarc.v1.ListTriggersRequest result = + new com.google.cloud.eventarc.v1.ListTriggersRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.orderBy_ = orderBy_; + 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.eventarc.v1.ListTriggersRequest) { + return mergeFrom((com.google.cloud.eventarc.v1.ListTriggersRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.ListTriggersRequest other) { + if (other == com.google.cloud.eventarc.v1.ListTriggersRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (!other.getOrderBy().isEmpty()) { + orderBy_ = other.orderBy_; + 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.eventarc.v1.ListTriggersRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.ListTriggersRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent collection to list triggers on.
+     * 
+ * + * + * 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 collection to list triggers on.
+     * 
+ * + * + * 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 collection to list triggers on.
+     * 
+ * + * + * 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 collection to list triggers on.
+     * 
+ * + * + * 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 collection to list triggers on.
+     * 
+ * + * + * 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_; + /** + * + * + *
+     * The maximum number of triggers to return on each page.
+     * Note: The service may send fewer.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * The maximum number of triggers to return on each page.
+     * Note: The service may send fewer.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The maximum number of triggers to return on each page.
+     * Note: The service may send fewer.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * The page token; provide the value from the `next_page_token` field in a
+     * previous `ListTriggers` call to retrieve the subsequent page.
+     * When paginating, all other parameters provided to `ListTriggers` must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @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; + } + } + /** + * + * + *
+     * The page token; provide the value from the `next_page_token` field in a
+     * previous `ListTriggers` call to retrieve the subsequent page.
+     * When paginating, all other parameters provided to `ListTriggers` must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @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; + } + } + /** + * + * + *
+     * The page token; provide the value from the `next_page_token` field in a
+     * previous `ListTriggers` call to retrieve the subsequent page.
+     * When paginating, all other parameters provided to `ListTriggers` must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @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; + } + /** + * + * + *
+     * The page token; provide the value from the `next_page_token` field in a
+     * previous `ListTriggers` call to retrieve the subsequent page.
+     * When paginating, all other parameters provided to `ListTriggers` must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * The page token; provide the value from the `next_page_token` field in a
+     * previous `ListTriggers` call to retrieve the subsequent page.
+     * When paginating, all other parameters provided to `ListTriggers` must match
+     * the call that provided the page token.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private java.lang.Object orderBy_ = ""; + /** + * + * + *
+     * The sorting order of the resources returned. Value should be a comma
+     * separated list of fields. The default sorting oder is ascending. To specify
+     * descending order for a field, append a ` desc` suffix; for example:
+     * `name desc, trigger_id`.
+     * 
+ * + * string order_by = 4; + * + * @return The orderBy. + */ + public java.lang.String getOrderBy() { + java.lang.Object ref = orderBy_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + orderBy_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The sorting order of the resources returned. Value should be a comma
+     * separated list of fields. The default sorting oder is ascending. To specify
+     * descending order for a field, append a ` desc` suffix; for example:
+     * `name desc, trigger_id`.
+     * 
+ * + * string order_by = 4; + * + * @return The bytes for orderBy. + */ + public com.google.protobuf.ByteString getOrderByBytes() { + java.lang.Object ref = orderBy_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + orderBy_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The sorting order of the resources returned. Value should be a comma
+     * separated list of fields. The default sorting oder is ascending. To specify
+     * descending order for a field, append a ` desc` suffix; for example:
+     * `name desc, trigger_id`.
+     * 
+ * + * string order_by = 4; + * + * @param value The orderBy to set. + * @return This builder for chaining. + */ + public Builder setOrderBy(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + orderBy_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The sorting order of the resources returned. Value should be a comma
+     * separated list of fields. The default sorting oder is ascending. To specify
+     * descending order for a field, append a ` desc` suffix; for example:
+     * `name desc, trigger_id`.
+     * 
+ * + * string order_by = 4; + * + * @return This builder for chaining. + */ + public Builder clearOrderBy() { + + orderBy_ = getDefaultInstance().getOrderBy(); + onChanged(); + return this; + } + /** + * + * + *
+     * The sorting order of the resources returned. Value should be a comma
+     * separated list of fields. The default sorting oder is ascending. To specify
+     * descending order for a field, append a ` desc` suffix; for example:
+     * `name desc, trigger_id`.
+     * 
+ * + * string order_by = 4; + * + * @param value The bytes for orderBy to set. + * @return This builder for chaining. + */ + public Builder setOrderByBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + orderBy_ = 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.eventarc.v1.ListTriggersRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.ListTriggersRequest) + private static final com.google.cloud.eventarc.v1.ListTriggersRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.ListTriggersRequest(); + } + + public static com.google.cloud.eventarc.v1.ListTriggersRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListTriggersRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListTriggersRequest(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.eventarc.v1.ListTriggersRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersRequestOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersRequestOrBuilder.java new file mode 100644 index 00000000..1f056164 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersRequestOrBuilder.java @@ -0,0 +1,130 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +public interface ListTriggersRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.ListTriggersRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent collection to list triggers on.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent collection to list triggers on.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * The maximum number of triggers to return on each page.
+   * Note: The service may send fewer.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * The page token; provide the value from the `next_page_token` field in a
+   * previous `ListTriggers` call to retrieve the subsequent page.
+   * When paginating, all other parameters provided to `ListTriggers` must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * The page token; provide the value from the `next_page_token` field in a
+   * previous `ListTriggers` call to retrieve the subsequent page.
+   * When paginating, all other parameters provided to `ListTriggers` must match
+   * the call that provided the page token.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * The sorting order of the resources returned. Value should be a comma
+   * separated list of fields. The default sorting oder is ascending. To specify
+   * descending order for a field, append a ` desc` suffix; for example:
+   * `name desc, trigger_id`.
+   * 
+ * + * string order_by = 4; + * + * @return The orderBy. + */ + java.lang.String getOrderBy(); + /** + * + * + *
+   * The sorting order of the resources returned. Value should be a comma
+   * separated list of fields. The default sorting oder is ascending. To specify
+   * descending order for a field, append a ` desc` suffix; for example:
+   * `name desc, trigger_id`.
+   * 
+ * + * string order_by = 4; + * + * @return The bytes for orderBy. + */ + com.google.protobuf.ByteString getOrderByBytes(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersResponse.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersResponse.java new file mode 100644 index 00000000..01017fbd --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersResponse.java @@ -0,0 +1,1410 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * The response message for the ListTriggers method.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.ListTriggersResponse} + */ +public final class ListTriggersResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.ListTriggersResponse) + ListTriggersResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListTriggersResponse.newBuilder() to construct. + private ListTriggersResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListTriggersResponse() { + triggers_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + unreachable_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListTriggersResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListTriggersResponse( + 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)) { + triggers_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + triggers_.add( + input.readMessage( + com.google.cloud.eventarc.v1.Trigger.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + unreachable_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + unreachable_.add(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)) { + triggers_ = java.util.Collections.unmodifiableList(triggers_); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + unreachable_ = unreachable_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.ListTriggersResponse.class, + com.google.cloud.eventarc.v1.ListTriggersResponse.Builder.class); + } + + public static final int TRIGGERS_FIELD_NUMBER = 1; + private java.util.List triggers_; + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + @java.lang.Override + public java.util.List getTriggersList() { + return triggers_; + } + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + @java.lang.Override + public java.util.List + getTriggersOrBuilderList() { + return triggers_; + } + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + @java.lang.Override + public int getTriggersCount() { + return triggers_.size(); + } + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.Trigger getTriggers(int index) { + return triggers_.get(index); + } + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggersOrBuilder(int index) { + return triggers_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A page token that can be sent to ListTriggers to request the next page.
+   * If this is empty, then there are no more pages.
+   * 
+ * + * 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; + } + } + /** + * + * + *
+   * A page token that can be sent to ListTriggers to request the next page.
+   * If this is empty, then there are no more pages.
+   * 
+ * + * 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; + } + } + + public static final int UNREACHABLE_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList unreachable_; + /** + * + * + *
+   * Unreachable resources, if any.
+   * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + public com.google.protobuf.ProtocolStringList getUnreachableList() { + return unreachable_; + } + /** + * + * + *
+   * Unreachable resources, if any.
+   * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + public int getUnreachableCount() { + return unreachable_.size(); + } + /** + * + * + *
+   * Unreachable resources, if any.
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + public java.lang.String getUnreachable(int index) { + return unreachable_.get(index); + } + /** + * + * + *
+   * Unreachable resources, if any.
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + public com.google.protobuf.ByteString getUnreachableBytes(int index) { + return unreachable_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < triggers_.size(); i++) { + output.writeMessage(1, triggers_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + for (int i = 0; i < unreachable_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, unreachable_.getRaw(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < triggers_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, triggers_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + { + int dataSize = 0; + for (int i = 0; i < unreachable_.size(); i++) { + dataSize += computeStringSizeNoTag(unreachable_.getRaw(i)); + } + size += dataSize; + size += 1 * getUnreachableList().size(); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.eventarc.v1.ListTriggersResponse)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.ListTriggersResponse other = + (com.google.cloud.eventarc.v1.ListTriggersResponse) obj; + + if (!getTriggersList().equals(other.getTriggersList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnreachableList().equals(other.getUnreachableList())) 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 (getTriggersCount() > 0) { + hash = (37 * hash) + TRIGGERS_FIELD_NUMBER; + hash = (53 * hash) + getTriggersList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + if (getUnreachableCount() > 0) { + hash = (37 * hash) + UNREACHABLE_FIELD_NUMBER; + hash = (53 * hash) + getUnreachableList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse 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.eventarc.v1.ListTriggersResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse 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.eventarc.v1.ListTriggersResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse 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.eventarc.v1.ListTriggersResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse 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.eventarc.v1.ListTriggersResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse 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.eventarc.v1.ListTriggersResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The response message for the ListTriggers method.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.ListTriggersResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.ListTriggersResponse) + com.google.cloud.eventarc.v1.ListTriggersResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.ListTriggersResponse.class, + com.google.cloud.eventarc.v1.ListTriggersResponse.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.ListTriggersResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getTriggersFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (triggersBuilder_ == null) { + triggers_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + triggersBuilder_.clear(); + } + nextPageToken_ = ""; + + unreachable_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_ListTriggersResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.ListTriggersResponse getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.ListTriggersResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.ListTriggersResponse build() { + com.google.cloud.eventarc.v1.ListTriggersResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.ListTriggersResponse buildPartial() { + com.google.cloud.eventarc.v1.ListTriggersResponse result = + new com.google.cloud.eventarc.v1.ListTriggersResponse(this); + int from_bitField0_ = bitField0_; + if (triggersBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + triggers_ = java.util.Collections.unmodifiableList(triggers_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.triggers_ = triggers_; + } else { + result.triggers_ = triggersBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + if (((bitField0_ & 0x00000002) != 0)) { + unreachable_ = unreachable_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.unreachable_ = unreachable_; + 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.eventarc.v1.ListTriggersResponse) { + return mergeFrom((com.google.cloud.eventarc.v1.ListTriggersResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.ListTriggersResponse other) { + if (other == com.google.cloud.eventarc.v1.ListTriggersResponse.getDefaultInstance()) + return this; + if (triggersBuilder_ == null) { + if (!other.triggers_.isEmpty()) { + if (triggers_.isEmpty()) { + triggers_ = other.triggers_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTriggersIsMutable(); + triggers_.addAll(other.triggers_); + } + onChanged(); + } + } else { + if (!other.triggers_.isEmpty()) { + if (triggersBuilder_.isEmpty()) { + triggersBuilder_.dispose(); + triggersBuilder_ = null; + triggers_ = other.triggers_; + bitField0_ = (bitField0_ & ~0x00000001); + triggersBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getTriggersFieldBuilder() + : null; + } else { + triggersBuilder_.addAllMessages(other.triggers_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + if (!other.unreachable_.isEmpty()) { + if (unreachable_.isEmpty()) { + unreachable_ = other.unreachable_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureUnreachableIsMutable(); + unreachable_.addAll(other.unreachable_); + } + 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.eventarc.v1.ListTriggersResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.eventarc.v1.ListTriggersResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List triggers_ = + java.util.Collections.emptyList(); + + private void ensureTriggersIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + triggers_ = new java.util.ArrayList(triggers_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder> + triggersBuilder_; + + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public java.util.List getTriggersList() { + if (triggersBuilder_ == null) { + return java.util.Collections.unmodifiableList(triggers_); + } else { + return triggersBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public int getTriggersCount() { + if (triggersBuilder_ == null) { + return triggers_.size(); + } else { + return triggersBuilder_.getCount(); + } + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public com.google.cloud.eventarc.v1.Trigger getTriggers(int index) { + if (triggersBuilder_ == null) { + return triggers_.get(index); + } else { + return triggersBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder setTriggers(int index, com.google.cloud.eventarc.v1.Trigger value) { + if (triggersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTriggersIsMutable(); + triggers_.set(index, value); + onChanged(); + } else { + triggersBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder setTriggers( + int index, com.google.cloud.eventarc.v1.Trigger.Builder builderForValue) { + if (triggersBuilder_ == null) { + ensureTriggersIsMutable(); + triggers_.set(index, builderForValue.build()); + onChanged(); + } else { + triggersBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder addTriggers(com.google.cloud.eventarc.v1.Trigger value) { + if (triggersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTriggersIsMutable(); + triggers_.add(value); + onChanged(); + } else { + triggersBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder addTriggers(int index, com.google.cloud.eventarc.v1.Trigger value) { + if (triggersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTriggersIsMutable(); + triggers_.add(index, value); + onChanged(); + } else { + triggersBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder addTriggers(com.google.cloud.eventarc.v1.Trigger.Builder builderForValue) { + if (triggersBuilder_ == null) { + ensureTriggersIsMutable(); + triggers_.add(builderForValue.build()); + onChanged(); + } else { + triggersBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder addTriggers( + int index, com.google.cloud.eventarc.v1.Trigger.Builder builderForValue) { + if (triggersBuilder_ == null) { + ensureTriggersIsMutable(); + triggers_.add(index, builderForValue.build()); + onChanged(); + } else { + triggersBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder addAllTriggers( + java.lang.Iterable values) { + if (triggersBuilder_ == null) { + ensureTriggersIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, triggers_); + onChanged(); + } else { + triggersBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder clearTriggers() { + if (triggersBuilder_ == null) { + triggers_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + triggersBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public Builder removeTriggers(int index) { + if (triggersBuilder_ == null) { + ensureTriggersIsMutable(); + triggers_.remove(index); + onChanged(); + } else { + triggersBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public com.google.cloud.eventarc.v1.Trigger.Builder getTriggersBuilder(int index) { + return getTriggersFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggersOrBuilder(int index) { + if (triggersBuilder_ == null) { + return triggers_.get(index); + } else { + return triggersBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public java.util.List + getTriggersOrBuilderList() { + if (triggersBuilder_ != null) { + return triggersBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(triggers_); + } + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public com.google.cloud.eventarc.v1.Trigger.Builder addTriggersBuilder() { + return getTriggersFieldBuilder() + .addBuilder(com.google.cloud.eventarc.v1.Trigger.getDefaultInstance()); + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public com.google.cloud.eventarc.v1.Trigger.Builder addTriggersBuilder(int index) { + return getTriggersFieldBuilder() + .addBuilder(index, com.google.cloud.eventarc.v1.Trigger.getDefaultInstance()); + } + /** + * + * + *
+     * The requested triggers, up to the number specified in `page_size`.
+     * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + public java.util.List getTriggersBuilderList() { + return getTriggersFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder> + getTriggersFieldBuilder() { + if (triggersBuilder_ == null) { + triggersBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder>( + triggers_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + triggers_ = null; + } + return triggersBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A page token that can be sent to ListTriggers to request the next page.
+     * If this is empty, then there are no more pages.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * A page token that can be sent to ListTriggers to request the next page.
+     * If this is empty, then there are no more pages.
+     * 
+ * + * 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; + } + } + /** + * + * + *
+     * A page token that can be sent to ListTriggers to request the next page.
+     * If this is empty, then there are no more pages.
+     * 
+ * + * 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; + } + /** + * + * + *
+     * A page token that can be sent to ListTriggers to request the next page.
+     * If this is empty, then there are no more pages.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A page token that can be sent to ListTriggers to request the next page.
+     * If this is empty, then there are no more pages.
+     * 
+ * + * 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; + } + + private com.google.protobuf.LazyStringList unreachable_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureUnreachableIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + unreachable_ = new com.google.protobuf.LazyStringArrayList(unreachable_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + public com.google.protobuf.ProtocolStringList getUnreachableList() { + return unreachable_.getUnmodifiableView(); + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + public int getUnreachableCount() { + return unreachable_.size(); + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + public java.lang.String getUnreachable(int index) { + return unreachable_.get(index); + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + public com.google.protobuf.ByteString getUnreachableBytes(int index) { + return unreachable_.getByteString(index); + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index to set the value at. + * @param value The unreachable to set. + * @return This builder for chaining. + */ + public Builder setUnreachable(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableIsMutable(); + unreachable_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param value The unreachable to add. + * @return This builder for chaining. + */ + public Builder addUnreachable(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableIsMutable(); + unreachable_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param values The unreachable to add. + * @return This builder for chaining. + */ + public Builder addAllUnreachable(java.lang.Iterable values) { + ensureUnreachableIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, unreachable_); + onChanged(); + return this; + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @return This builder for chaining. + */ + public Builder clearUnreachable() { + unreachable_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Unreachable resources, if any.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param value The bytes of the unreachable to add. + * @return This builder for chaining. + */ + public Builder addUnreachableBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureUnreachableIsMutable(); + unreachable_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.eventarc.v1.ListTriggersResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.ListTriggersResponse) + private static final com.google.cloud.eventarc.v1.ListTriggersResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.ListTriggersResponse(); + } + + public static com.google.cloud.eventarc.v1.ListTriggersResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListTriggersResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListTriggersResponse(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.eventarc.v1.ListTriggersResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersResponseOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersResponseOrBuilder.java new file mode 100644 index 00000000..aeec3d76 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ListTriggersResponseOrBuilder.java @@ -0,0 +1,155 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +public interface ListTriggersResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.ListTriggersResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + java.util.List getTriggersList(); + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + com.google.cloud.eventarc.v1.Trigger getTriggers(int index); + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + int getTriggersCount(); + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + java.util.List + getTriggersOrBuilderList(); + /** + * + * + *
+   * The requested triggers, up to the number specified in `page_size`.
+   * 
+ * + * repeated .google.cloud.eventarc.v1.Trigger triggers = 1; + */ + com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggersOrBuilder(int index); + + /** + * + * + *
+   * A page token that can be sent to ListTriggers to request the next page.
+   * If this is empty, then there are no more pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A page token that can be sent to ListTriggers to request the next page.
+   * If this is empty, then there are no more pages.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); + + /** + * + * + *
+   * Unreachable resources, if any.
+   * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + java.util.List getUnreachableList(); + /** + * + * + *
+   * Unreachable resources, if any.
+   * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + int getUnreachableCount(); + /** + * + * + *
+   * Unreachable resources, if any.
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + java.lang.String getUnreachable(int index); + /** + * + * + *
+   * Unreachable resources, if any.
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + com.google.protobuf.ByteString getUnreachableBytes(int index); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/LocationName.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/LocationName.java new file mode 100644 index 00000000..bbd79d91 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/LocationName.java @@ -0,0 +1,192 @@ +/* + * 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.eventarc.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 LocationName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION = + PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + + @Deprecated + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static LocationName of(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build(); + } + + public static String format(String project, String location) { + return newBuilder().setProject(project).setLocation(location).build().toString(); + } + + public static LocationName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION.validatedMatch( + formattedString, "LocationName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (LocationName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION.instantiate("project", project, "location", location); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + LocationName that = ((LocationName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + return h; + } + + /** Builder for projects/{project}/locations/{location}. */ + public static class Builder { + private String project; + private String location; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder(LocationName locationName) { + project = locationName.project; + location = locationName.location; + } + + public LocationName build() { + return new LocationName(this); + } + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/OperationMetadata.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/OperationMetadata.java new file mode 100644 index 00000000..d4957481 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/OperationMetadata.java @@ -0,0 +1,1846 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * Represents the metadata of the long-running operation.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.OperationMetadata} + */ +public final class OperationMetadata extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.OperationMetadata) + OperationMetadataOrBuilder { + private static final long serialVersionUID = 0L; + // Use OperationMetadata.newBuilder() to construct. + private OperationMetadata(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private OperationMetadata() { + target_ = ""; + verb_ = ""; + statusMessage_ = ""; + apiVersion_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new OperationMetadata(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private OperationMetadata( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (endTime_ != null) { + subBuilder = endTime_.toBuilder(); + } + endTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(endTime_); + endTime_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + target_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + verb_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + statusMessage_ = s; + break; + } + case 48: + { + requestedCancellation_ = input.readBool(); + break; + } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + + apiVersion_ = 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.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_OperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_OperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.OperationMetadata.class, + com.google.cloud.eventarc.v1.OperationMetadata.Builder.class); + } + + public static final int CREATE_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int END_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+   * Output only. The time the operation finished running.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the endTime field is set. + */ + @java.lang.Override + public boolean hasEndTime() { + return endTime_ != null; + } + /** + * + * + *
+   * Output only. The time the operation finished running.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The endTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+   * Output only. The time the operation finished running.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return getEndTime(); + } + + public static final int TARGET_FIELD_NUMBER = 3; + private volatile java.lang.Object target_; + /** + * + * + *
+   * Output only. Server-defined resource path for the target of the operation.
+   * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The target. + */ + @java.lang.Override + public java.lang.String getTarget() { + java.lang.Object ref = target_; + 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(); + target_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Server-defined resource path for the target of the operation.
+   * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for target. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTargetBytes() { + java.lang.Object ref = target_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + target_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int VERB_FIELD_NUMBER = 4; + private volatile java.lang.Object verb_; + /** + * + * + *
+   * Output only. Name of the verb executed by the operation.
+   * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The verb. + */ + @java.lang.Override + public java.lang.String getVerb() { + java.lang.Object ref = verb_; + 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(); + verb_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Name of the verb executed by the operation.
+   * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for verb. + */ + @java.lang.Override + public com.google.protobuf.ByteString getVerbBytes() { + java.lang.Object ref = verb_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + verb_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int STATUS_MESSAGE_FIELD_NUMBER = 5; + private volatile java.lang.Object statusMessage_; + /** + * + * + *
+   * Output only. Human-readable status of the operation, if any.
+   * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The statusMessage. + */ + @java.lang.Override + public java.lang.String getStatusMessage() { + java.lang.Object ref = statusMessage_; + 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(); + statusMessage_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Human-readable status of the operation, if any.
+   * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for statusMessage. + */ + @java.lang.Override + public com.google.protobuf.ByteString getStatusMessageBytes() { + java.lang.Object ref = statusMessage_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + statusMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REQUESTED_CANCELLATION_FIELD_NUMBER = 6; + private boolean requestedCancellation_; + /** + * + * + *
+   * Output only. Identifies whether the user has requested cancellation
+   * of the operation. Operations that have successfully been cancelled
+   * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+   * corresponding to `Code.CANCELLED`.
+   * 
+ * + * bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The requestedCancellation. + */ + @java.lang.Override + public boolean getRequestedCancellation() { + return requestedCancellation_; + } + + public static final int API_VERSION_FIELD_NUMBER = 7; + private volatile java.lang.Object apiVersion_; + /** + * + * + *
+   * Output only. API version used to start the operation.
+   * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The apiVersion. + */ + @java.lang.Override + public java.lang.String getApiVersion() { + java.lang.Object ref = apiVersion_; + 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(); + apiVersion_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. API version used to start the operation.
+   * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for apiVersion. + */ + @java.lang.Override + public com.google.protobuf.ByteString getApiVersionBytes() { + java.lang.Object ref = apiVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + apiVersion_ = 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 (createTime_ != null) { + output.writeMessage(1, getCreateTime()); + } + if (endTime_ != null) { + output.writeMessage(2, getEndTime()); + } + if (!getTargetBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, target_); + } + if (!getVerbBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, verb_); + } + if (!getStatusMessageBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, statusMessage_); + } + if (requestedCancellation_ != false) { + output.writeBool(6, requestedCancellation_); + } + if (!getApiVersionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, apiVersion_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getCreateTime()); + } + if (endTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getEndTime()); + } + if (!getTargetBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, target_); + } + if (!getVerbBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, verb_); + } + if (!getStatusMessageBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, statusMessage_); + } + if (requestedCancellation_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, requestedCancellation_); + } + if (!getApiVersionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, apiVersion_); + } + 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.eventarc.v1.OperationMetadata)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.OperationMetadata other = + (com.google.cloud.eventarc.v1.OperationMetadata) obj; + + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (!getTarget().equals(other.getTarget())) return false; + if (!getVerb().equals(other.getVerb())) return false; + if (!getStatusMessage().equals(other.getStatusMessage())) return false; + if (getRequestedCancellation() != other.getRequestedCancellation()) return false; + if (!getApiVersion().equals(other.getApiVersion())) 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 (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + hash = (37 * hash) + TARGET_FIELD_NUMBER; + hash = (53 * hash) + getTarget().hashCode(); + hash = (37 * hash) + VERB_FIELD_NUMBER; + hash = (53 * hash) + getVerb().hashCode(); + hash = (37 * hash) + STATUS_MESSAGE_FIELD_NUMBER; + hash = (53 * hash) + getStatusMessage().hashCode(); + hash = (37 * hash) + REQUESTED_CANCELLATION_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getRequestedCancellation()); + hash = (37 * hash) + API_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getApiVersion().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.OperationMetadata parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.OperationMetadata 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.eventarc.v1.OperationMetadata parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.OperationMetadata 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.eventarc.v1.OperationMetadata parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.OperationMetadata parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.OperationMetadata parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.OperationMetadata 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.eventarc.v1.OperationMetadata parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.OperationMetadata 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.eventarc.v1.OperationMetadata parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.OperationMetadata 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.eventarc.v1.OperationMetadata 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; + } + /** + * + * + *
+   * Represents the metadata of the long-running operation.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.OperationMetadata} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.OperationMetadata) + com.google.cloud.eventarc.v1.OperationMetadataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_OperationMetadata_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_OperationMetadata_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.OperationMetadata.class, + com.google.cloud.eventarc.v1.OperationMetadata.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.OperationMetadata.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 (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (endTimeBuilder_ == null) { + endTime_ = null; + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + target_ = ""; + + verb_ = ""; + + statusMessage_ = ""; + + requestedCancellation_ = false; + + apiVersion_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_OperationMetadata_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.OperationMetadata getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.OperationMetadata.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.OperationMetadata build() { + com.google.cloud.eventarc.v1.OperationMetadata result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.OperationMetadata buildPartial() { + com.google.cloud.eventarc.v1.OperationMetadata result = + new com.google.cloud.eventarc.v1.OperationMetadata(this); + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (endTimeBuilder_ == null) { + result.endTime_ = endTime_; + } else { + result.endTime_ = endTimeBuilder_.build(); + } + result.target_ = target_; + result.verb_ = verb_; + result.statusMessage_ = statusMessage_; + result.requestedCancellation_ = requestedCancellation_; + result.apiVersion_ = apiVersion_; + 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.eventarc.v1.OperationMetadata) { + return mergeFrom((com.google.cloud.eventarc.v1.OperationMetadata) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.OperationMetadata other) { + if (other == com.google.cloud.eventarc.v1.OperationMetadata.getDefaultInstance()) return this; + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + if (!other.getTarget().isEmpty()) { + target_ = other.target_; + onChanged(); + } + if (!other.getVerb().isEmpty()) { + verb_ = other.verb_; + onChanged(); + } + if (!other.getStatusMessage().isEmpty()) { + statusMessage_ = other.statusMessage_; + onChanged(); + } + if (other.getRequestedCancellation() != false) { + setRequestedCancellation(other.getRequestedCancellation()); + } + if (!other.getApiVersion().isEmpty()) { + apiVersion_ = other.apiVersion_; + 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.eventarc.v1.OperationMetadata parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.OperationMetadata) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. The time the operation was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the endTime field is set. + */ + public boolean hasEndTime() { + return endTimeBuilder_ != null || endTime_ != null; + } + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The endTime. + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + onChanged(); + } else { + endTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + onChanged(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (endTime_ != null) { + endTime_ = + com.google.protobuf.Timestamp.newBuilder(endTime_).mergeFrom(value).buildPartial(); + } else { + endTime_ = value; + } + onChanged(); + } else { + endTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearEndTime() { + if (endTimeBuilder_ == null) { + endTime_ = null; + onChanged(); + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+     * Output only. The time the operation finished running.
+     * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + private java.lang.Object target_ = ""; + /** + * + * + *
+     * Output only. Server-defined resource path for the target of the operation.
+     * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The target. + */ + public java.lang.String getTarget() { + java.lang.Object ref = target_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + target_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Server-defined resource path for the target of the operation.
+     * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for target. + */ + public com.google.protobuf.ByteString getTargetBytes() { + java.lang.Object ref = target_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + target_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Server-defined resource path for the target of the operation.
+     * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The target to set. + * @return This builder for chaining. + */ + public Builder setTarget(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + target_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server-defined resource path for the target of the operation.
+     * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearTarget() { + + target_ = getDefaultInstance().getTarget(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server-defined resource path for the target of the operation.
+     * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for target to set. + * @return This builder for chaining. + */ + public Builder setTargetBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + target_ = value; + onChanged(); + return this; + } + + private java.lang.Object verb_ = ""; + /** + * + * + *
+     * Output only. Name of the verb executed by the operation.
+     * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The verb. + */ + public java.lang.String getVerb() { + java.lang.Object ref = verb_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + verb_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Name of the verb executed by the operation.
+     * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for verb. + */ + public com.google.protobuf.ByteString getVerbBytes() { + java.lang.Object ref = verb_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + verb_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Name of the verb executed by the operation.
+     * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The verb to set. + * @return This builder for chaining. + */ + public Builder setVerb(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + verb_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Name of the verb executed by the operation.
+     * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearVerb() { + + verb_ = getDefaultInstance().getVerb(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Name of the verb executed by the operation.
+     * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for verb to set. + * @return This builder for chaining. + */ + public Builder setVerbBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + verb_ = value; + onChanged(); + return this; + } + + private java.lang.Object statusMessage_ = ""; + /** + * + * + *
+     * Output only. Human-readable status of the operation, if any.
+     * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The statusMessage. + */ + public java.lang.String getStatusMessage() { + java.lang.Object ref = statusMessage_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + statusMessage_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Human-readable status of the operation, if any.
+     * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for statusMessage. + */ + public com.google.protobuf.ByteString getStatusMessageBytes() { + java.lang.Object ref = statusMessage_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + statusMessage_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Human-readable status of the operation, if any.
+     * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The statusMessage to set. + * @return This builder for chaining. + */ + public Builder setStatusMessage(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + statusMessage_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Human-readable status of the operation, if any.
+     * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearStatusMessage() { + + statusMessage_ = getDefaultInstance().getStatusMessage(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Human-readable status of the operation, if any.
+     * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for statusMessage to set. + * @return This builder for chaining. + */ + public Builder setStatusMessageBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + statusMessage_ = value; + onChanged(); + return this; + } + + private boolean requestedCancellation_; + /** + * + * + *
+     * Output only. Identifies whether the user has requested cancellation
+     * of the operation. Operations that have successfully been cancelled
+     * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+     * corresponding to `Code.CANCELLED`.
+     * 
+ * + * bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The requestedCancellation. + */ + @java.lang.Override + public boolean getRequestedCancellation() { + return requestedCancellation_; + } + /** + * + * + *
+     * Output only. Identifies whether the user has requested cancellation
+     * of the operation. Operations that have successfully been cancelled
+     * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+     * corresponding to `Code.CANCELLED`.
+     * 
+ * + * bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The requestedCancellation to set. + * @return This builder for chaining. + */ + public Builder setRequestedCancellation(boolean value) { + + requestedCancellation_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Identifies whether the user has requested cancellation
+     * of the operation. Operations that have successfully been cancelled
+     * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+     * corresponding to `Code.CANCELLED`.
+     * 
+ * + * bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearRequestedCancellation() { + + requestedCancellation_ = false; + onChanged(); + return this; + } + + private java.lang.Object apiVersion_ = ""; + /** + * + * + *
+     * Output only. API version used to start the operation.
+     * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The apiVersion. + */ + public java.lang.String getApiVersion() { + java.lang.Object ref = apiVersion_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + apiVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. API version used to start the operation.
+     * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for apiVersion. + */ + public com.google.protobuf.ByteString getApiVersionBytes() { + java.lang.Object ref = apiVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + apiVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. API version used to start the operation.
+     * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The apiVersion to set. + * @return This builder for chaining. + */ + public Builder setApiVersion(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + apiVersion_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. API version used to start the operation.
+     * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearApiVersion() { + + apiVersion_ = getDefaultInstance().getApiVersion(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. API version used to start the operation.
+     * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for apiVersion to set. + * @return This builder for chaining. + */ + public Builder setApiVersionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + apiVersion_ = 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.eventarc.v1.OperationMetadata) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.OperationMetadata) + private static final com.google.cloud.eventarc.v1.OperationMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.OperationMetadata(); + } + + public static com.google.cloud.eventarc.v1.OperationMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public OperationMetadata parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new OperationMetadata(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.eventarc.v1.OperationMetadata getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/OperationMetadataOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/OperationMetadataOrBuilder.java new file mode 100644 index 00000000..891692ec --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/OperationMetadataOrBuilder.java @@ -0,0 +1,217 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +public interface OperationMetadataOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.OperationMetadata) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. The time the operation was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The time the operation finished running.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the endTime field is set. + */ + boolean hasEndTime(); + /** + * + * + *
+   * Output only. The time the operation finished running.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The endTime. + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+   * Output only. The time the operation finished running.
+   * 
+ * + * .google.protobuf.Timestamp end_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); + + /** + * + * + *
+   * Output only. Server-defined resource path for the target of the operation.
+   * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The target. + */ + java.lang.String getTarget(); + /** + * + * + *
+   * Output only. Server-defined resource path for the target of the operation.
+   * 
+ * + * string target = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for target. + */ + com.google.protobuf.ByteString getTargetBytes(); + + /** + * + * + *
+   * Output only. Name of the verb executed by the operation.
+   * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The verb. + */ + java.lang.String getVerb(); + /** + * + * + *
+   * Output only. Name of the verb executed by the operation.
+   * 
+ * + * string verb = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for verb. + */ + com.google.protobuf.ByteString getVerbBytes(); + + /** + * + * + *
+   * Output only. Human-readable status of the operation, if any.
+   * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The statusMessage. + */ + java.lang.String getStatusMessage(); + /** + * + * + *
+   * Output only. Human-readable status of the operation, if any.
+   * 
+ * + * string status_message = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for statusMessage. + */ + com.google.protobuf.ByteString getStatusMessageBytes(); + + /** + * + * + *
+   * Output only. Identifies whether the user has requested cancellation
+   * of the operation. Operations that have successfully been cancelled
+   * have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
+   * corresponding to `Code.CANCELLED`.
+   * 
+ * + * bool requested_cancellation = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The requestedCancellation. + */ + boolean getRequestedCancellation(); + + /** + * + * + *
+   * Output only. API version used to start the operation.
+   * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The apiVersion. + */ + java.lang.String getApiVersion(); + /** + * + * + *
+   * Output only. API version used to start the operation.
+   * 
+ * + * string api_version = 7 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for apiVersion. + */ + com.google.protobuf.ByteString getApiVersionBytes(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Pubsub.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Pubsub.java new file mode 100644 index 00000000..9707b672 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Pubsub.java @@ -0,0 +1,859 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * Represents a Pub/Sub transport.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.Pubsub} + */ +public final class Pubsub extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.Pubsub) + PubsubOrBuilder { + private static final long serialVersionUID = 0L; + // Use Pubsub.newBuilder() to construct. + private Pubsub(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Pubsub() { + topic_ = ""; + subscription_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Pubsub(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Pubsub( + 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(); + + topic_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + subscription_ = 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.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Pubsub_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Pubsub_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.Pubsub.class, + com.google.cloud.eventarc.v1.Pubsub.Builder.class); + } + + public static final int TOPIC_FIELD_NUMBER = 1; + private volatile java.lang.Object topic_; + /** + * + * + *
+   * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+   * system as a transport for the event delivery. Format:
+   * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+   * You may set an existing topic for triggers of the type
+   * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+   * here will not be deleted by Eventarc at trigger deletion.
+   * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The topic. + */ + @java.lang.Override + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + 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(); + topic_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+   * system as a transport for the event delivery. Format:
+   * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+   * You may set an existing topic for triggers of the type
+   * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+   * here will not be deleted by Eventarc at trigger deletion.
+   * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for topic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SUBSCRIPTION_FIELD_NUMBER = 2; + private volatile java.lang.Object subscription_; + /** + * + * + *
+   * Output only. The name of the Pub/Sub subscription created and managed by
+   * Eventarc system as a transport for the event delivery. Format:
+   * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+   * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The subscription. + */ + @java.lang.Override + public java.lang.String getSubscription() { + java.lang.Object ref = subscription_; + 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(); + subscription_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. The name of the Pub/Sub subscription created and managed by
+   * Eventarc system as a transport for the event delivery. Format:
+   * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+   * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for subscription. + */ + @java.lang.Override + public com.google.protobuf.ByteString getSubscriptionBytes() { + java.lang.Object ref = subscription_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + subscription_ = 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 (!getTopicBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, topic_); + } + if (!getSubscriptionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, subscription_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getTopicBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, topic_); + } + if (!getSubscriptionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, subscription_); + } + 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.eventarc.v1.Pubsub)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.Pubsub other = (com.google.cloud.eventarc.v1.Pubsub) obj; + + if (!getTopic().equals(other.getTopic())) return false; + if (!getSubscription().equals(other.getSubscription())) 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) + TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getTopic().hashCode(); + hash = (37 * hash) + SUBSCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getSubscription().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.Pubsub parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Pubsub 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.eventarc.v1.Pubsub parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Pubsub 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.eventarc.v1.Pubsub parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Pubsub parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.Pubsub parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Pubsub 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.eventarc.v1.Pubsub parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Pubsub 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.eventarc.v1.Pubsub parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Pubsub 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.eventarc.v1.Pubsub 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; + } + /** + * + * + *
+   * Represents a Pub/Sub transport.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.Pubsub} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.Pubsub) + com.google.cloud.eventarc.v1.PubsubOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Pubsub_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Pubsub_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.Pubsub.class, + com.google.cloud.eventarc.v1.Pubsub.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.Pubsub.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(); + topic_ = ""; + + subscription_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Pubsub_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Pubsub getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Pubsub build() { + com.google.cloud.eventarc.v1.Pubsub result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Pubsub buildPartial() { + com.google.cloud.eventarc.v1.Pubsub result = new com.google.cloud.eventarc.v1.Pubsub(this); + result.topic_ = topic_; + result.subscription_ = subscription_; + 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.eventarc.v1.Pubsub) { + return mergeFrom((com.google.cloud.eventarc.v1.Pubsub) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.Pubsub other) { + if (other == com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance()) return this; + if (!other.getTopic().isEmpty()) { + topic_ = other.topic_; + onChanged(); + } + if (!other.getSubscription().isEmpty()) { + subscription_ = other.subscription_; + 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.eventarc.v1.Pubsub parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.Pubsub) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object topic_ = ""; + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+     * system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+     * You may set an existing topic for triggers of the type
+     * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+     * here will not be deleted by Eventarc at trigger deletion.
+     * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The topic. + */ + public java.lang.String getTopic() { + java.lang.Object ref = topic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + topic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+     * system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+     * You may set an existing topic for triggers of the type
+     * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+     * here will not be deleted by Eventarc at trigger deletion.
+     * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for topic. + */ + public com.google.protobuf.ByteString getTopicBytes() { + java.lang.Object ref = topic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + topic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+     * system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+     * You may set an existing topic for triggers of the type
+     * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+     * here will not be deleted by Eventarc at trigger deletion.
+     * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The topic to set. + * @return This builder for chaining. + */ + public Builder setTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + topic_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+     * system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+     * You may set an existing topic for triggers of the type
+     * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+     * here will not be deleted by Eventarc at trigger deletion.
+     * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearTopic() { + + topic_ = getDefaultInstance().getTopic(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+     * system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+     * You may set an existing topic for triggers of the type
+     * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+     * here will not be deleted by Eventarc at trigger deletion.
+     * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for topic to set. + * @return This builder for chaining. + */ + public Builder setTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + topic_ = value; + onChanged(); + return this; + } + + private java.lang.Object subscription_ = ""; + /** + * + * + *
+     * Output only. The name of the Pub/Sub subscription created and managed by
+     * Eventarc system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+     * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The subscription. + */ + public java.lang.String getSubscription() { + java.lang.Object ref = subscription_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + subscription_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. The name of the Pub/Sub subscription created and managed by
+     * Eventarc system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+     * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for subscription. + */ + public com.google.protobuf.ByteString getSubscriptionBytes() { + java.lang.Object ref = subscription_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + subscription_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. The name of the Pub/Sub subscription created and managed by
+     * Eventarc system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+     * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The subscription to set. + * @return This builder for chaining. + */ + public Builder setSubscription(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + subscription_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the Pub/Sub subscription created and managed by
+     * Eventarc system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+     * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearSubscription() { + + subscription_ = getDefaultInstance().getSubscription(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The name of the Pub/Sub subscription created and managed by
+     * Eventarc system as a transport for the event delivery. Format:
+     * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+     * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for subscription to set. + * @return This builder for chaining. + */ + public Builder setSubscriptionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + subscription_ = 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.eventarc.v1.Pubsub) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.Pubsub) + private static final com.google.cloud.eventarc.v1.Pubsub DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.Pubsub(); + } + + public static com.google.cloud.eventarc.v1.Pubsub getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Pubsub parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Pubsub(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.eventarc.v1.Pubsub getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/PubsubOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/PubsubOrBuilder.java new file mode 100644 index 00000000..565c998e --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/PubsubOrBuilder.java @@ -0,0 +1,89 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +public interface PubsubOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.Pubsub) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+   * system as a transport for the event delivery. Format:
+   * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+   * You may set an existing topic for triggers of the type
+   * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+   * here will not be deleted by Eventarc at trigger deletion.
+   * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The topic. + */ + java.lang.String getTopic(); + /** + * + * + *
+   * Optional. The name of the Pub/Sub topic created and managed by Eventarc
+   * system as a transport for the event delivery. Format:
+   * `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.
+   * You may set an existing topic for triggers of the type
+   * `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide
+   * here will not be deleted by Eventarc at trigger deletion.
+   * 
+ * + * string topic = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for topic. + */ + com.google.protobuf.ByteString getTopicBytes(); + + /** + * + * + *
+   * Output only. The name of the Pub/Sub subscription created and managed by
+   * Eventarc system as a transport for the event delivery. Format:
+   * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+   * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The subscription. + */ + java.lang.String getSubscription(); + /** + * + * + *
+   * Output only. The name of the Pub/Sub subscription created and managed by
+   * Eventarc system as a transport for the event delivery. Format:
+   * `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.
+   * 
+ * + * string subscription = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for subscription. + */ + com.google.protobuf.ByteString getSubscriptionBytes(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ServiceAccountName.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ServiceAccountName.java new file mode 100644 index 00000000..e8b03057 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/ServiceAccountName.java @@ -0,0 +1,193 @@ +/* + * 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.eventarc.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 ServiceAccountName implements ResourceName { + private static final PathTemplate PROJECT_SERVICE_ACCOUNT = + PathTemplate.createWithoutUrlEncoding("projects/{project}/serviceAccounts/{service_account}"); + private volatile Map fieldValuesMap; + private final String project; + private final String serviceAccount; + + @Deprecated + protected ServiceAccountName() { + project = null; + serviceAccount = null; + } + + private ServiceAccountName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + serviceAccount = Preconditions.checkNotNull(builder.getServiceAccount()); + } + + public String getProject() { + return project; + } + + public String getServiceAccount() { + return serviceAccount; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ServiceAccountName of(String project, String serviceAccount) { + return newBuilder().setProject(project).setServiceAccount(serviceAccount).build(); + } + + public static String format(String project, String serviceAccount) { + return newBuilder().setProject(project).setServiceAccount(serviceAccount).build().toString(); + } + + public static ServiceAccountName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_SERVICE_ACCOUNT.validatedMatch( + formattedString, "ServiceAccountName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("service_account")); + } + + 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 (ServiceAccountName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_SERVICE_ACCOUNT.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 (serviceAccount != null) { + fieldMapBuilder.put("service_account", serviceAccount); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_SERVICE_ACCOUNT.instantiate( + "project", project, "service_account", serviceAccount); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + ServiceAccountName that = ((ServiceAccountName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.serviceAccount, that.serviceAccount); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(serviceAccount); + return h; + } + + /** Builder for projects/{project}/serviceAccounts/{service_account}. */ + public static class Builder { + private String project; + private String serviceAccount; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getServiceAccount() { + return serviceAccount; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setServiceAccount(String serviceAccount) { + this.serviceAccount = serviceAccount; + return this; + } + + private Builder(ServiceAccountName serviceAccountName) { + project = serviceAccountName.project; + serviceAccount = serviceAccountName.serviceAccount; + } + + public ServiceAccountName build() { + return new ServiceAccountName(this); + } + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Transport.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Transport.java new file mode 100644 index 00000000..c1bc1806 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Transport.java @@ -0,0 +1,845 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * Represents the transport intermediaries created for the trigger in order to
+ * deliver events.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.Transport} + */ +public final class Transport extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.Transport) + TransportOrBuilder { + private static final long serialVersionUID = 0L; + // Use Transport.newBuilder() to construct. + private Transport(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Transport() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Transport(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Transport( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.eventarc.v1.Pubsub.Builder subBuilder = null; + if (intermediaryCase_ == 1) { + subBuilder = ((com.google.cloud.eventarc.v1.Pubsub) intermediary_).toBuilder(); + } + intermediary_ = + input.readMessage( + com.google.cloud.eventarc.v1.Pubsub.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.eventarc.v1.Pubsub) intermediary_); + intermediary_ = subBuilder.buildPartial(); + } + intermediaryCase_ = 1; + 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.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Transport_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Transport_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.Transport.class, + com.google.cloud.eventarc.v1.Transport.Builder.class); + } + + private int intermediaryCase_ = 0; + private java.lang.Object intermediary_; + + public enum IntermediaryCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + PUBSUB(1), + INTERMEDIARY_NOT_SET(0); + private final int value; + + private IntermediaryCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static IntermediaryCase valueOf(int value) { + return forNumber(value); + } + + public static IntermediaryCase forNumber(int value) { + switch (value) { + case 1: + return PUBSUB; + case 0: + return INTERMEDIARY_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public IntermediaryCase getIntermediaryCase() { + return IntermediaryCase.forNumber(intermediaryCase_); + } + + public static final int PUBSUB_FIELD_NUMBER = 1; + /** + * + * + *
+   * The Pub/Sub topic and subscription used by Eventarc as delivery
+   * intermediary.
+   * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + * + * @return Whether the pubsub field is set. + */ + @java.lang.Override + public boolean hasPubsub() { + return intermediaryCase_ == 1; + } + /** + * + * + *
+   * The Pub/Sub topic and subscription used by Eventarc as delivery
+   * intermediary.
+   * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + * + * @return The pubsub. + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.Pubsub getPubsub() { + if (intermediaryCase_ == 1) { + return (com.google.cloud.eventarc.v1.Pubsub) intermediary_; + } + return com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance(); + } + /** + * + * + *
+   * The Pub/Sub topic and subscription used by Eventarc as delivery
+   * intermediary.
+   * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.PubsubOrBuilder getPubsubOrBuilder() { + if (intermediaryCase_ == 1) { + return (com.google.cloud.eventarc.v1.Pubsub) intermediary_; + } + return com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance(); + } + + 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 (intermediaryCase_ == 1) { + output.writeMessage(1, (com.google.cloud.eventarc.v1.Pubsub) intermediary_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (intermediaryCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.cloud.eventarc.v1.Pubsub) intermediary_); + } + 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.eventarc.v1.Transport)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.Transport other = (com.google.cloud.eventarc.v1.Transport) obj; + + if (!getIntermediaryCase().equals(other.getIntermediaryCase())) return false; + switch (intermediaryCase_) { + case 1: + if (!getPubsub().equals(other.getPubsub())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (intermediaryCase_) { + case 1: + hash = (37 * hash) + PUBSUB_FIELD_NUMBER; + hash = (53 * hash) + getPubsub().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.Transport parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Transport 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.eventarc.v1.Transport parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Transport 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.eventarc.v1.Transport parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Transport parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.Transport parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Transport 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.eventarc.v1.Transport parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Transport 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.eventarc.v1.Transport parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Transport 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.eventarc.v1.Transport 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; + } + /** + * + * + *
+   * Represents the transport intermediaries created for the trigger in order to
+   * deliver events.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.Transport} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.Transport) + com.google.cloud.eventarc.v1.TransportOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Transport_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Transport_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.Transport.class, + com.google.cloud.eventarc.v1.Transport.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.Transport.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(); + intermediaryCase_ = 0; + intermediary_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Transport_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Transport getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.Transport.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Transport build() { + com.google.cloud.eventarc.v1.Transport result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Transport buildPartial() { + com.google.cloud.eventarc.v1.Transport result = + new com.google.cloud.eventarc.v1.Transport(this); + if (intermediaryCase_ == 1) { + if (pubsubBuilder_ == null) { + result.intermediary_ = intermediary_; + } else { + result.intermediary_ = pubsubBuilder_.build(); + } + } + result.intermediaryCase_ = intermediaryCase_; + 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.eventarc.v1.Transport) { + return mergeFrom((com.google.cloud.eventarc.v1.Transport) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.Transport other) { + if (other == com.google.cloud.eventarc.v1.Transport.getDefaultInstance()) return this; + switch (other.getIntermediaryCase()) { + case PUBSUB: + { + mergePubsub(other.getPubsub()); + break; + } + case INTERMEDIARY_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.eventarc.v1.Transport parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.Transport) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int intermediaryCase_ = 0; + private java.lang.Object intermediary_; + + public IntermediaryCase getIntermediaryCase() { + return IntermediaryCase.forNumber(intermediaryCase_); + } + + public Builder clearIntermediary() { + intermediaryCase_ = 0; + intermediary_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Pubsub, + com.google.cloud.eventarc.v1.Pubsub.Builder, + com.google.cloud.eventarc.v1.PubsubOrBuilder> + pubsubBuilder_; + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + * + * @return Whether the pubsub field is set. + */ + @java.lang.Override + public boolean hasPubsub() { + return intermediaryCase_ == 1; + } + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + * + * @return The pubsub. + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.Pubsub getPubsub() { + if (pubsubBuilder_ == null) { + if (intermediaryCase_ == 1) { + return (com.google.cloud.eventarc.v1.Pubsub) intermediary_; + } + return com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance(); + } else { + if (intermediaryCase_ == 1) { + return pubsubBuilder_.getMessage(); + } + return com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance(); + } + } + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + public Builder setPubsub(com.google.cloud.eventarc.v1.Pubsub value) { + if (pubsubBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + intermediary_ = value; + onChanged(); + } else { + pubsubBuilder_.setMessage(value); + } + intermediaryCase_ = 1; + return this; + } + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + public Builder setPubsub(com.google.cloud.eventarc.v1.Pubsub.Builder builderForValue) { + if (pubsubBuilder_ == null) { + intermediary_ = builderForValue.build(); + onChanged(); + } else { + pubsubBuilder_.setMessage(builderForValue.build()); + } + intermediaryCase_ = 1; + return this; + } + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + public Builder mergePubsub(com.google.cloud.eventarc.v1.Pubsub value) { + if (pubsubBuilder_ == null) { + if (intermediaryCase_ == 1 + && intermediary_ != com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance()) { + intermediary_ = + com.google.cloud.eventarc.v1.Pubsub.newBuilder( + (com.google.cloud.eventarc.v1.Pubsub) intermediary_) + .mergeFrom(value) + .buildPartial(); + } else { + intermediary_ = value; + } + onChanged(); + } else { + if (intermediaryCase_ == 1) { + pubsubBuilder_.mergeFrom(value); + } + pubsubBuilder_.setMessage(value); + } + intermediaryCase_ = 1; + return this; + } + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + public Builder clearPubsub() { + if (pubsubBuilder_ == null) { + if (intermediaryCase_ == 1) { + intermediaryCase_ = 0; + intermediary_ = null; + onChanged(); + } + } else { + if (intermediaryCase_ == 1) { + intermediaryCase_ = 0; + intermediary_ = null; + } + pubsubBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + public com.google.cloud.eventarc.v1.Pubsub.Builder getPubsubBuilder() { + return getPubsubFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.PubsubOrBuilder getPubsubOrBuilder() { + if ((intermediaryCase_ == 1) && (pubsubBuilder_ != null)) { + return pubsubBuilder_.getMessageOrBuilder(); + } else { + if (intermediaryCase_ == 1) { + return (com.google.cloud.eventarc.v1.Pubsub) intermediary_; + } + return com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance(); + } + } + /** + * + * + *
+     * The Pub/Sub topic and subscription used by Eventarc as delivery
+     * intermediary.
+     * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Pubsub, + com.google.cloud.eventarc.v1.Pubsub.Builder, + com.google.cloud.eventarc.v1.PubsubOrBuilder> + getPubsubFieldBuilder() { + if (pubsubBuilder_ == null) { + if (!(intermediaryCase_ == 1)) { + intermediary_ = com.google.cloud.eventarc.v1.Pubsub.getDefaultInstance(); + } + pubsubBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Pubsub, + com.google.cloud.eventarc.v1.Pubsub.Builder, + com.google.cloud.eventarc.v1.PubsubOrBuilder>( + (com.google.cloud.eventarc.v1.Pubsub) intermediary_, + getParentForChildren(), + isClean()); + intermediary_ = null; + } + intermediaryCase_ = 1; + onChanged(); + ; + return pubsubBuilder_; + } + + @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.eventarc.v1.Transport) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.Transport) + private static final com.google.cloud.eventarc.v1.Transport DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.Transport(); + } + + public static com.google.cloud.eventarc.v1.Transport getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Transport parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Transport(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.eventarc.v1.Transport getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TransportOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TransportOrBuilder.java new file mode 100644 index 00000000..16ef6526 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TransportOrBuilder.java @@ -0,0 +1,65 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +public interface TransportOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.Transport) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The Pub/Sub topic and subscription used by Eventarc as delivery
+   * intermediary.
+   * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + * + * @return Whether the pubsub field is set. + */ + boolean hasPubsub(); + /** + * + * + *
+   * The Pub/Sub topic and subscription used by Eventarc as delivery
+   * intermediary.
+   * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + * + * @return The pubsub. + */ + com.google.cloud.eventarc.v1.Pubsub getPubsub(); + /** + * + * + *
+   * The Pub/Sub topic and subscription used by Eventarc as delivery
+   * intermediary.
+   * 
+ * + * .google.cloud.eventarc.v1.Pubsub pubsub = 1; + */ + com.google.cloud.eventarc.v1.PubsubOrBuilder getPubsubOrBuilder(); + + public com.google.cloud.eventarc.v1.Transport.IntermediaryCase getIntermediaryCase(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Trigger.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Trigger.java new file mode 100644 index 00000000..9590a3ea --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/Trigger.java @@ -0,0 +1,3420 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +/** + * + * + *
+ * A representation of the trigger resource.
+ * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.Trigger} + */ +public final class Trigger extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.Trigger) + TriggerOrBuilder { + private static final long serialVersionUID = 0L; + // Use Trigger.newBuilder() to construct. + private Trigger(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Trigger() { + name_ = ""; + uid_ = ""; + eventFilters_ = java.util.Collections.emptyList(); + serviceAccount_ = ""; + etag_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Trigger(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Trigger( + 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(); + + uid_ = s; + break; + } + case 42: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (createTime_ != null) { + subBuilder = createTime_.toBuilder(); + } + createTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(createTime_); + createTime_ = subBuilder.buildPartial(); + } + + break; + } + case 50: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 66: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + eventFilters_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + eventFilters_.add( + input.readMessage( + com.google.cloud.eventarc.v1.EventFilter.parser(), extensionRegistry)); + break; + } + case 74: + { + java.lang.String s = input.readStringRequireUtf8(); + + serviceAccount_ = s; + break; + } + case 82: + { + com.google.cloud.eventarc.v1.Destination.Builder subBuilder = null; + if (destination_ != null) { + subBuilder = destination_.toBuilder(); + } + destination_ = + input.readMessage( + com.google.cloud.eventarc.v1.Destination.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(destination_); + destination_ = subBuilder.buildPartial(); + } + + break; + } + case 90: + { + com.google.cloud.eventarc.v1.Transport.Builder subBuilder = null; + if (transport_ != null) { + subBuilder = transport_.toBuilder(); + } + transport_ = + input.readMessage( + com.google.cloud.eventarc.v1.Transport.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(transport_); + transport_ = subBuilder.buildPartial(); + } + + break; + } + case 98: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + labels_ = + com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + mutable_bitField0_ |= 0x00000002; + } + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry); + labels_.getMutableMap().put(labels__.getKey(), labels__.getValue()); + break; + } + case 794: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + eventFilters_ = java.util.Collections.unmodifiableList(eventFilters_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Trigger_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 12: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Trigger_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.Trigger.class, + com.google.cloud.eventarc.v1.Trigger.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the trigger. Must be unique within the
+   * location on the project and must be in
+   * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the trigger. Must be unique within the
+   * location on the project and must be in
+   * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 2; + private volatile java.lang.Object uid_; + /** + * + * + *
+   * Output only. Server assigned unique identifier for the trigger. The value
+   * is a UUID4 string and guaranteed to remain unchanged until the resource is
+   * deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Server assigned unique identifier for the trigger. The value
+   * is a UUID4 string and guaranteed to remain unchanged until the resource is
+   * deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_TIME_FIELD_NUMBER = 5; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return createTime_ != null; + } + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return getCreateTime(); + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 6; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + @java.lang.Override + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int EVENT_FILTERS_FIELD_NUMBER = 8; + private java.util.List eventFilters_; + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public java.util.List getEventFiltersList() { + return eventFilters_; + } + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public java.util.List + getEventFiltersOrBuilderList() { + return eventFilters_; + } + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public int getEventFiltersCount() { + return eventFilters_.size(); + } + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.EventFilter getEventFilters(int index) { + return eventFilters_.get(index); + } + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.EventFilterOrBuilder getEventFiltersOrBuilder(int index) { + return eventFilters_.get(index); + } + + public static final int SERVICE_ACCOUNT_FIELD_NUMBER = 9; + private volatile java.lang.Object serviceAccount_; + /** + * + * + *
+   * Optional. The IAM service account email associated with the trigger. The
+   * service account represents the identity of the trigger.
+   * The principal who calls this API must have `iam.serviceAccounts.actAs`
+   * permission in the service account. See
+   * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+   * for more information.
+   * For Cloud Run destinations, this service account is used to generate
+   * identity tokens when invoking the service. See
+   * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+   * for information on how to invoke authenticated Cloud Run services.
+   * In order to create Audit Log triggers, the service account should also
+   * have `roles/eventarc.eventReceiver` IAM role.
+   * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The serviceAccount. + */ + @java.lang.Override + public java.lang.String getServiceAccount() { + java.lang.Object ref = serviceAccount_; + 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(); + serviceAccount_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The IAM service account email associated with the trigger. The
+   * service account represents the identity of the trigger.
+   * The principal who calls this API must have `iam.serviceAccounts.actAs`
+   * permission in the service account. See
+   * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+   * for more information.
+   * For Cloud Run destinations, this service account is used to generate
+   * identity tokens when invoking the service. See
+   * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+   * for information on how to invoke authenticated Cloud Run services.
+   * In order to create Audit Log triggers, the service account should also
+   * have `roles/eventarc.eventReceiver` IAM role.
+   * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for serviceAccount. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceAccountBytes() { + java.lang.Object ref = serviceAccount_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESTINATION_FIELD_NUMBER = 10; + private com.google.cloud.eventarc.v1.Destination destination_; + /** + * + * + *
+   * Required. Destination specifies where the events should be sent to.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the destination field is set. + */ + @java.lang.Override + public boolean hasDestination() { + return destination_ != null; + } + /** + * + * + *
+   * Required. Destination specifies where the events should be sent to.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The destination. + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.Destination getDestination() { + return destination_ == null + ? com.google.cloud.eventarc.v1.Destination.getDefaultInstance() + : destination_; + } + /** + * + * + *
+   * Required. Destination specifies where the events should be sent to.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.DestinationOrBuilder getDestinationOrBuilder() { + return getDestination(); + } + + public static final int TRANSPORT_FIELD_NUMBER = 11; + private com.google.cloud.eventarc.v1.Transport transport_; + /** + * + * + *
+   * Optional. In order to deliver messages, Eventarc may use other GCP
+   * products as transport intermediary. This field contains a reference to that
+   * transport intermediary. This information can be used for debugging
+   * purposes.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the transport field is set. + */ + @java.lang.Override + public boolean hasTransport() { + return transport_ != null; + } + /** + * + * + *
+   * Optional. In order to deliver messages, Eventarc may use other GCP
+   * products as transport intermediary. This field contains a reference to that
+   * transport intermediary. This information can be used for debugging
+   * purposes.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The transport. + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.Transport getTransport() { + return transport_ == null + ? com.google.cloud.eventarc.v1.Transport.getDefaultInstance() + : transport_; + } + /** + * + * + *
+   * Optional. In order to deliver messages, Eventarc may use other GCP
+   * products as transport intermediary. This field contains a reference to that
+   * transport intermediary. This information can be used for debugging
+   * purposes.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.TransportOrBuilder getTransportOrBuilder() { + return getTransport(); + } + + public static final int LABELS_FIELD_NUMBER = 12; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Trigger_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int ETAG_FIELD_NUMBER = 99; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields, and may be sent only on create requests to ensure the client
+   * has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + @java.lang.Override + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields, and may be sent only on create requests to ensure the client
+   * has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + @java.lang.Override + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!getUidBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + if (createTime_ != null) { + output.writeMessage(5, getCreateTime()); + } + if (updateTime_ != null) { + output.writeMessage(6, getUpdateTime()); + } + for (int i = 0; i < eventFilters_.size(); i++) { + output.writeMessage(8, eventFilters_.get(i)); + } + if (!getServiceAccountBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 9, serviceAccount_); + } + if (destination_ != null) { + output.writeMessage(10, getDestination()); + } + if (transport_ != null) { + output.writeMessage(11, getTransport()); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 12); + if (!getEtagBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 99, etag_); + } + 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 (!getUidBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + if (createTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, getCreateTime()); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getUpdateTime()); + } + for (int i = 0; i < eventFilters_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, eventFilters_.get(i)); + } + if (!getServiceAccountBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(9, serviceAccount_); + } + if (destination_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, getDestination()); + } + if (transport_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getTransport()); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, labels__); + } + if (!getEtagBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(99, etag_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.eventarc.v1.Trigger)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.Trigger other = (com.google.cloud.eventarc.v1.Trigger) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!getEventFiltersList().equals(other.getEventFiltersList())) return false; + if (!getServiceAccount().equals(other.getServiceAccount())) return false; + if (hasDestination() != other.hasDestination()) return false; + if (hasDestination()) { + if (!getDestination().equals(other.getDestination())) return false; + } + if (hasTransport() != other.hasTransport()) return false; + if (hasTransport()) { + if (!getTransport().equals(other.getTransport())) return false; + } + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + if (getEventFiltersCount() > 0) { + hash = (37 * hash) + EVENT_FILTERS_FIELD_NUMBER; + hash = (53 * hash) + getEventFiltersList().hashCode(); + } + hash = (37 * hash) + SERVICE_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getServiceAccount().hashCode(); + if (hasDestination()) { + hash = (37 * hash) + DESTINATION_FIELD_NUMBER; + hash = (53 * hash) + getDestination().hashCode(); + } + if (hasTransport()) { + hash = (37 * hash) + TRANSPORT_FIELD_NUMBER; + hash = (53 * hash) + getTransport().hashCode(); + } + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.Trigger parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Trigger 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.eventarc.v1.Trigger parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Trigger 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.eventarc.v1.Trigger parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.Trigger parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.Trigger parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Trigger 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.eventarc.v1.Trigger parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Trigger 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.eventarc.v1.Trigger parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.Trigger 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.eventarc.v1.Trigger 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 representation of the trigger resource.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.Trigger} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.Trigger) + com.google.cloud.eventarc.v1.TriggerOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Trigger_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMapField(int number) { + switch (number) { + case 12: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapField internalGetMutableMapField(int number) { + switch (number) { + case 12: + return internalGetMutableLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Trigger_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.Trigger.class, + com.google.cloud.eventarc.v1.Trigger.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.Trigger.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getEventFiltersFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + uid_ = ""; + + if (createTimeBuilder_ == null) { + createTime_ = null; + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + if (eventFiltersBuilder_ == null) { + eventFilters_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + eventFiltersBuilder_.clear(); + } + serviceAccount_ = ""; + + if (destinationBuilder_ == null) { + destination_ = null; + } else { + destination_ = null; + destinationBuilder_ = null; + } + if (transportBuilder_ == null) { + transport_ = null; + } else { + transport_ = null; + transportBuilder_ = null; + } + internalGetMutableLabels().clear(); + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.TriggerProto + .internal_static_google_cloud_eventarc_v1_Trigger_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Trigger getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.Trigger.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Trigger build() { + com.google.cloud.eventarc.v1.Trigger result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.Trigger buildPartial() { + com.google.cloud.eventarc.v1.Trigger result = new com.google.cloud.eventarc.v1.Trigger(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.uid_ = uid_; + if (createTimeBuilder_ == null) { + result.createTime_ = createTime_; + } else { + result.createTime_ = createTimeBuilder_.build(); + } + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (eventFiltersBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + eventFilters_ = java.util.Collections.unmodifiableList(eventFilters_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.eventFilters_ = eventFilters_; + } else { + result.eventFilters_ = eventFiltersBuilder_.build(); + } + result.serviceAccount_ = serviceAccount_; + if (destinationBuilder_ == null) { + result.destination_ = destination_; + } else { + result.destination_ = destinationBuilder_.build(); + } + if (transportBuilder_ == null) { + result.transport_ = transport_; + } else { + result.transport_ = transportBuilder_.build(); + } + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + result.etag_ = etag_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.eventarc.v1.Trigger) { + return mergeFrom((com.google.cloud.eventarc.v1.Trigger) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.Trigger other) { + if (other == com.google.cloud.eventarc.v1.Trigger.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + if (eventFiltersBuilder_ == null) { + if (!other.eventFilters_.isEmpty()) { + if (eventFilters_.isEmpty()) { + eventFilters_ = other.eventFilters_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureEventFiltersIsMutable(); + eventFilters_.addAll(other.eventFilters_); + } + onChanged(); + } + } else { + if (!other.eventFilters_.isEmpty()) { + if (eventFiltersBuilder_.isEmpty()) { + eventFiltersBuilder_.dispose(); + eventFiltersBuilder_ = null; + eventFilters_ = other.eventFilters_; + bitField0_ = (bitField0_ & ~0x00000001); + eventFiltersBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getEventFiltersFieldBuilder() + : null; + } else { + eventFiltersBuilder_.addAllMessages(other.eventFilters_); + } + } + } + if (!other.getServiceAccount().isEmpty()) { + serviceAccount_ = other.serviceAccount_; + onChanged(); + } + if (other.hasDestination()) { + mergeDestination(other.getDestination()); + } + if (other.hasTransport()) { + mergeTransport(other.getTransport()); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.eventarc.v1.Trigger parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.eventarc.v1.Trigger) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the trigger. Must be unique within the
+     * location on the project and must be in
+     * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the trigger. Must be unique within the
+     * location on the project and must be in
+     * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the trigger. Must be unique within the
+     * location on the project and must be in
+     * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the trigger. Must be unique within the
+     * location on the project and must be in
+     * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the trigger. Must be unique within the
+     * location on the project and must be in
+     * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. Server assigned unique identifier for the trigger. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the trigger. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the trigger. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + uid_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the trigger. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearUid() { + + uid_ = getDefaultInstance().getUid(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Server assigned unique identifier for the trigger. The value
+     * is a UUID4 string and guaranteed to remain unchanged until the resource is
+     * deleted.
+     * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + uid_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return createTimeBuilder_ != null || createTime_ != null; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + onChanged(); + } else { + createTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + onChanged(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (createTime_ != null) { + createTime_ = + com.google.protobuf.Timestamp.newBuilder(createTime_).mergeFrom(value).buildPartial(); + } else { + createTime_ = value; + } + onChanged(); + } else { + createTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + if (createTimeBuilder_ == null) { + createTime_ = null; + onChanged(); + } else { + createTime_ = null; + createTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. The creation time.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * Output only. The last-modified time.
+     * 
+ * + * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private java.util.List eventFilters_ = + java.util.Collections.emptyList(); + + private void ensureEventFiltersIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + eventFilters_ = + new java.util.ArrayList(eventFilters_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.eventarc.v1.EventFilter, + com.google.cloud.eventarc.v1.EventFilter.Builder, + com.google.cloud.eventarc.v1.EventFilterOrBuilder> + eventFiltersBuilder_; + + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List getEventFiltersList() { + if (eventFiltersBuilder_ == null) { + return java.util.Collections.unmodifiableList(eventFilters_); + } else { + return eventFiltersBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public int getEventFiltersCount() { + if (eventFiltersBuilder_ == null) { + return eventFilters_.size(); + } else { + return eventFiltersBuilder_.getCount(); + } + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.EventFilter getEventFilters(int index) { + if (eventFiltersBuilder_ == null) { + return eventFilters_.get(index); + } else { + return eventFiltersBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setEventFilters(int index, com.google.cloud.eventarc.v1.EventFilter value) { + if (eventFiltersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEventFiltersIsMutable(); + eventFilters_.set(index, value); + onChanged(); + } else { + eventFiltersBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setEventFilters( + int index, com.google.cloud.eventarc.v1.EventFilter.Builder builderForValue) { + if (eventFiltersBuilder_ == null) { + ensureEventFiltersIsMutable(); + eventFilters_.set(index, builderForValue.build()); + onChanged(); + } else { + eventFiltersBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addEventFilters(com.google.cloud.eventarc.v1.EventFilter value) { + if (eventFiltersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEventFiltersIsMutable(); + eventFilters_.add(value); + onChanged(); + } else { + eventFiltersBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addEventFilters(int index, com.google.cloud.eventarc.v1.EventFilter value) { + if (eventFiltersBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureEventFiltersIsMutable(); + eventFilters_.add(index, value); + onChanged(); + } else { + eventFiltersBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addEventFilters( + com.google.cloud.eventarc.v1.EventFilter.Builder builderForValue) { + if (eventFiltersBuilder_ == null) { + ensureEventFiltersIsMutable(); + eventFilters_.add(builderForValue.build()); + onChanged(); + } else { + eventFiltersBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addEventFilters( + int index, com.google.cloud.eventarc.v1.EventFilter.Builder builderForValue) { + if (eventFiltersBuilder_ == null) { + ensureEventFiltersIsMutable(); + eventFilters_.add(index, builderForValue.build()); + onChanged(); + } else { + eventFiltersBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addAllEventFilters( + java.lang.Iterable values) { + if (eventFiltersBuilder_ == null) { + ensureEventFiltersIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, eventFilters_); + onChanged(); + } else { + eventFiltersBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearEventFilters() { + if (eventFiltersBuilder_ == null) { + eventFilters_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + eventFiltersBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder removeEventFilters(int index) { + if (eventFiltersBuilder_ == null) { + ensureEventFiltersIsMutable(); + eventFilters_.remove(index); + onChanged(); + } else { + eventFiltersBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.EventFilter.Builder getEventFiltersBuilder(int index) { + return getEventFiltersFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.EventFilterOrBuilder getEventFiltersOrBuilder(int index) { + if (eventFiltersBuilder_ == null) { + return eventFilters_.get(index); + } else { + return eventFiltersBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getEventFiltersOrBuilderList() { + if (eventFiltersBuilder_ != null) { + return eventFiltersBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(eventFilters_); + } + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.EventFilter.Builder addEventFiltersBuilder() { + return getEventFiltersFieldBuilder() + .addBuilder(com.google.cloud.eventarc.v1.EventFilter.getDefaultInstance()); + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.EventFilter.Builder addEventFiltersBuilder(int index) { + return getEventFiltersFieldBuilder() + .addBuilder(index, com.google.cloud.eventarc.v1.EventFilter.getDefaultInstance()); + } + /** + * + * + *
+     * Required. null The list of filters that applies to event attributes. Only
+     * events that match all the provided filters will be sent to the destination.
+     * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getEventFiltersBuilderList() { + return getEventFiltersFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.eventarc.v1.EventFilter, + com.google.cloud.eventarc.v1.EventFilter.Builder, + com.google.cloud.eventarc.v1.EventFilterOrBuilder> + getEventFiltersFieldBuilder() { + if (eventFiltersBuilder_ == null) { + eventFiltersBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.eventarc.v1.EventFilter, + com.google.cloud.eventarc.v1.EventFilter.Builder, + com.google.cloud.eventarc.v1.EventFilterOrBuilder>( + eventFilters_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + eventFilters_ = null; + } + return eventFiltersBuilder_; + } + + private java.lang.Object serviceAccount_ = ""; + /** + * + * + *
+     * Optional. The IAM service account email associated with the trigger. The
+     * service account represents the identity of the trigger.
+     * The principal who calls this API must have `iam.serviceAccounts.actAs`
+     * permission in the service account. See
+     * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+     * for more information.
+     * For Cloud Run destinations, this service account is used to generate
+     * identity tokens when invoking the service. See
+     * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+     * for information on how to invoke authenticated Cloud Run services.
+     * In order to create Audit Log triggers, the service account should also
+     * have `roles/eventarc.eventReceiver` IAM role.
+     * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The serviceAccount. + */ + public java.lang.String getServiceAccount() { + java.lang.Object ref = serviceAccount_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceAccount_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The IAM service account email associated with the trigger. The
+     * service account represents the identity of the trigger.
+     * The principal who calls this API must have `iam.serviceAccounts.actAs`
+     * permission in the service account. See
+     * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+     * for more information.
+     * For Cloud Run destinations, this service account is used to generate
+     * identity tokens when invoking the service. See
+     * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+     * for information on how to invoke authenticated Cloud Run services.
+     * In order to create Audit Log triggers, the service account should also
+     * have `roles/eventarc.eventReceiver` IAM role.
+     * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for serviceAccount. + */ + public com.google.protobuf.ByteString getServiceAccountBytes() { + java.lang.Object ref = serviceAccount_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The IAM service account email associated with the trigger. The
+     * service account represents the identity of the trigger.
+     * The principal who calls this API must have `iam.serviceAccounts.actAs`
+     * permission in the service account. See
+     * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+     * for more information.
+     * For Cloud Run destinations, this service account is used to generate
+     * identity tokens when invoking the service. See
+     * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+     * for information on how to invoke authenticated Cloud Run services.
+     * In order to create Audit Log triggers, the service account should also
+     * have `roles/eventarc.eventReceiver` IAM role.
+     * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @param value The serviceAccount to set. + * @return This builder for chaining. + */ + public Builder setServiceAccount(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceAccount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The IAM service account email associated with the trigger. The
+     * service account represents the identity of the trigger.
+     * The principal who calls this API must have `iam.serviceAccounts.actAs`
+     * permission in the service account. See
+     * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+     * for more information.
+     * For Cloud Run destinations, this service account is used to generate
+     * identity tokens when invoking the service. See
+     * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+     * for information on how to invoke authenticated Cloud Run services.
+     * In order to create Audit Log triggers, the service account should also
+     * have `roles/eventarc.eventReceiver` IAM role.
+     * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearServiceAccount() { + + serviceAccount_ = getDefaultInstance().getServiceAccount(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The IAM service account email associated with the trigger. The
+     * service account represents the identity of the trigger.
+     * The principal who calls this API must have `iam.serviceAccounts.actAs`
+     * permission in the service account. See
+     * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+     * for more information.
+     * For Cloud Run destinations, this service account is used to generate
+     * identity tokens when invoking the service. See
+     * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+     * for information on how to invoke authenticated Cloud Run services.
+     * In order to create Audit Log triggers, the service account should also
+     * have `roles/eventarc.eventReceiver` IAM role.
+     * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for serviceAccount to set. + * @return This builder for chaining. + */ + public Builder setServiceAccountBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceAccount_ = value; + onChanged(); + return this; + } + + private com.google.cloud.eventarc.v1.Destination destination_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Destination, + com.google.cloud.eventarc.v1.Destination.Builder, + com.google.cloud.eventarc.v1.DestinationOrBuilder> + destinationBuilder_; + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the destination field is set. + */ + public boolean hasDestination() { + return destinationBuilder_ != null || destination_ != null; + } + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The destination. + */ + public com.google.cloud.eventarc.v1.Destination getDestination() { + if (destinationBuilder_ == null) { + return destination_ == null + ? com.google.cloud.eventarc.v1.Destination.getDefaultInstance() + : destination_; + } else { + return destinationBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setDestination(com.google.cloud.eventarc.v1.Destination value) { + if (destinationBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + destination_ = value; + onChanged(); + } else { + destinationBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setDestination( + com.google.cloud.eventarc.v1.Destination.Builder builderForValue) { + if (destinationBuilder_ == null) { + destination_ = builderForValue.build(); + onChanged(); + } else { + destinationBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeDestination(com.google.cloud.eventarc.v1.Destination value) { + if (destinationBuilder_ == null) { + if (destination_ != null) { + destination_ = + com.google.cloud.eventarc.v1.Destination.newBuilder(destination_) + .mergeFrom(value) + .buildPartial(); + } else { + destination_ = value; + } + onChanged(); + } else { + destinationBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearDestination() { + if (destinationBuilder_ == null) { + destination_ = null; + onChanged(); + } else { + destination_ = null; + destinationBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.Destination.Builder getDestinationBuilder() { + + onChanged(); + return getDestinationFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.eventarc.v1.DestinationOrBuilder getDestinationOrBuilder() { + if (destinationBuilder_ != null) { + return destinationBuilder_.getMessageOrBuilder(); + } else { + return destination_ == null + ? com.google.cloud.eventarc.v1.Destination.getDefaultInstance() + : destination_; + } + } + /** + * + * + *
+     * Required. Destination specifies where the events should be sent to.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Destination, + com.google.cloud.eventarc.v1.Destination.Builder, + com.google.cloud.eventarc.v1.DestinationOrBuilder> + getDestinationFieldBuilder() { + if (destinationBuilder_ == null) { + destinationBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Destination, + com.google.cloud.eventarc.v1.Destination.Builder, + com.google.cloud.eventarc.v1.DestinationOrBuilder>( + getDestination(), getParentForChildren(), isClean()); + destination_ = null; + } + return destinationBuilder_; + } + + private com.google.cloud.eventarc.v1.Transport transport_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Transport, + com.google.cloud.eventarc.v1.Transport.Builder, + com.google.cloud.eventarc.v1.TransportOrBuilder> + transportBuilder_; + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the transport field is set. + */ + public boolean hasTransport() { + return transportBuilder_ != null || transport_ != null; + } + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The transport. + */ + public com.google.cloud.eventarc.v1.Transport getTransport() { + if (transportBuilder_ == null) { + return transport_ == null + ? com.google.cloud.eventarc.v1.Transport.getDefaultInstance() + : transport_; + } else { + return transportBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setTransport(com.google.cloud.eventarc.v1.Transport value) { + if (transportBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + transport_ = value; + onChanged(); + } else { + transportBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setTransport(com.google.cloud.eventarc.v1.Transport.Builder builderForValue) { + if (transportBuilder_ == null) { + transport_ = builderForValue.build(); + onChanged(); + } else { + transportBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeTransport(com.google.cloud.eventarc.v1.Transport value) { + if (transportBuilder_ == null) { + if (transport_ != null) { + transport_ = + com.google.cloud.eventarc.v1.Transport.newBuilder(transport_) + .mergeFrom(value) + .buildPartial(); + } else { + transport_ = value; + } + onChanged(); + } else { + transportBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearTransport() { + if (transportBuilder_ == null) { + transport_ = null; + onChanged(); + } else { + transport_ = null; + transportBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.eventarc.v1.Transport.Builder getTransportBuilder() { + + onChanged(); + return getTransportFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.eventarc.v1.TransportOrBuilder getTransportOrBuilder() { + if (transportBuilder_ != null) { + return transportBuilder_.getMessageOrBuilder(); + } else { + return transport_ == null + ? com.google.cloud.eventarc.v1.Transport.getDefaultInstance() + : transport_; + } + } + /** + * + * + *
+     * Optional. In order to deliver messages, Eventarc may use other GCP
+     * products as transport intermediary. This field contains a reference to that
+     * transport intermediary. This information can be used for debugging
+     * purposes.
+     * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Transport, + com.google.cloud.eventarc.v1.Transport.Builder, + com.google.cloud.eventarc.v1.TransportOrBuilder> + getTransportFieldBuilder() { + if (transportBuilder_ == null) { + transportBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Transport, + com.google.cloud.eventarc.v1.Transport.Builder, + com.google.cloud.eventarc.v1.TransportOrBuilder>( + getTransport(), getParentForChildren(), isClean()); + transport_ = null; + } + return transportBuilder_; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + onChanged(); + ; + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * Optional. User labels attached to the triggers that can be used to group
+     * resources.
+     * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * Optional. User labels attached to the triggers that can be used to group
+     * resources.
+     * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * Optional. User labels attached to the triggers that can be used to group
+     * resources.
+     * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrDefault( + java.lang.String key, java.lang.String defaultValue) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional. User labels attached to the triggers that can be used to group
+     * resources.
+     * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Optional. User labels attached to the triggers that can be used to group
+     * resources.
+     * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * Optional. User labels attached to the triggers that can be used to group
+     * resources.
+     * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new java.lang.NullPointerException(); + } + if (value == null) { + throw new java.lang.NullPointerException(); + } + internalGetMutableLabels().getMutableMap().put(key, value); + return this; + } + /** + * + * + *
+     * Optional. User labels attached to the triggers that can be used to group
+     * resources.
+     * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + return this; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields, and may be sent only on create requests to ensure the client
+     * has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields, and may be sent only on create requests to ensure the client
+     * has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields, and may be sent only on create requests to ensure the client
+     * has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields, and may be sent only on create requests to ensure the client
+     * has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. This checksum is computed by the server based on the value of
+     * other fields, and may be sent only on create requests to ensure the client
+     * has an up-to-date value before proceeding.
+     * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The bytes for etag to set. + * @return This builder for chaining. + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.eventarc.v1.Trigger) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.Trigger) + private static final com.google.cloud.eventarc.v1.Trigger DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.Trigger(); + } + + public static com.google.cloud.eventarc.v1.Trigger getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Trigger parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Trigger(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.eventarc.v1.Trigger getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerName.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerName.java new file mode 100644 index 00000000..d175fe45 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerName.java @@ -0,0 +1,223 @@ +/* + * 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.eventarc.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 TriggerName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_TRIGGER = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/triggers/{trigger}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String trigger; + + @Deprecated + protected TriggerName() { + project = null; + location = null; + trigger = null; + } + + private TriggerName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + trigger = Preconditions.checkNotNull(builder.getTrigger()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getTrigger() { + return trigger; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static TriggerName of(String project, String location, String trigger) { + return newBuilder().setProject(project).setLocation(location).setTrigger(trigger).build(); + } + + public static String format(String project, String location, String trigger) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setTrigger(trigger) + .build() + .toString(); + } + + public static TriggerName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_TRIGGER.validatedMatch( + formattedString, "TriggerName.parse: formattedString not in valid format"); + return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("trigger")); + } + + 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 (TriggerName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_TRIGGER.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (trigger != null) { + fieldMapBuilder.put("trigger", trigger); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_TRIGGER.instantiate( + "project", project, "location", location, "trigger", trigger); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null || getClass() == o.getClass()) { + TriggerName that = ((TriggerName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.trigger, that.trigger); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(trigger); + return h; + } + + /** Builder for projects/{project}/locations/{location}/triggers/{trigger}. */ + public static class Builder { + private String project; + private String location; + private String trigger; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getTrigger() { + return trigger; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setTrigger(String trigger) { + this.trigger = trigger; + return this; + } + + private Builder(TriggerName triggerName) { + project = triggerName.project; + location = triggerName.location; + trigger = triggerName.trigger; + } + + public TriggerName build() { + return new TriggerName(this); + } + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerOrBuilder.java new file mode 100644 index 00000000..3328aa6b --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerOrBuilder.java @@ -0,0 +1,456 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +public interface TriggerOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.Trigger) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the trigger. Must be unique within the
+   * location on the project and must be in
+   * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the trigger. Must be unique within the
+   * location on the project and must be in
+   * `projects/{project}/locations/{location}/triggers/{trigger}` format.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. Server assigned unique identifier for the trigger. The value
+   * is a UUID4 string and guaranteed to remain unchanged until the resource is
+   * deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. Server assigned unique identifier for the trigger. The value
+   * is a UUID4 string and guaranteed to remain unchanged until the resource is
+   * deleted.
+   * 
+ * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. The creation time.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * Output only. The last-modified time.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List getEventFiltersList(); + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.eventarc.v1.EventFilter getEventFilters(int index); + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + int getEventFiltersCount(); + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List + getEventFiltersOrBuilderList(); + /** + * + * + *
+   * Required. null The list of filters that applies to event attributes. Only
+   * events that match all the provided filters will be sent to the destination.
+   * 
+ * + * + * repeated .google.cloud.eventarc.v1.EventFilter event_filters = 8 [(.google.api.field_behavior) = UNORDERED_LIST, (.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.eventarc.v1.EventFilterOrBuilder getEventFiltersOrBuilder(int index); + + /** + * + * + *
+   * Optional. The IAM service account email associated with the trigger. The
+   * service account represents the identity of the trigger.
+   * The principal who calls this API must have `iam.serviceAccounts.actAs`
+   * permission in the service account. See
+   * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+   * for more information.
+   * For Cloud Run destinations, this service account is used to generate
+   * identity tokens when invoking the service. See
+   * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+   * for information on how to invoke authenticated Cloud Run services.
+   * In order to create Audit Log triggers, the service account should also
+   * have `roles/eventarc.eventReceiver` IAM role.
+   * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The serviceAccount. + */ + java.lang.String getServiceAccount(); + /** + * + * + *
+   * Optional. The IAM service account email associated with the trigger. The
+   * service account represents the identity of the trigger.
+   * The principal who calls this API must have `iam.serviceAccounts.actAs`
+   * permission in the service account. See
+   * https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common
+   * for more information.
+   * For Cloud Run destinations, this service account is used to generate
+   * identity tokens when invoking the service. See
+   * https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account
+   * for information on how to invoke authenticated Cloud Run services.
+   * In order to create Audit Log triggers, the service account should also
+   * have `roles/eventarc.eventReceiver` IAM role.
+   * 
+ * + * + * string service_account = 9 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for serviceAccount. + */ + com.google.protobuf.ByteString getServiceAccountBytes(); + + /** + * + * + *
+   * Required. Destination specifies where the events should be sent to.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the destination field is set. + */ + boolean hasDestination(); + /** + * + * + *
+   * Required. Destination specifies where the events should be sent to.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The destination. + */ + com.google.cloud.eventarc.v1.Destination getDestination(); + /** + * + * + *
+   * Required. Destination specifies where the events should be sent to.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Destination destination = 10 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.eventarc.v1.DestinationOrBuilder getDestinationOrBuilder(); + + /** + * + * + *
+   * Optional. In order to deliver messages, Eventarc may use other GCP
+   * products as transport intermediary. This field contains a reference to that
+   * transport intermediary. This information can be used for debugging
+   * purposes.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the transport field is set. + */ + boolean hasTransport(); + /** + * + * + *
+   * Optional. In order to deliver messages, Eventarc may use other GCP
+   * products as transport intermediary. This field contains a reference to that
+   * transport intermediary. This information can be used for debugging
+   * purposes.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The transport. + */ + com.google.cloud.eventarc.v1.Transport getTransport(); + /** + * + * + *
+   * Optional. In order to deliver messages, Eventarc may use other GCP
+   * products as transport intermediary. This field contains a reference to that
+   * transport intermediary. This information can be used for debugging
+   * purposes.
+   * 
+ * + * + * .google.cloud.eventarc.v1.Transport transport = 11 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.eventarc.v1.TransportOrBuilder getTransportOrBuilder(); + + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getLabelsCount(); + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrDefault(java.lang.String key, java.lang.String defaultValue); + /** + * + * + *
+   * Optional. User labels attached to the triggers that can be used to group
+   * resources.
+   * 
+ * + * map<string, string> labels = 12 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields, and may be sent only on create requests to ensure the client
+   * has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The etag. + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Output only. This checksum is computed by the server based on the value of
+   * other fields, and may be sent only on create requests to ensure the client
+   * has an up-to-date value before proceeding.
+   * 
+ * + * string etag = 99 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The bytes for etag. + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerProto.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerProto.java new file mode 100644 index 00000000..8604f590 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/TriggerProto.java @@ -0,0 +1,198 @@ +/* + * 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/eventarc/v1/trigger.proto + +package com.google.cloud.eventarc.v1; + +public final class TriggerProto { + private TriggerProto() {} + + 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_eventarc_v1_Trigger_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_Trigger_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_Trigger_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_Trigger_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_EventFilter_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_EventFilter_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_Destination_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_Destination_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_Transport_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_Transport_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_CloudRun_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_CloudRun_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_eventarc_v1_Pubsub_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_eventarc_v1_Pubsub_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/eventarc/v1/trigger.proto" + + "\022\030google.cloud.eventarc.v1\032\034google/api/a" + + "nnotations.proto\032\037google/api/field_behav" + + "ior.proto\032\031google/api/resource.proto\032\037go" + + "ogle/protobuf/timestamp.proto\"\235\005\n\007Trigge" + + "r\022\021\n\004name\030\001 \001(\tB\003\340A\002\022\020\n\003uid\030\002 \001(\tB\003\340A\003\0224" + + "\n\013create_time\030\005 \001(\0132\032.google.protobuf.Ti" + + "mestampB\003\340A\003\0224\n\013update_time\030\006 \001(\0132\032.goog" + + "le.protobuf.TimestampB\003\340A\003\022D\n\revent_filt" + + "ers\030\010 \003(\0132%.google.cloud.eventarc.v1.Eve" + + "ntFilterB\006\340A\006\340A\002\022B\n\017service_account\030\t \001(" + + "\tB)\340A\001\372A#\n!iam.googleapis.com/ServiceAcc" + + "ount\022?\n\013destination\030\n \001(\0132%.google.cloud" + + ".eventarc.v1.DestinationB\003\340A\002\022;\n\ttranspo" + + "rt\030\013 \001(\0132#.google.cloud.eventarc.v1.Tran" + + "sportB\003\340A\001\022B\n\006labels\030\014 \003(\0132-.google.clou" + + "d.eventarc.v1.Trigger.LabelsEntryB\003\340A\001\022\021" + + "\n\004etag\030c \001(\tB\003\340A\003\032-\n\013LabelsEntry\022\013\n\003key\030" + + "\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001:s\352Ap\n\037eventarc." + + "googleapis.com/Trigger\022:projects/{projec" + + "t}/locations/{location}/triggers/{trigge" + + "r}*\010triggers2\007trigger\"9\n\013EventFilter\022\026\n\t" + + "attribute\030\001 \001(\tB\003\340A\002\022\022\n\005value\030\002 \001(\tB\003\340A\002" + + "\"T\n\013Destination\0227\n\tcloud_run\030\001 \001(\0132\".goo" + + "gle.cloud.eventarc.v1.CloudRunH\000B\014\n\ndesc" + + "riptor\"O\n\tTransport\0222\n\006pubsub\030\001 \001(\0132 .go" + + "ogle.cloud.eventarc.v1.PubsubH\000B\016\n\014inter" + + "mediary\"g\n\010CloudRun\0223\n\007service\030\001 \001(\tB\"\340A" + + "\002\372A\034\n\032run.googleapis.com/Service\022\021\n\004path" + + "\030\002 \001(\tB\003\340A\001\022\023\n\006region\030\003 \001(\tB\003\340A\002\"7\n\006Pubs" + + "ub\022\022\n\005topic\030\001 \001(\tB\003\340A\001\022\031\n\014subscription\030\002" + + " \001(\tB\003\340A\003B\334\002\n\034com.google.cloud.eventarc." + + "v1B\014TriggerProtoP\001Z@google.golang.org/ge" + + "nproto/googleapis/cloud/eventarc/v1;even" + + "tarc\352Ak\n+cloudfunctions.googleapis.com/C" + + "loudFunction\022 + * The request message for the UpdateTrigger method. + * + * + * Protobuf type {@code google.cloud.eventarc.v1.UpdateTriggerRequest} + */ +public final class UpdateTriggerRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.eventarc.v1.UpdateTriggerRequest) + UpdateTriggerRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateTriggerRequest.newBuilder() to construct. + private UpdateTriggerRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateTriggerRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateTriggerRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateTriggerRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.eventarc.v1.Trigger.Builder subBuilder = null; + if (trigger_ != null) { + subBuilder = trigger_.toBuilder(); + } + trigger_ = + input.readMessage( + com.google.cloud.eventarc.v1.Trigger.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(trigger_); + trigger_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + case 24: + { + allowMissing_ = input.readBool(); + break; + } + case 32: + { + validateOnly_ = input.readBool(); + 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.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.UpdateTriggerRequest.class, + com.google.cloud.eventarc.v1.UpdateTriggerRequest.Builder.class); + } + + public static final int TRIGGER_FIELD_NUMBER = 1; + private com.google.cloud.eventarc.v1.Trigger trigger_; + /** + * + * + *
+   * The trigger to be updated.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + * + * @return Whether the trigger field is set. + */ + @java.lang.Override + public boolean hasTrigger() { + return trigger_ != null; + } + /** + * + * + *
+   * The trigger to be updated.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + * + * @return The trigger. + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.Trigger getTrigger() { + return trigger_ == null ? com.google.cloud.eventarc.v1.Trigger.getDefaultInstance() : trigger_; + } + /** + * + * + *
+   * The trigger to be updated.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + @java.lang.Override + public com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggerOrBuilder() { + return getTrigger(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * The fields to be updated; only fields explicitly provided will be updated.
+   * If no field mask is provided, all provided fields in the request will be
+   * updated. To update all fields, provide a field mask of "*".
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * The fields to be updated; only fields explicitly provided will be updated.
+   * If no field mask is provided, all provided fields in the request will be
+   * updated. To update all fields, provide a field mask of "*".
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * The fields to be updated; only fields explicitly provided will be updated.
+   * If no field mask is provided, all provided fields in the request will be
+   * updated. To update all fields, provide a field mask of "*".
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + public static final int ALLOW_MISSING_FIELD_NUMBER = 3; + private boolean allowMissing_; + /** + * + * + *
+   * If set to true, and the trigger is not found, a new trigger will be
+   * created. In this situation, `update_mask` is ignored.
+   * 
+ * + * bool allow_missing = 3; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + + public static final int VALIDATE_ONLY_FIELD_NUMBER = 4; + private boolean validateOnly_; + /** + * + * + *
+   * Required. If set, validate the request and preview the review, but do not actually
+   * post it.
+   * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + + 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 (trigger_ != null) { + output.writeMessage(1, getTrigger()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + if (allowMissing_ != false) { + output.writeBool(3, allowMissing_); + } + if (validateOnly_ != false) { + output.writeBool(4, validateOnly_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (trigger_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getTrigger()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + if (allowMissing_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(3, allowMissing_); + } + if (validateOnly_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, validateOnly_); + } + 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.eventarc.v1.UpdateTriggerRequest)) { + return super.equals(obj); + } + com.google.cloud.eventarc.v1.UpdateTriggerRequest other = + (com.google.cloud.eventarc.v1.UpdateTriggerRequest) obj; + + if (hasTrigger() != other.hasTrigger()) return false; + if (hasTrigger()) { + if (!getTrigger().equals(other.getTrigger())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (getAllowMissing() != other.getAllowMissing()) return false; + if (getValidateOnly() != other.getValidateOnly()) 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 (hasTrigger()) { + hash = (37 * hash) + TRIGGER_FIELD_NUMBER; + hash = (53 * hash) + getTrigger().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (37 * hash) + ALLOW_MISSING_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getAllowMissing()); + hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest 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.eventarc.v1.UpdateTriggerRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest 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.eventarc.v1.UpdateTriggerRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest 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.eventarc.v1.UpdateTriggerRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest 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.eventarc.v1.UpdateTriggerRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest 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.eventarc.v1.UpdateTriggerRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The request message for the UpdateTrigger method.
+   * 
+ * + * Protobuf type {@code google.cloud.eventarc.v1.UpdateTriggerRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.eventarc.v1.UpdateTriggerRequest) + com.google.cloud.eventarc.v1.UpdateTriggerRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.eventarc.v1.UpdateTriggerRequest.class, + com.google.cloud.eventarc.v1.UpdateTriggerRequest.Builder.class); + } + + // Construct using com.google.cloud.eventarc.v1.UpdateTriggerRequest.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 (triggerBuilder_ == null) { + trigger_ = null; + } else { + trigger_ = null; + triggerBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + allowMissing_ = false; + + validateOnly_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.eventarc.v1.EventarcProto + .internal_static_google_cloud_eventarc_v1_UpdateTriggerRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.UpdateTriggerRequest getDefaultInstanceForType() { + return com.google.cloud.eventarc.v1.UpdateTriggerRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.UpdateTriggerRequest build() { + com.google.cloud.eventarc.v1.UpdateTriggerRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.eventarc.v1.UpdateTriggerRequest buildPartial() { + com.google.cloud.eventarc.v1.UpdateTriggerRequest result = + new com.google.cloud.eventarc.v1.UpdateTriggerRequest(this); + if (triggerBuilder_ == null) { + result.trigger_ = trigger_; + } else { + result.trigger_ = triggerBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + result.allowMissing_ = allowMissing_; + result.validateOnly_ = validateOnly_; + 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.eventarc.v1.UpdateTriggerRequest) { + return mergeFrom((com.google.cloud.eventarc.v1.UpdateTriggerRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.eventarc.v1.UpdateTriggerRequest other) { + if (other == com.google.cloud.eventarc.v1.UpdateTriggerRequest.getDefaultInstance()) + return this; + if (other.hasTrigger()) { + mergeTrigger(other.getTrigger()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + if (other.getAllowMissing() != false) { + setAllowMissing(other.getAllowMissing()); + } + if (other.getValidateOnly() != false) { + setValidateOnly(other.getValidateOnly()); + } + 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.eventarc.v1.UpdateTriggerRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.eventarc.v1.UpdateTriggerRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.eventarc.v1.Trigger trigger_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder> + triggerBuilder_; + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + * + * @return Whether the trigger field is set. + */ + public boolean hasTrigger() { + return triggerBuilder_ != null || trigger_ != null; + } + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + * + * @return The trigger. + */ + public com.google.cloud.eventarc.v1.Trigger getTrigger() { + if (triggerBuilder_ == null) { + return trigger_ == null + ? com.google.cloud.eventarc.v1.Trigger.getDefaultInstance() + : trigger_; + } else { + return triggerBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + public Builder setTrigger(com.google.cloud.eventarc.v1.Trigger value) { + if (triggerBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + trigger_ = value; + onChanged(); + } else { + triggerBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + public Builder setTrigger(com.google.cloud.eventarc.v1.Trigger.Builder builderForValue) { + if (triggerBuilder_ == null) { + trigger_ = builderForValue.build(); + onChanged(); + } else { + triggerBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + public Builder mergeTrigger(com.google.cloud.eventarc.v1.Trigger value) { + if (triggerBuilder_ == null) { + if (trigger_ != null) { + trigger_ = + com.google.cloud.eventarc.v1.Trigger.newBuilder(trigger_) + .mergeFrom(value) + .buildPartial(); + } else { + trigger_ = value; + } + onChanged(); + } else { + triggerBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + public Builder clearTrigger() { + if (triggerBuilder_ == null) { + trigger_ = null; + onChanged(); + } else { + trigger_ = null; + triggerBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + public com.google.cloud.eventarc.v1.Trigger.Builder getTriggerBuilder() { + + onChanged(); + return getTriggerFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + public com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggerOrBuilder() { + if (triggerBuilder_ != null) { + return triggerBuilder_.getMessageOrBuilder(); + } else { + return trigger_ == null + ? com.google.cloud.eventarc.v1.Trigger.getDefaultInstance() + : trigger_; + } + } + /** + * + * + *
+     * The trigger to be updated.
+     * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder> + getTriggerFieldBuilder() { + if (triggerBuilder_ == null) { + triggerBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.eventarc.v1.Trigger, + com.google.cloud.eventarc.v1.Trigger.Builder, + com.google.cloud.eventarc.v1.TriggerOrBuilder>( + getTrigger(), getParentForChildren(), isClean()); + trigger_ = null; + } + return triggerBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * The fields to be updated; only fields explicitly provided will be updated.
+     * If no field mask is provided, all provided fields in the request will be
+     * updated. To update all fields, provide a field mask of "*".
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + private boolean allowMissing_; + /** + * + * + *
+     * If set to true, and the trigger is not found, a new trigger will be
+     * created. In this situation, `update_mask` is ignored.
+     * 
+ * + * bool allow_missing = 3; + * + * @return The allowMissing. + */ + @java.lang.Override + public boolean getAllowMissing() { + return allowMissing_; + } + /** + * + * + *
+     * If set to true, and the trigger is not found, a new trigger will be
+     * created. In this situation, `update_mask` is ignored.
+     * 
+ * + * bool allow_missing = 3; + * + * @param value The allowMissing to set. + * @return This builder for chaining. + */ + public Builder setAllowMissing(boolean value) { + + allowMissing_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If set to true, and the trigger is not found, a new trigger will be
+     * created. In this situation, `update_mask` is ignored.
+     * 
+ * + * bool allow_missing = 3; + * + * @return This builder for chaining. + */ + public Builder clearAllowMissing() { + + allowMissing_ = false; + onChanged(); + return this; + } + + private boolean validateOnly_; + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + @java.lang.Override + public boolean getValidateOnly() { + return validateOnly_; + } + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The validateOnly to set. + * @return This builder for chaining. + */ + public Builder setValidateOnly(boolean value) { + + validateOnly_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. If set, validate the request and preview the review, but do not actually
+     * post it.
+     * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearValidateOnly() { + + validateOnly_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.eventarc.v1.UpdateTriggerRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.eventarc.v1.UpdateTriggerRequest) + private static final com.google.cloud.eventarc.v1.UpdateTriggerRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.eventarc.v1.UpdateTriggerRequest(); + } + + public static com.google.cloud.eventarc.v1.UpdateTriggerRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateTriggerRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateTriggerRequest(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.eventarc.v1.UpdateTriggerRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/UpdateTriggerRequestOrBuilder.java b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/UpdateTriggerRequestOrBuilder.java new file mode 100644 index 00000000..93a69394 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/java/com/google/cloud/eventarc/v1/UpdateTriggerRequestOrBuilder.java @@ -0,0 +1,129 @@ +/* + * 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/eventarc/v1/eventarc.proto + +package com.google.cloud.eventarc.v1; + +public interface UpdateTriggerRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.eventarc.v1.UpdateTriggerRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The trigger to be updated.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + * + * @return Whether the trigger field is set. + */ + boolean hasTrigger(); + /** + * + * + *
+   * The trigger to be updated.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + * + * @return The trigger. + */ + com.google.cloud.eventarc.v1.Trigger getTrigger(); + /** + * + * + *
+   * The trigger to be updated.
+   * 
+ * + * .google.cloud.eventarc.v1.Trigger trigger = 1; + */ + com.google.cloud.eventarc.v1.TriggerOrBuilder getTriggerOrBuilder(); + + /** + * + * + *
+   * The fields to be updated; only fields explicitly provided will be updated.
+   * If no field mask is provided, all provided fields in the request will be
+   * updated. To update all fields, provide a field mask of "*".
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * The fields to be updated; only fields explicitly provided will be updated.
+   * If no field mask is provided, all provided fields in the request will be
+   * updated. To update all fields, provide a field mask of "*".
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * The fields to be updated; only fields explicitly provided will be updated.
+   * If no field mask is provided, all provided fields in the request will be
+   * updated. To update all fields, provide a field mask of "*".
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); + + /** + * + * + *
+   * If set to true, and the trigger is not found, a new trigger will be
+   * created. In this situation, `update_mask` is ignored.
+   * 
+ * + * bool allow_missing = 3; + * + * @return The allowMissing. + */ + boolean getAllowMissing(); + + /** + * + * + *
+   * Required. If set, validate the request and preview the review, but do not actually
+   * post it.
+   * 
+ * + * bool validate_only = 4 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The validateOnly. + */ + boolean getValidateOnly(); +} diff --git a/proto-google-cloud-eventarc-v1/src/main/proto/google/cloud/eventarc/v1/eventarc.proto b/proto-google-cloud-eventarc-v1/src/main/proto/google/cloud/eventarc/v1/eventarc.proto new file mode 100644 index 00000000..e91e265a --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/proto/google/cloud/eventarc/v1/eventarc.proto @@ -0,0 +1,237 @@ +// 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.eventarc.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/eventarc/v1/trigger.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; +option java_multiple_files = true; +option java_outer_classname = "EventarcProto"; +option java_package = "com.google.cloud.eventarc.v1"; +option csharp_namespace = "Google.Cloud.Eventarc.V1"; +option php_namespace = "Google\\Cloud\\Eventarc\\V1"; +option ruby_package = "Google::Cloud::Eventarc::V1"; + +// Eventarc allows users to subscribe to various events that are provided by +// Google Cloud services and forward them to supported destinations. +service Eventarc { + option (google.api.default_host) = "eventarc.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Get a single trigger. + rpc GetTrigger(GetTriggerRequest) returns (Trigger) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/triggers/*}" + }; + option (google.api.method_signature) = "name"; + } + + // List triggers. + rpc ListTriggers(ListTriggersRequest) returns (ListTriggersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/triggers" + }; + option (google.api.method_signature) = "parent"; + } + + // Create a new trigger in a particular project and location. + rpc CreateTrigger(CreateTriggerRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/triggers" + body: "trigger" + }; + option (google.api.method_signature) = "parent,trigger,trigger_id"; + option (google.longrunning.operation_info) = { + response_type: "Trigger" + metadata_type: "OperationMetadata" + }; + } + + // Update a single trigger. + rpc UpdateTrigger(UpdateTriggerRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{trigger.name=projects/*/locations/*/triggers/*}" + body: "trigger" + }; + option (google.api.method_signature) = "trigger,update_mask,allow_missing"; + option (google.longrunning.operation_info) = { + response_type: "Trigger" + metadata_type: "OperationMetadata" + }; + } + + // Delete a single trigger. + rpc DeleteTrigger(DeleteTriggerRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/triggers/*}" + }; + option (google.api.method_signature) = "name,allow_missing"; + option (google.longrunning.operation_info) = { + response_type: "Trigger" + metadata_type: "OperationMetadata" + }; + } +} + +// The request message for the GetTrigger method. +message GetTriggerRequest { + // Required. The name of the trigger to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; +} + +// The request message for the ListTriggers method. +message ListTriggersRequest { + // Required. The parent collection to list triggers on. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/Trigger" + } + ]; + + // The maximum number of triggers to return on each page. + // Note: The service may send fewer. + int32 page_size = 2; + + // The page token; provide the value from the `next_page_token` field in a + // previous `ListTriggers` call to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListTriggers` must match + // the call that provided the page token. + string page_token = 3; + + // The sorting order of the resources returned. Value should be a comma + // separated list of fields. The default sorting oder is ascending. To specify + // descending order for a field, append a ` desc` suffix; for example: + // `name desc, trigger_id`. + string order_by = 4; +} + +// The response message for the ListTriggers method. +message ListTriggersResponse { + // The requested triggers, up to the number specified in `page_size`. + repeated Trigger triggers = 1; + + // A page token that can be sent to ListTriggers to request the next page. + // If this is empty, then there are no more pages. + string next_page_token = 2; + + // Unreachable resources, if any. + repeated string unreachable = 3; +} + +// The request message for the CreateTrigger method. +message CreateTriggerRequest { + // Required. The parent collection in which to add this trigger. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "eventarc.googleapis.com/Trigger" + } + ]; + + // Required. The trigger to create. + Trigger trigger = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The user-provided ID to be assigned to the trigger. + string trigger_id = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. If set, validate the request and preview the review, but do not actually + // post it. + bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the UpdateTrigger method. +message UpdateTriggerRequest { + // The trigger to be updated. + Trigger trigger = 1; + + // The fields to be updated; only fields explicitly provided will be updated. + // If no field mask is provided, all provided fields in the request will be + // updated. To update all fields, provide a field mask of "*". + google.protobuf.FieldMask update_mask = 2; + + // If set to true, and the trigger is not found, a new trigger will be + // created. In this situation, `update_mask` is ignored. + bool allow_missing = 3; + + // Required. If set, validate the request and preview the review, but do not actually + // post it. + bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// The request message for the DeleteTrigger method. +message DeleteTriggerRequest { + // Required. The name of the trigger to be deleted. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "eventarc.googleapis.com/Trigger" + } + ]; + + // If provided, the trigger will only be deleted if the etag matches the + // current etag on the resource. + string etag = 2; + + // If set to true, and the trigger is not found, the request will succeed + // but no action will be taken on the server. + bool allow_missing = 3; + + // Required. If set, validate the request and preview the review, but do not actually + // post it. + bool validate_only = 4 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/proto-google-cloud-eventarc-v1/src/main/proto/google/cloud/eventarc/v1/trigger.proto b/proto-google-cloud-eventarc-v1/src/main/proto/google/cloud/eventarc/v1/trigger.proto new file mode 100644 index 00000000..6ec85a72 --- /dev/null +++ b/proto-google-cloud-eventarc-v1/src/main/proto/google/cloud/eventarc/v1/trigger.proto @@ -0,0 +1,184 @@ +// 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.eventarc.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/eventarc/v1;eventarc"; +option java_multiple_files = true; +option java_outer_classname = "TriggerProto"; +option java_package = "com.google.cloud.eventarc.v1"; +option (google.api.resource_definition) = { + type: "cloudfunctions.googleapis.com/CloudFunction" + pattern: "projects/{project}/locations/{location}/functions/{function}" +}; +option (google.api.resource_definition) = { + type: "iam.googleapis.com/ServiceAccount" + pattern: "projects/{project}/serviceAccounts/{service_account}" +}; +option (google.api.resource_definition) = { + type: "run.googleapis.com/Service" + pattern: "*" +}; + +// A representation of the trigger resource. +message Trigger { + option (google.api.resource) = { + type: "eventarc.googleapis.com/Trigger" + pattern: "projects/{project}/locations/{location}/triggers/{trigger}" + plural: "triggers" + singular: "trigger" + }; + + // Required. The resource name of the trigger. Must be unique within the + // location on the project and must be in + // `projects/{project}/locations/{location}/triggers/{trigger}` format. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Server assigned unique identifier for the trigger. The value + // is a UUID4 string and guaranteed to remain unchanged until the resource is + // deleted. + string uid = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time. + google.protobuf.Timestamp create_time = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last-modified time. + google.protobuf.Timestamp update_time = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. null The list of filters that applies to event attributes. Only + // events that match all the provided filters will be sent to the destination. + repeated EventFilter event_filters = 8 [ + (google.api.field_behavior) = UNORDERED_LIST, + (google.api.field_behavior) = REQUIRED + ]; + + // Optional. The IAM service account email associated with the trigger. The + // service account represents the identity of the trigger. + // + // The principal who calls this API must have `iam.serviceAccounts.actAs` + // permission in the service account. See + // https://cloud.google.com/iam/docs/understanding-service-accounts?hl=en#sa_common + // for more information. + // + // For Cloud Run destinations, this service account is used to generate + // identity tokens when invoking the service. See + // https://cloud.google.com/run/docs/triggering/pubsub-push#create-service-account + // for information on how to invoke authenticated Cloud Run services. + // In order to create Audit Log triggers, the service account should also + // have `roles/eventarc.eventReceiver` IAM role. + string service_account = 9 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { + type: "iam.googleapis.com/ServiceAccount" + } + ]; + + // Required. Destination specifies where the events should be sent to. + Destination destination = 10 [(google.api.field_behavior) = REQUIRED]; + + // Optional. In order to deliver messages, Eventarc may use other GCP + // products as transport intermediary. This field contains a reference to that + // transport intermediary. This information can be used for debugging + // purposes. + Transport transport = 11 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. User labels attached to the triggers that can be used to group + // resources. + map labels = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. This checksum is computed by the server based on the value of + // other fields, and may be sent only on create requests to ensure the client + // has an up-to-date value before proceeding. + string etag = 99 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Filters events based on exact matches on the CloudEvents attributes. +message EventFilter { + // Required. The name of a CloudEvents attribute. Currently, only a subset of + // attributes are supported for filtering. + // + // All triggers MUST provide a filter for the 'type' attribute. + string attribute = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value for the attribute. + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents a target of an invocation over HTTP. +message Destination { + oneof descriptor { + // Cloud Run fully-managed service that receives the events. The service + // should be running in the same project of the trigger. + CloudRun cloud_run = 1; + } +} + +// Represents the transport intermediaries created for the trigger in order to +// deliver events. +message Transport { + oneof intermediary { + // The Pub/Sub topic and subscription used by Eventarc as delivery + // intermediary. + Pubsub pubsub = 1; + } +} + +// Represents a Cloud Run destination. +message CloudRun { + // Required. The name of the Cloud Run service being addressed. See + // https://cloud.google.com/run/docs/reference/rest/v1/namespaces.services. + // + // Only services located in the same project of the trigger object + // can be addressed. + string service = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "run.googleapis.com/Service" } + ]; + + // Optional. The relative path on the Cloud Run service the events should be + // sent to. + // + // The value must conform to the definition of URI path segment (section 3.3 + // of RFC2396). Examples: "/route", "route", "route/subroute". + string path = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The region the Cloud Run service is deployed in. + string region = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Represents a Pub/Sub transport. +message Pubsub { + // Optional. The name of the Pub/Sub topic created and managed by Eventarc + // system as a transport for the event delivery. Format: + // `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`. + // + // You may set an existing topic for triggers of the type + // `google.cloud.pubsub.topic.v1.messagePublished` only. The topic you provide + // here will not be deleted by Eventarc at trigger deletion. + string topic = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. The name of the Pub/Sub subscription created and managed by + // Eventarc system as a transport for the event delivery. Format: + // `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`. + string subscription = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..c92a41db --- /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-eventarc", + "^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..16609304 --- /dev/null +++ b/samples/install-without-bom/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + com.google.cloud + eventarc-install-without-bom + jar + Google Eventarc Install Without Bom + https://github.com/googleapis/java-eventarc + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + + com.google.cloud + google-cloud-eventarc + 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..ed8f36e9 --- /dev/null +++ b/samples/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + com.google.cloud + google-cloud-eventarc-samples + 0.0.1-SNAPSHOT + pom + Google Eventarc Samples Parent + https://github.com/googleapis/java-eventarc + + 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..ab180ef7 --- /dev/null +++ b/samples/snapshot/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + com.google.cloud + eventarc-snapshot + jar + Google Eventarc Snapshot Samples + https://github.com/googleapis/java-eventarc + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-eventarc + 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..b769f6b9 --- /dev/null +++ b/samples/snippets/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + com.google.cloud + eventarc-snippets + jar + Google Eventarc Snippets + https://github.com/googleapis/java-eventarc + + + + com.google.cloud.samples + shared-configuration + 1.0.12 + + + + 1.8 + 1.8 + UTF-8 + + + + + + com.google.cloud + google-cloud-eventarc + 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..9752feb8 --- /dev/null +++ b/versions.txt @@ -0,0 +1,6 @@ +# Format: +# module:released-version:current-version + +google-cloud-eventarc:0.0.0:0.0.1-SNAPSHOT +grpc-google-cloud-eventarc-v1:0.0.0:0.0.1-SNAPSHOT +proto-google-cloud-eventarc-v1:0.0.0:0.0.1-SNAPSHOT