diff --git a/.github/workflows/approve-readme.yaml b/.github/workflows/approve-readme.yaml deleted file mode 100644 index f5fc7d51..00000000 --- a/.github/workflows/approve-readme.yaml +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: -name: auto-merge-readme -jobs: - approve: - runs-on: ubuntu-latest - if: github.repository_owner == 'googleapis' && github.head_ref == 'autosynth-readme' - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} - script: | - // only approve PRs from yoshi-automation - if (context.payload.pull_request.user.login !== "yoshi-automation") { - return; - } - - // only approve PRs like "chore: release " - if (!context.payload.pull_request.title === "chore: regenerate README") { - return; - } - - // only approve PRs with README.md and synth.metadata changes - const files = new Set( - ( - await github.paginate( - github.pulls.listFiles.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - }) - ) - ).map(file => file.filename) - ); - if (files.size != 2 || !files.has("README.md") || !files.has(".github/readme/synth.metadata/synth.metadata")) { - return; - } - - // approve README regeneration PR - await github.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Rubber stamped PR!', - pull_number: context.payload.pull_request.number, - event: 'APPROVE' - }); - - // attach automerge label - await github.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: ['automerge'] - }); diff --git a/.github/workflows/auto-release.yaml b/.github/workflows/auto-release.yaml deleted file mode 100644 index 7a106d00..00000000 --- a/.github/workflows/auto-release.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: -name: auto-release -jobs: - approve: - runs-on: ubuntu-latest - if: contains(github.head_ref, 'release-please') - steps: - - uses: actions/github-script@v6 - with: - github-token: ${{secrets.YOSHI_APPROVER_TOKEN}} - debug: true - script: | - // only approve PRs from release-please[bot] - if (context.payload.pull_request.user.login !== "release-please[bot]") { - return; - } - - // only approve PRs like "chore(main): release " - if ( !context.payload.pull_request.title.startsWith("chore(main): release") ) { - return; - } - - // only approve PRs with pom.xml and versions.txt changes - const filesPromise = github.rest.pulls.listFiles.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - }); - const changed_files = await github.paginate(filesPromise) - - if ( changed_files.length < 1 ) { - console.log( "Not proceeding since PR is empty!" ) - return; - } - - if ( !changed_files.some(v => v.filename.includes("pom")) || !changed_files.some(v => v.filename.includes("versions.txt")) ) { - console.log( "PR file changes do not have pom.xml or versions.txt -- something is wrong. PTAL!" ) - return; - } - - // trigger auto-release when - // 1) it is a SNAPSHOT release (auto-generated post regular release) - // 2) there are dependency updates only - // 3) there are no open dependency update PRs in this repo (to avoid multiple releases) - if ( - context.payload.pull_request.body.includes("Fix") || - context.payload.pull_request.body.includes("Build") || - context.payload.pull_request.body.includes("Documentation") || - context.payload.pull_request.body.includes("BREAKING CHANGES") || - context.payload.pull_request.body.includes("Features") - ) { - console.log( "Not auto-releasing since it is not a dependency-update-only release." ); - return; - } - - const promise = github.rest.pulls.list.endpoint({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open' - }); - const open_pulls = await github.paginate(promise) - - if ( open_pulls.length > 1 && !context.payload.pull_request.title.includes("SNAPSHOT") ) { - for ( const pull of open_pulls ) { - if ( pull.title.startsWith("deps: update dependency") ) { - console.log( "Not auto-releasing yet since there are dependency update PRs open in this repo." ); - return; - } - } - } - - // approve release PR - await github.rest.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - body: 'Rubber stamped release!', - pull_number: context.payload.pull_request.number, - event: 'APPROVE' - }); - - // attach kokoro:force-run and automerge labels - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: ['kokoro:force-run', 'automerge'] - }); diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e3bb26e3..2ae29898 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,77 +13,40 @@ # limitations under the License. # Github action job to test core java library features on # downstream client libraries before they are released. +name: ci + on: push: - branches: - - main - pull_request: -name: ci + tags: + - '[0-9]+.[0-9]+.[0-9]+' + jobs: - units: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - java: [8, 11, 17] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: test - windows: - runs-on: windows-latest - steps: - - name: Support longpaths - run: git config --system core.longpaths true - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 8 - - run: java -version - - run: .kokoro/build.bat - env: - JOB_TYPE: test - dependencies: - runs-on: ubuntu-latest - strategy: - matrix: - java: [8, 11, 17] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: ${{matrix.java}} - - run: java -version - - run: .kokoro/dependencies.sh - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 11 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: lint - clirr: + publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 8 - - run: java -version - - run: .kokoro/build.sh - env: - JOB_TYPE: clirr + - uses: actions/checkout@v2 + + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ secrets.GPG_SECRET_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + + - name: Show GPG keys + run: gpg --list-secret-keys --keyid-format LONG + + - name: Set up Maven Central Repository + uses: actions/setup-java@v2 + with: + java-version: '20' + distribution: 'adopt' + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + + - name: Publish package + run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Dgpg.keyname=0F48235998CCAAB1 deploy -DskipTests + working-directory: clearblade-cloud-iot + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_SECRET }} diff --git a/.github/workflows/samples.yaml b/.github/workflows/samples.yaml deleted file mode 100644 index 912ed8b2..00000000 --- a/.github/workflows/samples.yaml +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# Github action job to test core java library features on -# downstream client libraries before they are released. -on: - pull_request: -name: samples -jobs: - checkstyle: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-java@v3 - with: - distribution: zulu - java-version: 8 - - name: Run checkstyle - run: mvn -P lint --quiet --batch-mode checkstyle:check - working-directory: samples/snippets diff --git a/.gitignore b/.gitignore index 069d08fc..8dd0525a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ target/ *.iml .idea/ +.vscode/ + # python utilities *.pyc __pycache__ diff --git a/.kokoro/build.bat b/.kokoro/build.bat deleted file mode 100644 index 067cf4a4..00000000 --- a/.kokoro/build.bat +++ /dev/null @@ -1,18 +0,0 @@ -:: Copyright 2022 Google LLC -:: -:: Licensed under the Apache License, Version 2.0 (the "License"); -:: you may not use this file except in compliance with the License. -:: You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -:: Github action job to test core java library features on -:: downstream client libraries before they are released. -:: See documentation in type-shell-output.bat - -"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh deleted file mode 100755 index 1927fe78..00000000 --- a/.kokoro/build.sh +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -## Get the directory of the build script -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) -## cd to the parent directory, i.e. the root of the git repo -cd ${scriptDir}/.. - -# include common functions -source ${scriptDir}/common.sh - -# Print out Maven & Java version -mvn -version -echo ${JOB_TYPE} - -# attempt to install 3 times with exponential backoff (starting with 10 seconds) -retry_with_backoff 3 10 \ - mvn install -B -V -ntp \ - -DskipTests=true \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -Dmaven.javadoc.skip=true \ - -Dgcloud.download.skip=true \ - -T 1C - -# if GOOGLE_APPLICATION_CREDENTIALS is specified as a relative path, prepend Kokoro root directory onto it -if [[ ! -z "${GOOGLE_APPLICATION_CREDENTIALS}" && "${GOOGLE_APPLICATION_CREDENTIALS}" != /* ]]; then - export GOOGLE_APPLICATION_CREDENTIALS=$(realpath ${KOKORO_GFILE_DIR}/${GOOGLE_APPLICATION_CREDENTIALS}) -fi - -RETURN_CODE=0 -set +e - -case ${JOB_TYPE} in -test) - mvn test -B -ntp -Dclirr.skip=true -Denforcer.skip=true - RETURN_CODE=$? - ;; -lint) - mvn com.coveo:fmt-maven-plugin:check -B -ntp - RETURN_CODE=$? - ;; -javadoc) - mvn javadoc:javadoc javadoc:test-javadoc -B -ntp - RETURN_CODE=$? - ;; -integration) - mvn -B ${INTEGRATION_TEST_ARGS} \ - -ntp \ - -Penable-integration-tests \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify - RETURN_CODE=$? - ;; -graalvm) - # Run Unit and Integration Tests with Native Image - mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test - RETURN_CODE=$? - ;; -graalvm17) - # Run Unit and Integration Tests with Native Image - mvn -B ${INTEGRATION_TEST_ARGS} -ntp -Pnative -Penable-integration-tests test - RETURN_CODE=$? - ;; -samples) - SAMPLES_DIR=samples - # only run ITs in snapshot/ on presubmit PRs. run ITs in all 3 samples/ subdirectories otherwise. - if [[ ! -z ${KOKORO_GITHUB_PULL_REQUEST_NUMBER} ]] - then - SAMPLES_DIR=samples/snapshot - fi - - if [[ -f ${SAMPLES_DIR}/pom.xml ]] - then - for FILE in ${KOKORO_GFILE_DIR}/secret_manager/*-samples-secrets; do - [[ -f "$FILE" ]] || continue - source "$FILE" - done - - pushd ${SAMPLES_DIR} - mvn -B \ - -ntp \ - -DtrimStackTrace=false \ - -Dclirr.skip=true \ - -Denforcer.skip=true \ - -fae \ - verify - RETURN_CODE=$? - popd - else - echo "no sample pom.xml found - skipping sample tests" - fi - ;; -clirr) - mvn -B -ntp -Denforcer.skip=true clirr:check - RETURN_CODE=$? - ;; -*) - ;; -esac - -if [ "${REPORT_COVERAGE}" == "true" ] -then - bash ${KOKORO_GFILE_DIR}/codecov.sh -fi - -# fix output location of logs -bash .kokoro/coerce_logs.sh - -if [[ "${ENABLE_FLAKYBOT}" == "true" ]] -then - chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/flakybot - ${KOKORO_GFILE_DIR}/linux_amd64/flakybot -repo=googleapis/java-iot -fi - -echo "exiting with ${RETURN_CODE}" -exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh deleted file mode 100755 index 46edbf7f..00000000 --- a/.kokoro/coerce_logs.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script finds and moves sponge logs so that they can be found by placer -# and are not flagged as flaky by sponge. - -set -eo pipefail - -## Get the directory of the build script -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) -## cd to the parent directory, i.e. the root of the git repo -cd ${scriptDir}/.. - -job=$(basename ${KOKORO_JOB_NAME}) - -echo "coercing sponge logs..." -for xml in `find . -name *-sponge_log.xml` -do - class=$(basename ${xml} | cut -d- -f2) - dir=$(dirname ${xml})/${job}/${class} - text=$(dirname ${xml})/${class}-sponge_log.txt - mkdir -p ${dir} - mv ${xml} ${dir}/sponge_log.xml - mv ${text} ${dir}/sponge_log.txt -done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg deleted file mode 100644 index f1c507d5..00000000 --- a/.kokoro/common.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# 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-iot/.kokoro/trampoline.sh" - -# Tell the trampoline which build file to use. -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-iot/.kokoro/build.sh" -} diff --git a/.kokoro/common.sh b/.kokoro/common.sh deleted file mode 100644 index f8f957af..00000000 --- a/.kokoro/common.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -function retry_with_backoff { - attempts_left=$1 - sleep_seconds=$2 - shift 2 - command=$@ - - - # store current flag state - flags=$- - - # allow a failures to continue - set +e - ${command} - exit_code=$? - - # restore "e" flag - if [[ ${flags} =~ e ]] - then set -e - else set +e - fi - - if [[ $exit_code == 0 ]] - then - return 0 - fi - - # failure - if [[ ${attempts_left} > 0 ]] - then - echo "failure (${exit_code}), sleeping ${sleep_seconds}..." - sleep ${sleep_seconds} - new_attempts=$((${attempts_left} - 1)) - new_sleep=$((${sleep_seconds} * 2)) - retry_with_backoff ${new_attempts} ${new_sleep} ${command} - fi - - return $exit_code -} - -## Helper functionss -function now() { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n'; } -function msg() { println "$*" >&2; } -function println() { printf '%s\n' "$(now) $*"; } - -## Helper comment to trigger updated repo dependency release \ No newline at end of file diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg deleted file mode 100644 index be619526..00000000 --- a/.kokoro/continuous/common.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# 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-iot/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-iot/.kokoro/build.sh" -} - -env_vars: { - key: "JOB_TYPE" - value: "test" -} diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg deleted file mode 100644 index 495cc7ba..00000000 --- a/.kokoro/continuous/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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/propose_release.sh b/.kokoro/continuous/propose_release.sh deleted file mode 100755 index 9594a60d..00000000 --- a/.kokoro/continuous/propose_release.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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 -# -# 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. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=/home/node/.npm-global - -if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then - # Groom the release PR as new commits are merged. - npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ - --repo-url=googleapis/java-iot \ - --package-name="cloudiot" \ - --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ - --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ - --release-type=java-yoshi -fi diff --git a/.kokoro/dependencies.sh b/.kokoro/dependencies.sh deleted file mode 100755 index d7476cfe..00000000 --- a/.kokoro/dependencies.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail -shopt -s nullglob - -## Get the directory of the build script -scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) -## cd to the parent directory, i.e. the root of the git repo -cd ${scriptDir}/.. - -# include common functions -source ${scriptDir}/common.sh - -# Print out Java -java -version -echo $JOB_TYPE - -function determineMavenOpts() { - local javaVersion=$( - # filter down to the version line, then pull out the version between quotes, - # then trim the version number down to its minimal number (removing any - # update or suffix number). - java -version 2>&1 | grep "version" \ - | sed -E 's/^.*"(.*?)".*$/\1/g' \ - | sed -E 's/^(1\.[0-9]\.0).*$/\1/g' - ) - - if [[ $javaVersion == 17* ]] - then - # MaxPermSize is no longer supported as of jdk 17 - echo -n "-Xmx1024m" - else - echo -n "-Xmx1024m -XX:MaxPermSize=128m" - fi -} - -export MAVEN_OPTS=$(determineMavenOpts) - -# this should run maven enforcer -retry_with_backoff 3 10 \ - mvn install -B -V -ntp \ - -DskipTests=true \ - -Dmaven.javadoc.skip=true \ - -Dclirr.skip=true - -mvn -B dependency:analyze -DfailOnWarning=true - -echo "****************** DEPENDENCY LIST COMPLETENESS CHECK *******************" -## Run dependency list completeness check -function completenessCheck() { - # Output dep list with compile scope generated using the original pom - # Running mvn dependency:list on Java versions that support modules will also include the module of the dependency. - # This is stripped from the output as it is not present in the flattened pom. - # Only dependencies with 'compile' or 'runtime' scope are included from original dependency list. - msg "Generating dependency list using original pom..." - mvn dependency:list -f pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' | sed -e 's/ --.*//' >.org-list.txt - - # Output dep list generated using the flattened pom (only 'compile' and 'runtime' scopes) - msg "Generating dependency list using flattened pom..." - mvn dependency:list -f .flattened-pom.xml -DincludeScope=runtime -Dsort=true | grep '\[INFO] .*:.*:.*:.*:.*' >.new-list.txt - - # Compare two dependency lists - msg "Comparing dependency lists..." - diff .org-list.txt .new-list.txt >.diff.txt - if [[ $? == 0 ]] - then - msg "Success. No diff!" - else - msg "Diff found. See below: " - msg "You can also check .diff.txt file located in $1." - cat .diff.txt - return 1 - fi -} - -# Allow failures to continue running the script -set +e - -error_count=0 -for path in **/.flattened-pom.xml -do - # Check flattened pom in each dir that contains it for completeness - dir=$(dirname "$path") - pushd "$dir" - completenessCheck "$dir" - error_count=$(($error_count + $?)) - popd -done - -if [[ $error_count == 0 ]] -then - msg "All checks passed." - exit 0 -else - msg "Errors found. See log statements above." - exit 1 -fi diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg deleted file mode 100644 index be619526..00000000 --- a/.kokoro/nightly/common.cfg +++ /dev/null @@ -1,25 +0,0 @@ -# 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-iot/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-iot/.kokoro/build.sh" -} - -env_vars: { - key: "JOB_TYPE" - value: "test" -} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg deleted file mode 100644 index a2907a25..00000000 --- a/.kokoro/nightly/integration.cfg +++ /dev/null @@ -1,37 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "JOB_TYPE" - value: "integration" -} -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "true" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/nightly/java11-integration.cfg b/.kokoro/nightly/java11-integration.cfg deleted file mode 100644 index 58049cc3..00000000 --- a/.kokoro/nightly/java11-integration.cfg +++ /dev/null @@ -1,37 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-public-resources/java11014" -} - -env_vars: { - key: "JOB_TYPE" - value: "integration" -} -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "true" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg deleted file mode 100644 index 709f2b4c..00000000 --- a/.kokoro/nightly/java11.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index cb24f44e..00000000 --- a/.kokoro/nightly/java7.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index cbcbfae7..00000000 --- a/.kokoro/nightly/java8-osx.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-iot/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg deleted file mode 100644 index 45de109f..00000000 --- a/.kokoro/nightly/java8-win.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-iot/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg deleted file mode 100644 index 495cc7ba..00000000 --- a/.kokoro/nightly/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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 deleted file mode 100644 index 9761fd86..00000000 --- a/.kokoro/nightly/samples.cfg +++ /dev/null @@ -1,38 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/java8" -} - -env_vars: { - key: "JOB_TYPE" - value: "samples" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "java-docs-samples-testing" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-docs-samples-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-docs-samples-service-account" -} - -env_vars: { - key: "ENABLE_FLAKYBOT" - value: "true" -} diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh deleted file mode 100755 index f5251425..00000000 --- a/.kokoro/populate-secrets.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/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 deleted file mode 100644 index ec572442..00000000 --- a/.kokoro/presubmit/clirr.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# 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 deleted file mode 100644 index 5fbf7c21..00000000 --- a/.kokoro/presubmit/common.cfg +++ /dev/null @@ -1,34 +0,0 @@ -# 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-iot/.kokoro/trampoline.sh" - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-iot/.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 deleted file mode 100644 index 626509b1..00000000 --- a/.kokoro/presubmit/dependencies.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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-iot/.kokoro/dependencies.sh" -} diff --git a/.kokoro/presubmit/graalvm-native-17.cfg b/.kokoro/presubmit/graalvm-native-17.cfg deleted file mode 100644 index a3f7fb9d..00000000 --- a/.kokoro/presubmit/graalvm-native-17.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/graalvm17" -} - -env_vars: { - key: "JOB_TYPE" - value: "graalvm17" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} \ No newline at end of file diff --git a/.kokoro/presubmit/graalvm-native.cfg b/.kokoro/presubmit/graalvm-native.cfg deleted file mode 100644 index 4c7225ec..00000000 --- a/.kokoro/presubmit/graalvm-native.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -# Configure the docker image for kokoro-trampoline. -env_vars: { - key: "TRAMPOLINE_IMAGE" - value: "gcr.io/cloud-devrel-kokoro-resources/graalvm" -} - -env_vars: { - key: "JOB_TYPE" - value: "graalvm" -} - -# TODO: remove this after we've migrated all tests and scripts -env_vars: { - key: "GCLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_CLOUD_PROJECT" - value: "gcloud-devel" -} - -env_vars: { - key: "GOOGLE_APPLICATION_CREDENTIALS" - value: "secret_manager/java-it-service-account" -} - -env_vars: { - key: "SECRET_MANAGER_KEYS" - value: "java-it-service-account" -} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg deleted file mode 100644 index dded67a9..00000000 --- a/.kokoro/presubmit/integration.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# 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 deleted file mode 100644 index 709f2b4c..00000000 --- a/.kokoro/presubmit/java11.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index cb24f44e..00000000 --- a/.kokoro/presubmit/java7.cfg +++ /dev/null @@ -1,7 +0,0 @@ -# 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 deleted file mode 100644 index cbcbfae7..00000000 --- a/.kokoro/presubmit/java8-osx.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-iot/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg deleted file mode 100644 index 45de109f..00000000 --- a/.kokoro/presubmit/java8-win.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -build_file: "java-iot/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg deleted file mode 100644 index 495cc7ba..00000000 --- a/.kokoro/presubmit/java8.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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 deleted file mode 100644 index 7b6ba010..00000000 --- a/.kokoro/presubmit/linkage-monitor.cfg +++ /dev/null @@ -1,12 +0,0 @@ -# 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-iot/.kokoro/linkage-monitor.sh" -} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg deleted file mode 100644 index 6d323c8a..00000000 --- a/.kokoro/presubmit/lint.cfg +++ /dev/null @@ -1,13 +0,0 @@ -# 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 deleted file mode 100644 index 01e09600..00000000 --- a/.kokoro/presubmit/samples.cfg +++ /dev/null @@ -1,33 +0,0 @@ -# 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 deleted file mode 100755 index 5f671a9d..00000000 --- a/.kokoro/readme.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/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-iot - -# 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-iot \ - --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 deleted file mode 100644 index 620df343..00000000 --- a/.kokoro/release/bump_snapshot.cfg +++ /dev/null @@ -1,53 +0,0 @@ -# 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-iot/.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-iot/.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/bump_snapshot.sh b/.kokoro/release/bump_snapshot.sh deleted file mode 100755 index a14bfa08..00000000 --- a/.kokoro/release/bump_snapshot.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 -# -# 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. - -set -eo pipefail - -export NPM_CONFIG_PREFIX=/home/node/.npm-global - -if [ -f ${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please ]; then - # Groom the snapshot release PR immediately after publishing a release - npx release-please release-pr --token=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-token-release-please \ - --repo-url=googleapis/java-iot \ - --package-name="cloudiot" \ - --api-url=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-url-release-please \ - --proxy-key=${KOKORO_KEYSTORE_DIR}/73713_github-magic-proxy-key-release-please \ - --snapshot \ - --release-type=java-auth-yoshi -fi diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg deleted file mode 100644 index b40b7754..00000000 --- a/.kokoro/release/common.cfg +++ /dev/null @@ -1,49 +0,0 @@ -# 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-iot/.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 deleted file mode 100755 index 7f78ee41..00000000 --- a/.kokoro/release/common.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# Get secrets from keystore and set and environment variables -setup_environment_secrets() { - export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) - export GPG_TTY=$(tty) - export GPG_HOMEDIR=/gpg - mkdir $GPG_HOMEDIR - mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg - mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg - export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') - export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') -} - -create_settings_xml_file() { - echo " - - - ossrh - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - - sonatype-nexus-staging - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - - sonatype-nexus-snapshots - ${SONATYPE_USERNAME} - ${SONATYPE_PASSWORD} - - -" > $1 -} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg deleted file mode 100644 index 01755c30..00000000 --- a/.kokoro/release/drop.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-iot/.kokoro/release/drop.sh" -} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh deleted file mode 100755 index 742ec1a8..00000000 --- a/.kokoro/release/drop.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# STAGING_REPOSITORY_ID must be set -if [ -z "${STAGING_REPOSITORY_ID}" ]; then - echo "Missing STAGING_REPOSITORY_ID environment variable" - exit 1 -fi - -source $(dirname "$0")/common.sh -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn nexus-staging:drop -B \ - --settings=settings.xml \ - -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg deleted file mode 100644 index 8c79f5ae..00000000 --- a/.kokoro/release/promote.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-iot/.kokoro/release/promote.sh" -} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh deleted file mode 100755 index 3cac3d8a..00000000 --- a/.kokoro/release/promote.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# STAGING_REPOSITORY_ID must be set -if [ -z "${STAGING_REPOSITORY_ID}" ]; then - echo "Missing STAGING_REPOSITORY_ID environment variable" - exit 1 -fi - -source $(dirname "$0")/common.sh - -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -mvn nexus-staging:release -B \ - -DperformRelease=true \ - --settings=settings.xml \ - -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg deleted file mode 100644 index 6e9cb998..00000000 --- a/.kokoro/release/publish_javadoc.cfg +++ /dev/null @@ -1,23 +0,0 @@ -# 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-iot/.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 deleted file mode 100755 index 27035cc0..00000000 --- a/.kokoro/release/publish_javadoc.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash -# Copyright 2019 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET}" ]]; then - echo "Need to set STAGING_BUCKET environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-iot -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 deleted file mode 100644 index c21091d1..00000000 --- a/.kokoro/release/publish_javadoc11.cfg +++ /dev/null @@ -1,30 +0,0 @@ -# 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-iot/.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 deleted file mode 100755 index 027a432c..00000000 --- a/.kokoro/release/publish_javadoc11.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -if [[ -z "${CREDENTIALS}" ]]; then - CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account -fi - -if [[ -z "${STAGING_BUCKET_V2}" ]]; then - echo "Need to set STAGING_BUCKET_V2 environment variable" - exit 1 -fi - -# work from the git root directory -pushd $(dirname "$0")/../../ - -# install docuploader package -python3 -m pip install --require-hashes -r .kokoro/requirements.txt - -# compile all packages -mvn clean install -B -q -DskipTests=true - -export NAME=google-cloud-iot -export VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) - -# cloud RAD generation -mvn clean javadoc:aggregate -B -q -P docFX -# include CHANGELOG -cp CHANGELOG.md target/docfx-yml/history.md - -pushd target/docfx-yml - -# create metadata -python3 -m docuploader create-metadata \ - --name ${NAME} \ - --version ${VERSION} \ - --xrefs devsite://java/gax \ - --xrefs devsite://java/google-cloud-core \ - --xrefs devsite://java/api-common \ - --xrefs devsite://java/proto-google-common-protos \ - --xrefs devsite://java/google-api-client \ - --xrefs devsite://java/google-http-client \ - --xrefs devsite://java/protobuf \ - --language java - -# upload yml to production bucket -python3 -m docuploader upload . \ - --credentials ${CREDENTIALS} \ - --staging-bucket ${STAGING_BUCKET_V2} \ - --destination-prefix docfx diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg deleted file mode 100644 index 26f61b15..00000000 --- a/.kokoro/release/snapshot.cfg +++ /dev/null @@ -1,6 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-iot/.kokoro/release/snapshot.sh" -} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh deleted file mode 100755 index 1f55b770..00000000 --- a/.kokoro/release/snapshot.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/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 deleted file mode 100644 index f1db1542..00000000 --- a/.kokoro/release/stage.cfg +++ /dev/null @@ -1,19 +0,0 @@ -# Format: //devtools/kokoro/config/proto/build.proto - -env_vars: { - key: "TRAMPOLINE_BUILD_FILE" - value: "github/java-iot/.kokoro/release/stage.sh" -} - -# Need to save the properties file -action { - define_artifacts { - regex: "github/java-iot/target/nexus-staging/staging/*.properties" - strip_prefix: "github/java-iot" - } -} - -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 deleted file mode 100755 index 61e714d6..00000000 --- a/.kokoro/release/stage.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -eo pipefail - -# Start the releasetool reporter -requirementsFile=$(realpath $(dirname "${BASH_SOURCE[0]}")/../requirements.txt) -python3 -m pip install --require-hashes -r $requirementsFile -python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script - -source $(dirname "$0")/common.sh -source $(dirname "$0")/../common.sh -MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml -pushd $(dirname "$0")/../../ - -setup_environment_secrets -create_settings_xml_file "settings.xml" - -# attempt to stage 3 times with exponential backoff (starting with 10 seconds) -retry_with_backoff 3 10 \ - mvn clean deploy -B \ - --settings ${MAVEN_SETTINGS_FILE} \ - -DskipTests=true \ - -Dclirr.skip=true \ - -DperformRelease=true \ - -Dgpg.executable=gpg \ - -Dgpg.passphrase=${GPG_PASSPHRASE} \ - -Dgpg.homedir=${GPG_HOMEDIR} - -if [[ -n "${AUTORELEASE_PR}" ]] -then - mvn nexus-staging:release -B \ - -DperformRelease=true \ - --settings=settings.xml -fi diff --git a/.kokoro/requirements.in b/.kokoro/requirements.in deleted file mode 100644 index cfdc2e7e..00000000 --- a/.kokoro/requirements.in +++ /dev/null @@ -1,31 +0,0 @@ -gcp-docuploader==0.6.3 -google-crc32c==1.3.0 -googleapis-common-protos==1.56.3 -gcp-releasetool==1.8.7 -cachetools==4.2.4 -cffi==1.15.1 -jeepney==0.7.1 -jinja2==3.0.3 -markupsafe==2.0.1 -keyring==23.4.1 -packaging==21.3 -protobuf==3.19.5 -pyjwt==2.4.0 -pyparsing==3.0.9 -pycparser==2.21 -pyperclip==1.8.2 -python-dateutil==2.8.2 -requests==2.27.1 -importlib-metadata==4.8.3 -zipp==3.6.0 -google_api_core==2.8.2 -google-cloud-storage==2.0.0 -google-cloud-core==2.3.1 -typing-extensions==4.1.1 -urllib3==1.26.12 -zipp==3.6.0 -rsa==4.9 -six==1.16.0 -attrs==22.1.0 -google-auth==2.11.0 -idna==3.4 \ No newline at end of file diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt deleted file mode 100644 index 170f1c63..00000000 --- a/.kokoro/requirements.txt +++ /dev/null @@ -1,452 +0,0 @@ -# -# This file is autogenerated by pip-compile with python 3.10 -# To update, run: -# -# pip-compile --allow-unsafe --generate-hashes requirements.in -# -attrs==22.1.0 \ - --hash=sha256:29adc2665447e5191d0e7c568fde78b21f9672d344281d0c6e1ab085429b22b6 \ - --hash=sha256:86efa402f67bf2df34f51a335487cf46b1ec130d02b8d39fd248abfd30da551c - # via - # -r requirements.in - # gcp-releasetool -cachetools==4.2.4 \ - --hash=sha256:89ea6f1b638d5a73a4f9226be57ac5e4f399d22770b92355f92dcb0f7f001693 \ - --hash=sha256:92971d3cb7d2a97efff7c7bb1657f21a8f5fb309a37530537c71b1774189f2d1 - # via - # -r requirements.in - # google-auth -certifi==2022.9.14 \ - --hash=sha256:36973885b9542e6bd01dea287b2b4b3b21236307c56324fcc3f1160f2d655ed5 \ - --hash=sha256:e232343de1ab72c2aa521b625c80f699e356830fd0e2c620b465b304b17b0516 - # via requests -cffi==1.15.1 \ - --hash=sha256:00a9ed42e88df81ffae7a8ab6d9356b371399b91dbdf0c3cb1e84c03a13aceb5 \ - --hash=sha256:03425bdae262c76aad70202debd780501fabeaca237cdfddc008987c0e0f59ef \ - --hash=sha256:04ed324bda3cda42b9b695d51bb7d54b680b9719cfab04227cdd1e04e5de3104 \ - --hash=sha256:0e2642fe3142e4cc4af0799748233ad6da94c62a8bec3a6648bf8ee68b1c7426 \ - --hash=sha256:173379135477dc8cac4bc58f45db08ab45d228b3363adb7af79436135d028405 \ - --hash=sha256:198caafb44239b60e252492445da556afafc7d1e3ab7a1fb3f0584ef6d742375 \ - --hash=sha256:1e74c6b51a9ed6589199c787bf5f9875612ca4a8a0785fb2d4a84429badaf22a \ - --hash=sha256:2012c72d854c2d03e45d06ae57f40d78e5770d252f195b93f581acf3ba44496e \ - --hash=sha256:21157295583fe8943475029ed5abdcf71eb3911894724e360acff1d61c1d54bc \ - --hash=sha256:2470043b93ff09bf8fb1d46d1cb756ce6132c54826661a32d4e4d132e1977adf \ - --hash=sha256:285d29981935eb726a4399badae8f0ffdff4f5050eaa6d0cfc3f64b857b77185 \ - --hash=sha256:30d78fbc8ebf9c92c9b7823ee18eb92f2e6ef79b45ac84db507f52fbe3ec4497 \ - --hash=sha256:320dab6e7cb2eacdf0e658569d2575c4dad258c0fcc794f46215e1e39f90f2c3 \ - --hash=sha256:33ab79603146aace82c2427da5ca6e58f2b3f2fb5da893ceac0c42218a40be35 \ - --hash=sha256:3548db281cd7d2561c9ad9984681c95f7b0e38881201e157833a2342c30d5e8c \ - --hash=sha256:3799aecf2e17cf585d977b780ce79ff0dc9b78d799fc694221ce814c2c19db83 \ - --hash=sha256:39d39875251ca8f612b6f33e6b1195af86d1b3e60086068be9cc053aa4376e21 \ - --hash=sha256:3b926aa83d1edb5aa5b427b4053dc420ec295a08e40911296b9eb1b6170f6cca \ - --hash=sha256:3bcde07039e586f91b45c88f8583ea7cf7a0770df3a1649627bf598332cb6984 \ - --hash=sha256:3d08afd128ddaa624a48cf2b859afef385b720bb4b43df214f85616922e6a5ac \ - --hash=sha256:3eb6971dcff08619f8d91607cfc726518b6fa2a9eba42856be181c6d0d9515fd \ - --hash=sha256:40f4774f5a9d4f5e344f31a32b5096977b5d48560c5592e2f3d2c4374bd543ee \ - --hash=sha256:4289fc34b2f5316fbb762d75362931e351941fa95fa18789191b33fc4cf9504a \ - --hash=sha256:470c103ae716238bbe698d67ad020e1db9d9dba34fa5a899b5e21577e6d52ed2 \ - --hash=sha256:4f2c9f67e9821cad2e5f480bc8d83b8742896f1242dba247911072d4fa94c192 \ - --hash=sha256:50a74364d85fd319352182ef59c5c790484a336f6db772c1a9231f1c3ed0cbd7 \ - --hash=sha256:54a2db7b78338edd780e7ef7f9f6c442500fb0d41a5a4ea24fff1c929d5af585 \ - --hash=sha256:5635bd9cb9731e6d4a1132a498dd34f764034a8ce60cef4f5319c0541159392f \ - --hash=sha256:59c0b02d0a6c384d453fece7566d1c7e6b7bae4fc5874ef2ef46d56776d61c9e \ - --hash=sha256:5d598b938678ebf3c67377cdd45e09d431369c3b1a5b331058c338e201f12b27 \ - --hash=sha256:5df2768244d19ab7f60546d0c7c63ce1581f7af8b5de3eb3004b9b6fc8a9f84b \ - --hash=sha256:5ef34d190326c3b1f822a5b7a45f6c4535e2f47ed06fec77d3d799c450b2651e \ - --hash=sha256:6975a3fac6bc83c4a65c9f9fcab9e47019a11d3d2cf7f3c0d03431bf145a941e \ - --hash=sha256:6c9a799e985904922a4d207a94eae35c78ebae90e128f0c4e521ce339396be9d \ - --hash=sha256:70df4e3b545a17496c9b3f41f5115e69a4f2e77e94e1d2a8e1070bc0c38c8a3c \ - --hash=sha256:7473e861101c9e72452f9bf8acb984947aa1661a7704553a9f6e4baa5ba64415 \ - --hash=sha256:8102eaf27e1e448db915d08afa8b41d6c7ca7a04b7d73af6514df10a3e74bd82 \ - --hash=sha256:87c450779d0914f2861b8526e035c5e6da0a3199d8f1add1a665e1cbc6fc6d02 \ - --hash=sha256:8b7ee99e510d7b66cdb6c593f21c043c248537a32e0bedf02e01e9553a172314 \ - --hash=sha256:91fc98adde3d7881af9b59ed0294046f3806221863722ba7d8d120c575314325 \ - --hash=sha256:94411f22c3985acaec6f83c6df553f2dbe17b698cc7f8ae751ff2237d96b9e3c \ - --hash=sha256:98d85c6a2bef81588d9227dde12db8a7f47f639f4a17c9ae08e773aa9c697bf3 \ - --hash=sha256:9ad5db27f9cabae298d151c85cf2bad1d359a1b9c686a275df03385758e2f914 \ - --hash=sha256:a0b71b1b8fbf2b96e41c4d990244165e2c9be83d54962a9a1d118fd8657d2045 \ - --hash=sha256:a0f100c8912c114ff53e1202d0078b425bee3649ae34d7b070e9697f93c5d52d \ - --hash=sha256:a591fe9e525846e4d154205572a029f653ada1a78b93697f3b5a8f1f2bc055b9 \ - --hash=sha256:a5c84c68147988265e60416b57fc83425a78058853509c1b0629c180094904a5 \ - --hash=sha256:a66d3508133af6e8548451b25058d5812812ec3798c886bf38ed24a98216fab2 \ - --hash=sha256:a8c4917bd7ad33e8eb21e9a5bbba979b49d9a97acb3a803092cbc1133e20343c \ - --hash=sha256:b3bbeb01c2b273cca1e1e0c5df57f12dce9a4dd331b4fa1635b8bec26350bde3 \ - --hash=sha256:cba9d6b9a7d64d4bd46167096fc9d2f835e25d7e4c121fb2ddfc6528fb0413b2 \ - --hash=sha256:cc4d65aeeaa04136a12677d3dd0b1c0c94dc43abac5860ab33cceb42b801c1e8 \ - --hash=sha256:ce4bcc037df4fc5e3d184794f27bdaab018943698f4ca31630bc7f84a7b69c6d \ - --hash=sha256:cec7d9412a9102bdc577382c3929b337320c4c4c4849f2c5cdd14d7368c5562d \ - --hash=sha256:d400bfb9a37b1351253cb402671cea7e89bdecc294e8016a707f6d1d8ac934f9 \ - --hash=sha256:d61f4695e6c866a23a21acab0509af1cdfd2c013cf256bbf5b6b5e2695827162 \ - --hash=sha256:db0fbb9c62743ce59a9ff687eb5f4afbe77e5e8403d6697f7446e5f609976f76 \ - --hash=sha256:dd86c085fae2efd48ac91dd7ccffcfc0571387fe1193d33b6394db7ef31fe2a4 \ - --hash=sha256:e00b098126fd45523dd056d2efba6c5a63b71ffe9f2bbe1a4fe1716e1d0c331e \ - --hash=sha256:e229a521186c75c8ad9490854fd8bbdd9a0c9aa3a524326b55be83b54d4e0ad9 \ - --hash=sha256:e263d77ee3dd201c3a142934a086a4450861778baaeeb45db4591ef65550b0a6 \ - --hash=sha256:ed9cb427ba5504c1dc15ede7d516b84757c3e3d7868ccc85121d9310d27eed0b \ - --hash=sha256:fa6693661a4c91757f4412306191b6dc88c1703f780c8234035eac011922bc01 \ - --hash=sha256:fcd131dd944808b5bdb38e6f5b53013c5aa4f334c5cad0c72742f6eba4b73db0 - # via - # -r requirements.in - # cryptography -charset-normalizer==2.0.12 \ - --hash=sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597 \ - --hash=sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df - # via requests -click==8.0.4 \ - --hash=sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1 \ - --hash=sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb - # via - # gcp-docuploader - # gcp-releasetool -colorlog==6.7.0 \ - --hash=sha256:0d33ca236784a1ba3ff9c532d4964126d8a2c44f1f0cb1d2b0728196f512f662 \ - --hash=sha256:bd94bd21c1e13fac7bd3153f4bc3a7dc0eb0974b8bc2fdf1a989e474f6e582e5 - # via gcp-docuploader -cryptography==38.0.1 \ - --hash=sha256:0297ffc478bdd237f5ca3a7dc96fc0d315670bfa099c04dc3a4a2172008a405a \ - --hash=sha256:10d1f29d6292fc95acb597bacefd5b9e812099d75a6469004fd38ba5471a977f \ - --hash=sha256:16fa61e7481f4b77ef53991075de29fc5bacb582a1244046d2e8b4bb72ef66d0 \ - --hash=sha256:194044c6b89a2f9f169df475cc167f6157eb9151cc69af8a2a163481d45cc407 \ - --hash=sha256:1db3d807a14931fa317f96435695d9ec386be7b84b618cc61cfa5d08b0ae33d7 \ - --hash=sha256:3261725c0ef84e7592597606f6583385fed2a5ec3909f43bc475ade9729a41d6 \ - --hash=sha256:3b72c360427889b40f36dc214630e688c2fe03e16c162ef0aa41da7ab1455153 \ - --hash=sha256:3e3a2599e640927089f932295a9a247fc40a5bdf69b0484532f530471a382750 \ - --hash=sha256:3fc26e22840b77326a764ceb5f02ca2d342305fba08f002a8c1f139540cdfaad \ - --hash=sha256:5067ee7f2bce36b11d0e334abcd1ccf8c541fc0bbdaf57cdd511fdee53e879b6 \ - --hash=sha256:52e7bee800ec869b4031093875279f1ff2ed12c1e2f74923e8f49c916afd1d3b \ - --hash=sha256:64760ba5331e3f1794d0bcaabc0d0c39e8c60bf67d09c93dc0e54189dfd7cfe5 \ - --hash=sha256:765fa194a0f3372d83005ab83ab35d7c5526c4e22951e46059b8ac678b44fa5a \ - --hash=sha256:79473cf8a5cbc471979bd9378c9f425384980fcf2ab6534b18ed7d0d9843987d \ - --hash=sha256:896dd3a66959d3a5ddcfc140a53391f69ff1e8f25d93f0e2e7830c6de90ceb9d \ - --hash=sha256:89ed49784ba88c221756ff4d4755dbc03b3c8d2c5103f6d6b4f83a0fb1e85294 \ - --hash=sha256:ac7e48f7e7261207d750fa7e55eac2d45f720027d5703cd9007e9b37bbb59ac0 \ - --hash=sha256:ad7353f6ddf285aeadfaf79e5a6829110106ff8189391704c1d8801aa0bae45a \ - --hash=sha256:b0163a849b6f315bf52815e238bc2b2346604413fa7c1601eea84bcddb5fb9ac \ - --hash=sha256:b6c9b706316d7b5a137c35e14f4103e2115b088c412140fdbd5f87c73284df61 \ - --hash=sha256:c2e5856248a416767322c8668ef1845ad46ee62629266f84a8f007a317141013 \ - --hash=sha256:ca9f6784ea96b55ff41708b92c3f6aeaebde4c560308e5fbbd3173fbc466e94e \ - --hash=sha256:d1a5bd52d684e49a36582193e0b89ff267704cd4025abefb9e26803adeb3e5fb \ - --hash=sha256:d3971e2749a723e9084dd507584e2a2761f78ad2c638aa31e80bc7a15c9db4f9 \ - --hash=sha256:d4ef6cc305394ed669d4d9eebf10d3a101059bdcf2669c366ec1d14e4fb227bd \ - --hash=sha256:d9e69ae01f99abe6ad646947bba8941e896cb3aa805be2597a0400e0764b5818 - # via - # gcp-releasetool - # secretstorage -gcp-docuploader==0.6.3 \ - --hash=sha256:ba8c9d76b3bbac54b0311c503a373b00edc2dc02d6d54ea9507045adb8e870f7 \ - --hash=sha256:c0f5aaa82ce1854a386197e4e359b120ad6d4e57ae2c812fce42219a3288026b - # via -r requirements.in -gcp-releasetool==1.8.7 \ - --hash=sha256:3d2a67c9db39322194afb3b427e9cb0476ce8f2a04033695f0aeb63979fc2b37 \ - --hash=sha256:5e4d28f66e90780d77f3ecf1e9155852b0c3b13cbccb08ab07e66b2357c8da8d - # via -r requirements.in -google-api-core==2.8.2 \ - --hash=sha256:06f7244c640322b508b125903bb5701bebabce8832f85aba9335ec00b3d02edc \ - --hash=sha256:93c6a91ccac79079ac6bbf8b74ee75db970cc899278b97d53bc012f35908cf50 - # via - # -r requirements.in - # google-cloud-core - # google-cloud-storage -google-auth==2.11.0 \ - --hash=sha256:be62acaae38d0049c21ca90f27a23847245c9f161ff54ede13af2cb6afecbac9 \ - --hash=sha256:ed65ecf9f681832298e29328e1ef0a3676e3732b2e56f41532d45f70a22de0fb - # via - # -r requirements.in - # gcp-releasetool - # google-api-core - # google-cloud-core - # google-cloud-storage -google-cloud-core==2.3.1 \ - --hash=sha256:113ba4f492467d5bd442c8d724c1a25ad7384045c3178369038840ecdd19346c \ - --hash=sha256:34334359cb04187bdc80ddcf613e462dfd7a3aabbc3fe4d118517ab4b9303d53 - # via - # -r requirements.in - # google-cloud-storage -google-cloud-storage==2.0.0 \ - --hash=sha256:a57a15aead0f9dfbd4381f1bfdbe8bf89818a4bd75bab846cafcefb2db846c47 \ - --hash=sha256:ec4be60bb223a3a960f0d01697d849b86d91cad815a84915a32ed3635e93a5e7 - # via - # -r requirements.in - # gcp-docuploader -google-crc32c==1.3.0 \ - --hash=sha256:04e7c220798a72fd0f08242bc8d7a05986b2a08a0573396187fd32c1dcdd58b3 \ - --hash=sha256:05340b60bf05b574159e9bd940152a47d38af3fb43803ffe71f11d704b7696a6 \ - --hash=sha256:12674a4c3b56b706153a358eaa1018c4137a5a04635b92b4652440d3d7386206 \ - --hash=sha256:127f9cc3ac41b6a859bd9dc4321097b1a4f6aa7fdf71b4f9227b9e3ebffb4422 \ - --hash=sha256:13af315c3a0eec8bb8b8d80b8b128cb3fcd17d7e4edafc39647846345a3f003a \ - --hash=sha256:1926fd8de0acb9d15ee757175ce7242e235482a783cd4ec711cc999fc103c24e \ - --hash=sha256:226f2f9b8e128a6ca6a9af9b9e8384f7b53a801907425c9a292553a3a7218ce0 \ - --hash=sha256:276de6273eb074a35bc598f8efbc00c7869c5cf2e29c90748fccc8c898c244df \ - --hash=sha256:318f73f5484b5671f0c7f5f63741ab020a599504ed81d209b5c7129ee4667407 \ - --hash=sha256:3bbce1be3687bbfebe29abdb7631b83e6b25da3f4e1856a1611eb21854b689ea \ - --hash=sha256:42ae4781333e331a1743445931b08ebdad73e188fd554259e772556fc4937c48 \ - --hash=sha256:58be56ae0529c664cc04a9c76e68bb92b091e0194d6e3c50bea7e0f266f73713 \ - --hash=sha256:5da2c81575cc3ccf05d9830f9e8d3c70954819ca9a63828210498c0774fda1a3 \ - --hash=sha256:6311853aa2bba4064d0c28ca54e7b50c4d48e3de04f6770f6c60ebda1e975267 \ - --hash=sha256:650e2917660e696041ab3dcd7abac160b4121cd9a484c08406f24c5964099829 \ - --hash=sha256:6a4db36f9721fdf391646685ecffa404eb986cbe007a3289499020daf72e88a2 \ - --hash=sha256:779cbf1ce375b96111db98fca913c1f5ec11b1d870e529b1dc7354b2681a8c3a \ - --hash=sha256:7f6fe42536d9dcd3e2ffb9d3053f5d05221ae3bbcefbe472bdf2c71c793e3183 \ - --hash=sha256:891f712ce54e0d631370e1f4997b3f182f3368179198efc30d477c75d1f44942 \ - --hash=sha256:95c68a4b9b7828ba0428f8f7e3109c5d476ca44996ed9a5f8aac6269296e2d59 \ - --hash=sha256:96a8918a78d5d64e07c8ea4ed2bc44354e3f93f46a4866a40e8db934e4c0d74b \ - --hash=sha256:9c3cf890c3c0ecfe1510a452a165431b5831e24160c5fcf2071f0f85ca5a47cd \ - --hash=sha256:9f58099ad7affc0754ae42e6d87443299f15d739b0ce03c76f515153a5cda06c \ - --hash=sha256:a0b9e622c3b2b8d0ce32f77eba617ab0d6768b82836391e4f8f9e2074582bf02 \ - --hash=sha256:a7f9cbea4245ee36190f85fe1814e2d7b1e5f2186381b082f5d59f99b7f11328 \ - --hash=sha256:bab4aebd525218bab4ee615786c4581952eadc16b1ff031813a2fd51f0cc7b08 \ - --hash=sha256:c124b8c8779bf2d35d9b721e52d4adb41c9bfbde45e6a3f25f0820caa9aba73f \ - --hash=sha256:c9da0a39b53d2fab3e5467329ed50e951eb91386e9d0d5b12daf593973c3b168 \ - --hash=sha256:ca60076c388728d3b6ac3846842474f4250c91efbfe5afa872d3ffd69dd4b318 \ - --hash=sha256:cb6994fff247987c66a8a4e550ef374671c2b82e3c0d2115e689d21e511a652d \ - --hash=sha256:d1c1d6236feab51200272d79b3d3e0f12cf2cbb12b208c835b175a21efdb0a73 \ - --hash=sha256:dd7760a88a8d3d705ff562aa93f8445ead54f58fd482e4f9e2bafb7e177375d4 \ - --hash=sha256:dda4d8a3bb0b50f540f6ff4b6033f3a74e8bf0bd5320b70fab2c03e512a62812 \ - --hash=sha256:e0f1ff55dde0ebcfbef027edc21f71c205845585fffe30d4ec4979416613e9b3 \ - --hash=sha256:e7a539b9be7b9c00f11ef16b55486141bc2cdb0c54762f84e3c6fc091917436d \ - --hash=sha256:eb0b14523758e37802f27b7f8cd973f5f3d33be7613952c0df904b68c4842f0e \ - --hash=sha256:ed447680ff21c14aaceb6a9f99a5f639f583ccfe4ce1a5e1d48eb41c3d6b3217 \ - --hash=sha256:f52a4ad2568314ee713715b1e2d79ab55fab11e8b304fd1462ff5cccf4264b3e \ - --hash=sha256:fbd60c6aaa07c31d7754edbc2334aef50601b7f1ada67a96eb1eb57c7c72378f \ - --hash=sha256:fc28e0db232c62ca0c3600884933178f0825c99be4474cdd645e378a10588125 \ - --hash=sha256:fe31de3002e7b08eb20823b3735b97c86c5926dd0581c7710a680b418a8709d4 \ - --hash=sha256:fec221a051150eeddfdfcff162e6db92c65ecf46cb0f7bb1bf812a1520ec026b \ - --hash=sha256:ff71073ebf0e42258a42a0b34f2c09ec384977e7f6808999102eedd5b49920e3 - # via - # -r requirements.in - # google-resumable-media -google-resumable-media==2.3.3 \ - --hash=sha256:27c52620bd364d1c8116eaac4ea2afcbfb81ae9139fb3199652fcac1724bfb6c \ - --hash=sha256:5b52774ea7a829a8cdaa8bd2d4c3d4bc660c91b30857ab2668d0eb830f4ea8c5 - # via google-cloud-storage -googleapis-common-protos==1.56.3 \ - --hash=sha256:6f1369b58ed6cf3a4b7054a44ebe8d03b29c309257583a2bbdc064cd1e4a1442 \ - --hash=sha256:87955d7b3a73e6e803f2572a33179de23989ebba725e05ea42f24838b792e461 - # via - # -r requirements.in - # google-api-core -idna==3.4 \ - --hash=sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4 \ - --hash=sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2 - # via - # -r requirements.in - # requests -importlib-metadata==4.8.3 \ - --hash=sha256:65a9576a5b2d58ca44d133c42a241905cc45e34d2c06fd5ba2bafa221e5d7b5e \ - --hash=sha256:766abffff765960fcc18003801f7044eb6755ffae4521c8e8ce8e83b9c9b0668 - # via - # -r requirements.in - # keyring -jeepney==0.7.1 \ - --hash=sha256:1b5a0ea5c0e7b166b2f5895b91a08c14de8915afda4407fb5022a195224958ac \ - --hash=sha256:fa9e232dfa0c498bd0b8a3a73b8d8a31978304dcef0515adc859d4e096f96f4f - # via - # -r requirements.in - # keyring - # secretstorage -jinja2==3.0.3 \ - --hash=sha256:077ce6014f7b40d03b47d1f1ca4b0fc8328a692bd284016f806ed0eaca390ad8 \ - --hash=sha256:611bb273cd68f3b993fabdc4064fc858c5b47a973cb5aa7999ec1ba405c87cd7 - # via - # -r requirements.in - # gcp-releasetool -keyring==23.4.1 \ - --hash=sha256:17e49fb0d6883c2b4445359434dba95aad84aabb29bbff044ad0ed7100232eca \ - --hash=sha256:89cbd74d4683ed164c8082fb38619341097741323b3786905c6dac04d6915a55 - # via - # -r requirements.in - # gcp-releasetool -markupsafe==2.0.1 \ - --hash=sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298 \ - --hash=sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64 \ - --hash=sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b \ - --hash=sha256:04635854b943835a6ea959e948d19dcd311762c5c0c6e1f0e16ee57022669194 \ - --hash=sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567 \ - --hash=sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff \ - --hash=sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724 \ - --hash=sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74 \ - --hash=sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646 \ - --hash=sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35 \ - --hash=sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6 \ - --hash=sha256:20dca64a3ef2d6e4d5d615a3fd418ad3bde77a47ec8a23d984a12b5b4c74491a \ - --hash=sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6 \ - --hash=sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad \ - --hash=sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26 \ - --hash=sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38 \ - --hash=sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac \ - --hash=sha256:3c112550557578c26af18a1ccc9e090bfe03832ae994343cfdacd287db6a6ae7 \ - --hash=sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6 \ - --hash=sha256:4296f2b1ce8c86a6aea78613c34bb1a672ea0e3de9c6ba08a960efe0b0a09047 \ - --hash=sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75 \ - --hash=sha256:49e3ceeabbfb9d66c3aef5af3a60cc43b85c33df25ce03d0031a608b0a8b2e3f \ - --hash=sha256:4dc8f9fb58f7364b63fd9f85013b780ef83c11857ae79f2feda41e270468dd9b \ - --hash=sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135 \ - --hash=sha256:53edb4da6925ad13c07b6d26c2a852bd81e364f95301c66e930ab2aef5b5ddd8 \ - --hash=sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a \ - --hash=sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a \ - --hash=sha256:5b6d930f030f8ed98e3e6c98ffa0652bdb82601e7a016ec2ab5d7ff23baa78d1 \ - --hash=sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9 \ - --hash=sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864 \ - --hash=sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914 \ - --hash=sha256:6300b8454aa6930a24b9618fbb54b5a68135092bc666f7b06901f897fa5c2fee \ - --hash=sha256:63f3268ba69ace99cab4e3e3b5840b03340efed0948ab8f78d2fd87ee5442a4f \ - --hash=sha256:6557b31b5e2c9ddf0de32a691f2312a32f77cd7681d8af66c2692efdbef84c18 \ - --hash=sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8 \ - --hash=sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2 \ - --hash=sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d \ - --hash=sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b \ - --hash=sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b \ - --hash=sha256:89c687013cb1cd489a0f0ac24febe8c7a666e6e221b783e53ac50ebf68e45d86 \ - --hash=sha256:8d206346619592c6200148b01a2142798c989edcb9c896f9ac9722a99d4e77e6 \ - --hash=sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f \ - --hash=sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb \ - --hash=sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833 \ - --hash=sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28 \ - --hash=sha256:9f02365d4e99430a12647f09b6cc8bab61a6564363f313126f775eb4f6ef798e \ - --hash=sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415 \ - --hash=sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902 \ - --hash=sha256:aca6377c0cb8a8253e493c6b451565ac77e98c2951c45f913e0b52facdcff83f \ - --hash=sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d \ - --hash=sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9 \ - --hash=sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d \ - --hash=sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145 \ - --hash=sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066 \ - --hash=sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c \ - --hash=sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1 \ - --hash=sha256:cdfba22ea2f0029c9261a4bd07e830a8da012291fbe44dc794e488b6c9bb353a \ - --hash=sha256:d6c7ebd4e944c85e2c3421e612a7057a2f48d478d79e61800d81468a8d842207 \ - --hash=sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f \ - --hash=sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53 \ - --hash=sha256:deb993cacb280823246a026e3b2d81c493c53de6acfd5e6bfe31ab3402bb37dd \ - --hash=sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134 \ - --hash=sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85 \ - --hash=sha256:f0567c4dc99f264f49fe27da5f735f414c4e7e7dd850cfd8e69f0862d7c74ea9 \ - --hash=sha256:f5653a225f31e113b152e56f154ccbe59eeb1c7487b39b9d9f9cdb58e6c79dc5 \ - --hash=sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94 \ - --hash=sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509 \ - --hash=sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51 \ - --hash=sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872 - # via - # -r requirements.in - # jinja2 -packaging==21.3 \ - --hash=sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb \ - --hash=sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522 - # via - # -r requirements.in - # gcp-releasetool -protobuf==3.19.5 \ - --hash=sha256:1867f93b06a183f87696871bb8d1e99ee71dbb69d468ce1f0cc8bf3d30f982f3 \ - --hash=sha256:3c4160b601220627f7e91154e572baf5e161a9c3f445a8242d536ee3d0b7b17c \ - --hash=sha256:4ee2af7051d3b10c8a4fe6fd1a2c69f201fea36aeee7086cf202a692e1b99ee1 \ - --hash=sha256:5266c36cc0af3bb3dbf44f199d225b33da66a9a5c3bdc2b14865ad10eddf0e37 \ - --hash=sha256:5470f892961af464ae6eaf0f3099e2c1190ae8c7f36f174b89491281341f79ca \ - --hash=sha256:66d14b5b90090353efe75c9fb1bf65ef7267383034688d255b500822e37d5c2f \ - --hash=sha256:67efb5d20618020aa9596e17bfc37ca068c28ec0c1507d9507f73c93d46c9855 \ - --hash=sha256:696e6cfab94cc15a14946f2bf72719dced087d437adbd994fff34f38986628bc \ - --hash=sha256:6a02172b9650f819d01fb8e224fc69b0706458fc1ab4f1c669281243c71c1a5e \ - --hash=sha256:6eca9ae238ba615d702387a2ddea635d535d769994a9968c09a4ca920c487ab9 \ - --hash=sha256:950abd6c00e7b51f87ae8b18a0ce4d69fea217f62f171426e77de5061f6d9850 \ - --hash=sha256:9e1d74032f56ff25f417cfe84c8147047732e5059137ca42efad20cbbd25f5e0 \ - --hash=sha256:9e42b1cf2ecd8a1bd161239e693f22035ba99905ae6d7efeac8a0546c7ec1a27 \ - --hash=sha256:9f957ef53e872d58a0afd3bf6d80d48535d28c99b40e75e6634cbc33ea42fd54 \ - --hash=sha256:a89aa0c042e61e11ade320b802d6db4ee5391d8d973e46d3a48172c1597789f8 \ - --hash=sha256:c0f80876a8ff0ae7064084ed094eb86497bd5a3812e6fc96a05318b92301674e \ - --hash=sha256:c44e3282cff74ad18c7e8a0375f407f69ee50c2116364b44492a196293e08b21 \ - --hash=sha256:d249519ba5ecf5dd6b18150c9b6bcde510b273714b696f3923ff8308fc11ae49 \ - --hash=sha256:d3973a2d58aefc7d1230725c2447ce7f86a71cbc094b86a77c6ee1505ac7cdb1 \ - --hash=sha256:dca2284378a5f2a86ffed35c6ac147d14c48b525eefcd1083e5a9ce28dfa8657 \ - --hash=sha256:e63b0b3c42e51c94add62b010366cd4979cb6d5f06158bcae8faac4c294f91e1 \ - --hash=sha256:f2b599a21c9a32e171ec29a2ac54e03297736c578698e11b099d031f79da114b \ - --hash=sha256:f2bde37667b18c2b5280df83bc799204394a5d2d774e4deaf9de0eb741df6833 \ - --hash=sha256:f4f909f4dde413dec435a44b0894956d55bb928ded7d6e3c726556ca4c796e84 \ - --hash=sha256:f976234e20ab2785f54224bcdafa027674e23663b132fa3ca0caa291a6cfbde7 \ - --hash=sha256:f9cebda093c2f6bfed88f1c17cdade09d4d96096421b344026feee236532d4de - # via - # -r requirements.in - # gcp-docuploader - # gcp-releasetool - # google-api-core - # google-cloud-storage - # googleapis-common-protos -pyasn1==0.4.8 \ - --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ - --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba - # via - # pyasn1-modules - # rsa -pyasn1-modules==0.2.8 \ - --hash=sha256:905f84c712230b2c592c19470d3ca8d552de726050d1d1716282a1f6146be65e \ - --hash=sha256:a50b808ffeb97cb3601dd25981f6b016cbb3d31fbf57a8b8a87428e6158d0c74 - # via google-auth -pycparser==2.21 \ - --hash=sha256:8ee45429555515e1f6b185e78100aea234072576aa43ab53aefcae078162fca9 \ - --hash=sha256:e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206 - # via - # -r requirements.in - # cffi -pyjwt==2.4.0 \ - --hash=sha256:72d1d253f32dbd4f5c88eaf1fdc62f3a19f676ccbadb9dbc5d07e951b2b26daf \ - --hash=sha256:d42908208c699b3b973cbeb01a969ba6a96c821eefb1c5bfe4c390c01d67abba - # via - # -r requirements.in - # gcp-releasetool -pyparsing==3.0.9 \ - --hash=sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb \ - --hash=sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc - # via - # -r requirements.in - # packaging -pyperclip==1.8.2 \ - --hash=sha256:105254a8b04934f0bc84e9c24eb360a591aaf6535c9def5f29d92af107a9bf57 - # via - # -r requirements.in - # gcp-releasetool -python-dateutil==2.8.2 \ - --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ - --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 - # via - # -r requirements.in - # gcp-releasetool -requests==2.27.1 \ - --hash=sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61 \ - --hash=sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d - # via - # -r requirements.in - # gcp-releasetool - # google-api-core - # google-cloud-storage -rsa==4.9 \ - --hash=sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7 \ - --hash=sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21 - # via - # -r requirements.in - # google-auth -secretstorage==3.3.3 \ - --hash=sha256:2403533ef369eca6d2ba81718576c5e0f564d5cca1b58f73a8b23e7d4eeebd77 \ - --hash=sha256:f356e6628222568e3af06f2eba8df495efa13b3b63081dafd4f7d9a7b7bc9f99 - # via keyring -six==1.16.0 \ - --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 \ - --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 - # via - # -r requirements.in - # gcp-docuploader - # google-auth - # python-dateutil -typing-extensions==4.1.1 \ - --hash=sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42 \ - --hash=sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2 - # via -r requirements.in -urllib3==1.26.12 \ - --hash=sha256:3fa96cf423e6987997fc326ae8df396db2a8b7c667747d47ddd8ecba91f4a74e \ - --hash=sha256:b930dd878d5a8afb066a637fbb35144fe7901e3b209d1cd4f524bd0e9deee997 - # via - # -r requirements.in - # requests -zipp==3.6.0 \ - --hash=sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832 \ - --hash=sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc - # via - # -r requirements.in - # importlib-metadata diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh deleted file mode 100644 index 8b69b793..00000000 --- a/.kokoro/trampoline.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# Copyright 2018 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -set -eo pipefail -# Always run the cleanup script, regardless of the success of bouncing into -# the container. -function cleanup() { - chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh - echo "cleanup"; -} -trap cleanup EXIT - -$(dirname $0)/populate-secrets.sh # Secret Manager secrets. -python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/.repo-metadata.json b/.repo-metadata.json deleted file mode 100644 index 9241b6fb..00000000 --- a/.repo-metadata.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "api_shortname": "cloudiot", - "name_pretty": "Cloud Internet of Things (IoT) Core", - "product_documentation": "https://cloud.google.com/iot", - "client_documentation": "https://cloud.google.com/java/docs/reference/google-cloud-iot/latest/history", - "issue_tracker": "https://issuetracker.google.com/issues?q=status:open%20componentid:310170", - "release_level": "stable", - "language": "java", - "repo": "googleapis/java-iot", - "repo_short": "java-iot", - "distribution_name": "com.google.cloud:google-cloud-iot", - "api_id": "cloudiot.googleapis.com", - "transport": "grpc", - "requires_billing": true, - "api_description": "is a complete set of tools to connect, process, store, and analyze data both at the edge and in the cloud. The platform consists of scalable, fully-managed cloud services; an integrated software stack for edge/on-premises computing with machine learning capabilities for all your IoT needs.", - "library_type": "GAPIC_AUTO" -} diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 0400f3b8..00000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,494 +0,0 @@ -# Changelog - -## [2.3.5](https://github.com/googleapis/java-iot/compare/v2.3.4...v2.3.5) (2022-10-03) - - -### Dependencies - -* Update dependency cachetools to v5 ([#796](https://github.com/googleapis/java-iot/issues/796)) ([13c40c0](https://github.com/googleapis/java-iot/commit/13c40c00900bf6ef7d0ec85ba12990399f2f0acb)) -* Update dependency certifi to v2022.9.24 ([#776](https://github.com/googleapis/java-iot/issues/776)) ([27d967b](https://github.com/googleapis/java-iot/commit/27d967bfc4c8d18ff5868f594ca9ce5f9ab819c9)) -* Update dependency charset-normalizer to v2.1.1 ([#780](https://github.com/googleapis/java-iot/issues/780)) ([31175a8](https://github.com/googleapis/java-iot/commit/31175a8ef23d32ca3e7466aefd5ca127513be3b2)) -* Update dependency click to v8.1.3 ([#782](https://github.com/googleapis/java-iot/issues/782)) ([b29aac4](https://github.com/googleapis/java-iot/commit/b29aac47bf782afa730201a2ee38e52269a57773)) -* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.4 ([#801](https://github.com/googleapis/java-iot/issues/801)) ([5aaca23](https://github.com/googleapis/java-iot/commit/5aaca23ead7950d90997a663ad19cfbe43e34b4a)) -* Update dependency gcp-releasetool to v1.8.8 ([#777](https://github.com/googleapis/java-iot/issues/777)) ([efd99d2](https://github.com/googleapis/java-iot/commit/efd99d2bbdaba94dd1153f9f542bf4f64b722909)) -* Update dependency google-api-core to v2.10.1 ([#783](https://github.com/googleapis/java-iot/issues/783)) ([6cf9827](https://github.com/googleapis/java-iot/commit/6cf982706d553957bc4a4b8e7310dd08bd6f14ed)) -* Update dependency google-auth to v2.12.0 ([#784](https://github.com/googleapis/java-iot/issues/784)) ([af599e9](https://github.com/googleapis/java-iot/commit/af599e98b6aa14246fffb77d424e600d054dee05)) -* Update dependency google-cloud-core to v2.3.2 ([#778](https://github.com/googleapis/java-iot/issues/778)) ([13fe93a](https://github.com/googleapis/java-iot/commit/13fe93a833d709663df7beede1a0c7d7134bf220)) -* Update dependency google-cloud-storage to v2.5.0 ([#785](https://github.com/googleapis/java-iot/issues/785)) ([6250d45](https://github.com/googleapis/java-iot/commit/6250d45704d6a1b5fe7c6cd5bc31918f2a55349e)) -* Update dependency google-crc32c to v1.5.0 ([#786](https://github.com/googleapis/java-iot/issues/786)) ([35a4c8b](https://github.com/googleapis/java-iot/commit/35a4c8ba0dea3234b6a7e29f41191ebbd0eede7f)) -* Update dependency googleapis-common-protos to v1.56.4 ([#779](https://github.com/googleapis/java-iot/issues/779)) ([9ebbbd9](https://github.com/googleapis/java-iot/commit/9ebbbd9f206205cb1b6cdf0b5fdafdc931e6a5ac)) -* Update dependency importlib-metadata to v4.12.0 ([#787](https://github.com/googleapis/java-iot/issues/787)) ([64f2a73](https://github.com/googleapis/java-iot/commit/64f2a73aaf15ff127d9bc20178e69db54f074bfa)) -* Update dependency jeepney to v0.8.0 ([#788](https://github.com/googleapis/java-iot/issues/788)) ([9e99be7](https://github.com/googleapis/java-iot/commit/9e99be7bb50c6591dbb077279e793655fa74548e)) -* Update dependency jinja2 to v3.1.2 ([#789](https://github.com/googleapis/java-iot/issues/789)) ([4638fff](https://github.com/googleapis/java-iot/commit/4638fffbf442b7d8fd73e12c8733d216a25b8b40)) -* Update dependency keyring to v23.9.3 ([#790](https://github.com/googleapis/java-iot/issues/790)) ([2c197aa](https://github.com/googleapis/java-iot/commit/2c197aa52a57afb49d82d4730b8627966558844a)) -* Update dependency markupsafe to v2.1.1 ([#781](https://github.com/googleapis/java-iot/issues/781)) ([664d31e](https://github.com/googleapis/java-iot/commit/664d31e93916f720716fe0a5ab34be245294f723)) -* Update dependency protobuf to v3.20.2 ([#791](https://github.com/googleapis/java-iot/issues/791)) ([3e9c38c](https://github.com/googleapis/java-iot/commit/3e9c38c2b039660e68d3fb43b1186665c479fac3)) -* Update dependency protobuf to v4 ([#797](https://github.com/googleapis/java-iot/issues/797)) ([acd00dd](https://github.com/googleapis/java-iot/commit/acd00dd0fd3f46b0f3cbbda26409ac0c8f4809c4)) -* Update dependency typing-extensions to v4.3.0 ([#794](https://github.com/googleapis/java-iot/issues/794)) ([5a80492](https://github.com/googleapis/java-iot/commit/5a8049249f7e8ad5dec08d00d8ecceda3bb17efc)) -* Update dependency zipp to v3.8.1 ([#795](https://github.com/googleapis/java-iot/issues/795)) ([e5ae448](https://github.com/googleapis/java-iot/commit/e5ae448ad2f5fb22ff6ac7047b642959a40f1795)) - -## [2.3.4](https://github.com/googleapis/java-iot/compare/v2.3.3...v2.3.4) (2022-09-15) - - -### Dependencies - -* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.3 ([#769](https://github.com/googleapis/java-iot/issues/769)) ([e6531c4](https://github.com/googleapis/java-iot/commit/e6531c424e06c0c867907011c5a312568f3d4c0f)) - -## [2.3.3](https://github.com/googleapis/java-iot/compare/v2.3.2...v2.3.3) (2022-09-09) - - -### Dependencies - -* Update dependency com.google.cloud:google-cloud-shared-dependencies to v3.0.2 ([#764](https://github.com/googleapis/java-iot/issues/764)) ([45f17bf](https://github.com/googleapis/java-iot/commit/45f17bf034c3b097ec641838e24f79da0da49b0a)) - -## [2.3.2](https://github.com/googleapis/java-iot/compare/v2.3.1...v2.3.2) (2022-08-09) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v3 ([#753](https://github.com/googleapis/java-iot/issues/753)) ([336679d](https://github.com/googleapis/java-iot/commit/336679dc3bd02a1658b4a6dbf27523bb55e33ce4)) - -## [2.3.1](https://github.com/googleapis/java-iot/compare/v2.3.0...v2.3.1) (2022-07-13) - - -### Bug Fixes - -* enable longpaths support for windows test ([#1485](https://github.com/googleapis/java-iot/issues/1485)) ([#747](https://github.com/googleapis/java-iot/issues/747)) ([93a62e2](https://github.com/googleapis/java-iot/commit/93a62e289e62e9a94c018cf925b4884181380dab)) - -## [2.3.0](https://github.com/googleapis/java-iot/compare/v2.2.1...v2.3.0) (2022-07-01) - - -### Features - -* Enable REST transport for most of Java and Go clients ([#734](https://github.com/googleapis/java-iot/issues/734)) ([21fa6cc](https://github.com/googleapis/java-iot/commit/21fa6ccea1a7c7489f374c90fd7354c54b15e925)) - -## [2.2.1](https://github.com/googleapis/java-iot/compare/v2.2.0...v2.2.1) (2022-06-23) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.13.0 ([#733](https://github.com/googleapis/java-iot/issues/733)) ([8e216cb](https://github.com/googleapis/java-iot/commit/8e216cbf0b23315793db24e0f7a42d38c1c81fc8)) - -## [2.2.0](https://github.com/googleapis/java-iot/compare/v2.1.10...v2.2.0) (2022-05-24) - - -### Features - -* add build scripts for native image testing in Java 17 ([#1440](https://github.com/googleapis/java-iot/issues/1440)) ([#724](https://github.com/googleapis/java-iot/issues/724)) ([fd58590](https://github.com/googleapis/java-iot/commit/fd585903e6ea00080ac335843b3ce82837009470)) -* AuditConfig for IAM v1 ([ed54ce1](https://github.com/googleapis/java-iot/commit/ed54ce113925c0ccf55e7758d8b1fd97c712ed45)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.12.0 ([#723](https://github.com/googleapis/java-iot/issues/723)) ([40b82e2](https://github.com/googleapis/java-iot/commit/40b82e243a8b684e07a39bda35a7b7b16f072ab4)) - -### [2.1.10](https://github.com/googleapis/java-iot/compare/v2.1.9...v2.1.10) (2022-04-15) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.10.0 ([#711](https://github.com/googleapis/java-iot/issues/711)) ([7911cc0](https://github.com/googleapis/java-iot/commit/7911cc03ffc7f81c488655d981a71ee752feb6bf)) - -### [2.1.9](https://github.com/googleapis/java-iot/compare/v2.1.8...v2.1.9) (2022-03-29) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.9.0 ([#704](https://github.com/googleapis/java-iot/issues/704)) ([87daba1](https://github.com/googleapis/java-iot/commit/87daba169750a091368123f97fe84e41ca07c562)) - -### [2.1.8](https://github.com/googleapis/java-iot/compare/v2.1.7...v2.1.8) (2022-03-02) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.8.0 ([#694](https://github.com/googleapis/java-iot/issues/694)) ([ddd037c](https://github.com/googleapis/java-iot/commit/ddd037c56843b5a52919833819064d835de75b3f)) - -### [2.1.7](https://github.com/googleapis/java-iot/compare/v2.1.6...v2.1.7) (2022-02-28) - - -### Dependencies - -* update actions/setup-java action to v3 ([#686](https://github.com/googleapis/java-iot/issues/686)) ([d4c341f](https://github.com/googleapis/java-iot/commit/d4c341fd778fe77d1c6e22807beb5772796460b9)) - -### [2.1.6](https://github.com/googleapis/java-iot/compare/v2.1.5...v2.1.6) (2022-02-03) - - -### Dependencies - -* **java:** update actions/github-script action to v5 ([#1339](https://github.com/googleapis/java-iot/issues/1339)) ([#669](https://github.com/googleapis/java-iot/issues/669)) ([1cbfb0c](https://github.com/googleapis/java-iot/commit/1cbfb0c56c4197e141871b627cad95b5b73814b2)) -* update actions/github-script action to v5 ([#668](https://github.com/googleapis/java-iot/issues/668)) ([c4d4901](https://github.com/googleapis/java-iot/commit/c4d4901d9b07be8004f3bd6b04df9fcc44a99de0)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.7.0 ([#671](https://github.com/googleapis/java-iot/issues/671)) ([8b15b63](https://github.com/googleapis/java-iot/commit/8b15b6332a75643cd8c63369b6602b295b90ebab)) - -### [2.1.5](https://www.github.com/googleapis/java-iot/compare/v2.1.4...v2.1.5) (2022-01-07) - - -### Bug Fixes - -* **java:** add -ntp flag to native image testing command ([#1299](https://www.github.com/googleapis/java-iot/issues/1299)) ([#646](https://www.github.com/googleapis/java-iot/issues/646)) ([dcb46c9](https://www.github.com/googleapis/java-iot/commit/dcb46c97122c06afe2862b9ac0a942cb0c60f795)) -* **java:** run Maven in plain console-friendly mode ([#1301](https://www.github.com/googleapis/java-iot/issues/1301)) ([#652](https://www.github.com/googleapis/java-iot/issues/652)) ([7aeb5f5](https://www.github.com/googleapis/java-iot/commit/7aeb5f5bd1174766864aa723adc1863446dc10c7)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.6.0 ([#655](https://www.github.com/googleapis/java-iot/issues/655)) ([4dec841](https://www.github.com/googleapis/java-iot/commit/4dec8416347514fc93d05d6daf25e1f8c27899d5)) - -### [2.1.4](https://www.github.com/googleapis/java-iot/compare/v2.1.3...v2.1.4) (2021-12-03) - - -### Bug Fixes - -* **java:** java 17 dependency arguments ([#1266](https://www.github.com/googleapis/java-iot/issues/1266)) ([#628](https://www.github.com/googleapis/java-iot/issues/628)) ([eefb123](https://www.github.com/googleapis/java-iot/commit/eefb123a2faf601062af07ae8119643d64f5f424)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.0 ([#638](https://www.github.com/googleapis/java-iot/issues/638)) ([4d080af](https://www.github.com/googleapis/java-iot/commit/4d080af650c3c8ad96a607fbe7a036048ff4b86e)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.5.1 ([#643](https://www.github.com/googleapis/java-iot/issues/643)) ([1c46464](https://www.github.com/googleapis/java-iot/commit/1c46464b7bf1d0eb51280e84f3f31975ba0e4848)) - -### [2.1.3](https://www.github.com/googleapis/java-iot/compare/v2.1.2...v2.1.3) (2021-10-20) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.4.0 ([#623](https://www.github.com/googleapis/java-iot/issues/623)) ([dd1fb94](https://www.github.com/googleapis/java-iot/commit/dd1fb9401e8e53c80834cde56a779cb1ab402e49)) - -### [2.1.2](https://www.github.com/googleapis/java-iot/compare/v2.1.1...v2.1.2) (2021-09-22) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.3.0 ([#609](https://www.github.com/googleapis/java-iot/issues/609)) ([5164f18](https://www.github.com/googleapis/java-iot/commit/5164f188229d07d7ad86aa9bcf74353f70667acf)) - -### [2.1.1](https://www.github.com/googleapis/java-iot/compare/v2.1.0...v2.1.1) (2021-09-14) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.1 ([#602](https://www.github.com/googleapis/java-iot/issues/602)) ([1adda1f](https://www.github.com/googleapis/java-iot/commit/1adda1fbf953a6deb8045b454b1e3540bbe72983)) - -## [2.1.0](https://www.github.com/googleapis/java-iot/compare/v2.0.2...v2.1.0) (2021-09-01) - - -### Features - -* Remove use of deprecated gradle command in java README ([#1196](https://www.github.com/googleapis/java-iot/issues/1196)) ([#587](https://www.github.com/googleapis/java-iot/issues/587)) ([944c08a](https://www.github.com/googleapis/java-iot/commit/944c08a98c04511734fc4bed2524d84330e6634f)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.2.0 ([#590](https://www.github.com/googleapis/java-iot/issues/590)) ([dd89994](https://www.github.com/googleapis/java-iot/commit/dd899945a0036a474ffe6087e16a09e31cf20276)) - -### [2.0.2](https://www.github.com/googleapis/java-iot/compare/v2.0.1...v2.0.2) (2021-08-23) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.1.0 ([#579](https://www.github.com/googleapis/java-iot/issues/579)) ([eb46418](https://www.github.com/googleapis/java-iot/commit/eb46418919ab783d2f2e8aaf5a8bc7baaeacb524)) - -### [2.0.1](https://www.github.com/googleapis/java-iot/compare/v2.0.0...v2.0.1) (2021-08-12) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.0.1 ([#571](https://www.github.com/googleapis/java-iot/issues/571)) ([04a3172](https://www.github.com/googleapis/java-iot/commit/04a3172a25fb2d17b533ee52fcd43144f2e03105)) - -## [2.0.0](https://www.github.com/googleapis/java-iot/compare/v1.3.2...v2.0.0) (2021-08-10) - - -### ⚠ BREAKING CHANGES - -* release gapic-generator-java v2.0.0 (#562) - -### Features - -* release gapic-generator-java v2.0.0 ([#562](https://www.github.com/googleapis/java-iot/issues/562)) ([413e8f1](https://www.github.com/googleapis/java-iot/commit/413e8f110c371d2ed919e4c31685fac8a3aa58f3)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v2 ([#563](https://www.github.com/googleapis/java-iot/issues/563)) ([cc1b78d](https://www.github.com/googleapis/java-iot/commit/cc1b78dd0e9f440404da838c7c405d3231429aa2)) - -### [1.3.2](https://www.github.com/googleapis/java-iot/compare/v1.3.1...v1.3.2) (2021-07-01) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.4.0 ([#495](https://www.github.com/googleapis/java-iot/issues/495)) ([f491778](https://www.github.com/googleapis/java-iot/commit/f4917783f293cf9194b2b232fe0f1bf55451f707)) - -### [1.3.1](https://www.github.com/googleapis/java-iot/compare/v1.3.0...v1.3.1) (2021-06-04) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.3.0 ([#476](https://www.github.com/googleapis/java-iot/issues/476)) ([80e67b4](https://www.github.com/googleapis/java-iot/commit/80e67b4a3e114bcaaf5c0be781abacfa77ee79f6)) - -## [1.3.0](https://www.github.com/googleapis/java-iot/compare/v1.2.3...v1.3.0) (2021-05-26) - - -### Features - -* add `gcf-owl-bot[bot]` to `ignoreAuthors` ([#461](https://www.github.com/googleapis/java-iot/issues/461)) ([0660812](https://www.github.com/googleapis/java-iot/commit/06608126cd1ce2d980c87518c79e3f825380a8dd)) -* add blunderbuss config to cloud iot label ([#422](https://www.github.com/googleapis/java-iot/issues/422)) ([6eb088e](https://www.github.com/googleapis/java-iot/commit/6eb088efb53bb285bb6ca99f54b04b6403305fdd)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.2.0 ([#460](https://www.github.com/googleapis/java-iot/issues/460)) ([8b9624a](https://www.github.com/googleapis/java-iot/commit/8b9624ad6732e1f9a6c958eb36ba0ef15d171df7)) - -### [1.2.3](https://www.github.com/googleapis/java-iot/compare/v1.2.2...v1.2.3) (2021-05-14) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1.1.0 ([#451](https://www.github.com/googleapis/java-iot/issues/451)) ([ec33a85](https://www.github.com/googleapis/java-iot/commit/ec33a85715c24b26dcc180047d6f81e378c9dd88)) - -### [1.2.2](https://www.github.com/googleapis/java-iot/compare/v1.2.1...v1.2.2) (2021-04-23) - - -### Bug Fixes - -* release scripts from issuing overlapping phases ([#430](https://www.github.com/googleapis/java-iot/issues/430)) ([f210f43](https://www.github.com/googleapis/java-iot/commit/f210f43821fc883503b9f453c35b9b101e7784eb)) -* typo ([#427](https://www.github.com/googleapis/java-iot/issues/427)) ([e7a6dfb](https://www.github.com/googleapis/java-iot/commit/e7a6dfb3c5cecb18dce4cfb3c74c0f7c126da4b9)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.1 ([#433](https://www.github.com/googleapis/java-iot/issues/433)) ([88a624c](https://www.github.com/googleapis/java-iot/commit/88a624c019fe00e3f8c5d9c1200370d78b8bc3d9)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v1 ([#436](https://www.github.com/googleapis/java-iot/issues/436)) ([9df5b96](https://www.github.com/googleapis/java-iot/commit/9df5b962e152c03dbc2bec65c786b5ddff3ee401)) - -### [1.2.1](https://www.github.com/googleapis/java-iot/compare/v1.2.0...v1.2.1) (2021-04-09) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.21.0 ([#415](https://www.github.com/googleapis/java-iot/issues/415)) ([33c4371](https://www.github.com/googleapis/java-iot/commit/33c437140f24740500f4c51c9fd532fff4e75cb5)) - -## [1.2.0](https://www.github.com/googleapis/java-iot/compare/v1.1.14...v1.2.0) (2021-03-11) - - -### Features - -* **generator:** update protoc to v3.15.3 ([#389](https://www.github.com/googleapis/java-iot/issues/389)) ([7c7af19](https://www.github.com/googleapis/java-iot/commit/7c7af19f806ae6a13461b38af811d0e56f627089)) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.20.1 ([#400](https://www.github.com/googleapis/java-iot/issues/400)) ([6981d80](https://www.github.com/googleapis/java-iot/commit/6981d802f101912c1ae7e8f671e9179ab4561c7c)) - -### [1.1.14](https://www.github.com/googleapis/java-iot/compare/v1.1.13...v1.1.14) (2021-02-25) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.20.0 ([#384](https://www.github.com/googleapis/java-iot/issues/384)) ([a160727](https://www.github.com/googleapis/java-iot/commit/a16072783ce70c269bf69efff11cf74e5a8ee200)) - -### [1.1.13](https://www.github.com/googleapis/java-iot/compare/v1.1.12...v1.1.13) (2021-02-22) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.19.0 ([#373](https://www.github.com/googleapis/java-iot/issues/373)) ([fc78b63](https://www.github.com/googleapis/java-iot/commit/fc78b63d49c72b33b154840c445cb7d545504d07)) - -### [1.1.12](https://www.github.com/googleapis/java-iot/compare/v1.1.11...v1.1.12) (2021-02-09) - - -### Bug Fixes - -* update repo name ([#355](https://www.github.com/googleapis/java-iot/issues/355)) ([f62acec](https://www.github.com/googleapis/java-iot/commit/f62acec74a9b5ac0455aaaf6b56aadfd8407f40e)) - -### [1.1.11](https://www.github.com/googleapis/java-iot/compare/v1.1.10...v1.1.11) (2021-01-14) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.18.0 ([#336](https://www.github.com/googleapis/java-iot/issues/336)) ([752b95a](https://www.github.com/googleapis/java-iot/commit/752b95a91bec6882f9ed868e300990e1862ca5a8)) - -### [1.1.10](https://www.github.com/googleapis/java-iot/compare/v1.1.9...v1.1.10) (2020-12-15) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.17.0 ([#324](https://www.github.com/googleapis/java-iot/issues/324)) ([29c5962](https://www.github.com/googleapis/java-iot/commit/29c5962ab4e4e9fbf6286269a72c963792f68669)) - -### [1.1.9](https://www.github.com/googleapis/java-iot/compare/v1.1.8...v1.1.9) (2020-12-14) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.1 ([#319](https://www.github.com/googleapis/java-iot/issues/319)) ([4e4b532](https://www.github.com/googleapis/java-iot/commit/4e4b532484eff8a83797cdc83af51fa0fbcb6053)) - -### [1.1.8](https://www.github.com/googleapis/java-iot/compare/v1.1.7...v1.1.8) (2020-12-02) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.16.0 ([#310](https://www.github.com/googleapis/java-iot/issues/310)) ([83a6954](https://www.github.com/googleapis/java-iot/commit/83a6954f2899ed902bb6d68209739ee1aa6e23f5)) - -### [1.1.7](https://www.github.com/googleapis/java-iot/compare/v1.1.6...v1.1.7) (2020-11-11) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.15.0 ([#292](https://www.github.com/googleapis/java-iot/issues/292)) ([65828cf](https://www.github.com/googleapis/java-iot/commit/65828cf27c9044b607f88135c70d8691e2ce485f)) - -### [1.1.6](https://www.github.com/googleapis/java-iot/compare/v1.1.5...v1.1.6) (2020-11-02) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.14.1 ([#280](https://www.github.com/googleapis/java-iot/issues/280)) ([689d2ff](https://www.github.com/googleapis/java-iot/commit/689d2ffdf7ae2e9eb5dd62a55fd078761f58c337)) - -### [1.1.5](https://www.github.com/googleapis/java-iot/compare/v1.1.4...v1.1.5) (2020-10-21) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.13.0 ([#265](https://www.github.com/googleapis/java-iot/issues/265)) ([d6e1444](https://www.github.com/googleapis/java-iot/commit/d6e1444a49e28df36d956450dd13419ddff99d5d)) - -### [1.1.4](https://www.github.com/googleapis/java-iot/compare/v1.1.3...v1.1.4) (2020-10-19) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.12.1 ([#258](https://www.github.com/googleapis/java-iot/issues/258)) ([7015034](https://www.github.com/googleapis/java-iot/commit/701503477e4d55680217dcb7529cf72303186863)) - -### [1.1.3](https://www.github.com/googleapis/java-iot/compare/v1.1.2...v1.1.3) (2020-10-08) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.10.2 ([#241](https://www.github.com/googleapis/java-iot/issues/241)) ([0532228](https://www.github.com/googleapis/java-iot/commit/05322283b98c6da9b13058b5d913c97849d57ddc)) - -### [1.1.2](https://www.github.com/googleapis/java-iot/compare/v1.1.1...v1.1.2) (2020-09-23) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.10.0 ([#228](https://www.github.com/googleapis/java-iot/issues/228)) ([c12ccc0](https://www.github.com/googleapis/java-iot/commit/c12ccc0be9921a27d5ee18b76c50eefe55e2f6fa)) - -### [1.1.1](https://www.github.com/googleapis/java-iot/compare/v1.1.0...v1.1.1) (2020-09-21) - - -### Dependencies - -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.9.0 ([#213](https://www.github.com/googleapis/java-iot/issues/213)) ([70a8da1](https://www.github.com/googleapis/java-iot/commit/70a8da1b178557b863cf2d846171aba3d0ee9ae8)) - -## [1.1.0](https://www.github.com/googleapis/java-iot/compare/v1.0.2...v1.1.0) (2020-08-10) - - -### Features - -* **deps:** adopt flatten plugin and google-cloud-shared-dependencies ([#174](https://www.github.com/googleapis/java-iot/issues/174)) ([272cb69](https://www.github.com/googleapis/java-iot/commit/272cb690cd954dcbe24f91a76107ea8afd379d51)) - - -### Bug Fixes - -* restore GAPIC v2 retry configs ([#144](https://www.github.com/googleapis/java-iot/issues/144)) ([f8ae7ba](https://www.github.com/googleapis/java-iot/commit/f8ae7bab29c0c7d0dde44cd142ac5081d18954c5)) -* **v1:** migrate to grpc_service_config ([#193](https://www.github.com/googleapis/java-iot/issues/193)) ([5dd9dcf](https://www.github.com/googleapis/java-iot/commit/5dd9dcfdf03cafce29d11518dca61f247627dc2b)) - - -### Dependencies - -* update core dependencies ([#165](https://www.github.com/googleapis/java-iot/issues/165)) ([5c3b059](https://www.github.com/googleapis/java-iot/commit/5c3b05901f87428ace2a6532b93764e095aea150)) -* update dependency com.google.api:api-common to v1.9.1 ([#149](https://www.github.com/googleapis/java-iot/issues/149)) ([9031980](https://www.github.com/googleapis/java-iot/commit/903198019ea5477dd32536a0c778db93c4cd2498)) -* update dependency com.google.api:api-common to v1.9.2 ([#156](https://www.github.com/googleapis/java-iot/issues/156)) ([975d1f5](https://www.github.com/googleapis/java-iot/commit/975d1f5f33a7a372dec507d2b81c9dde98068288)) -* update dependency com.google.api.grpc:proto-google-common-protos to v1.18.0 ([#138](https://www.github.com/googleapis/java-iot/issues/138)) ([bba4e4b](https://www.github.com/googleapis/java-iot/commit/bba4e4b1f3f61a0bef0384b285694d14c0ea3417)) -* update dependency com.google.cloud:google-cloud-core to v1.93.5 ([#150](https://www.github.com/googleapis/java-iot/issues/150)) ([aaf25dd](https://www.github.com/googleapis/java-iot/commit/aaf25dd0d66dbcd245563347e473534a5e6246c5)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.2 ([#186](https://www.github.com/googleapis/java-iot/issues/186)) ([00a0cb8](https://www.github.com/googleapis/java-iot/commit/00a0cb8d98360b57666b39de45ab6186448d8324)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.3 ([#188](https://www.github.com/googleapis/java-iot/issues/188)) ([5f50037](https://www.github.com/googleapis/java-iot/commit/5f5003797131085392d53f2ba6d69924de1774d1)) -* update dependency com.google.cloud:google-cloud-shared-dependencies to v0.8.6 ([b1c5afd](https://www.github.com/googleapis/java-iot/commit/b1c5afd9af67df7f8509540fcb366ccdbd9ec28f)) -* update dependency com.google.protobuf:protobuf-java to v3.12.0 ([#142](https://www.github.com/googleapis/java-iot/issues/142)) ([6fa8924](https://www.github.com/googleapis/java-iot/commit/6fa892490fb8b82aabe1c5d977bfd70cf179aa53)) -* update dependency com.google.protobuf:protobuf-java to v3.12.2 ([#147](https://www.github.com/googleapis/java-iot/issues/147)) ([ad04bfa](https://www.github.com/googleapis/java-iot/commit/ad04bfa78c1ad29c04ad15dca7c7b4c9938b885d)) -* update dependency io.grpc:grpc-bom to v1.29.0 ([#128](https://www.github.com/googleapis/java-iot/issues/128)) ([cafb37a](https://www.github.com/googleapis/java-iot/commit/cafb37a2a58d5b792e1896a1c08c1477eb1eda1f)) -* update dependency io.grpc:grpc-bom to v1.30.0 ([#160](https://www.github.com/googleapis/java-iot/issues/160)) ([718abd7](https://www.github.com/googleapis/java-iot/commit/718abd7c91b1a780aef4e95c04e92b1dd5bfe602)) -* update dependency org.threeten:threetenbp to v1.4.4 ([#134](https://www.github.com/googleapis/java-iot/issues/134)) ([daf9439](https://www.github.com/googleapis/java-iot/commit/daf94390aaad11c2c4160488b94d4e5ce20069b7)) - -### [1.0.2](https://www.github.com/googleapis/java-iot/compare/v1.0.1...v1.0.2) (2020-04-17) - - -### Dependencies - -* update dependency com.google.guava:guava-bom to v29 ([#111](https://www.github.com/googleapis/java-iot/issues/111)) ([dbf82b1](https://www.github.com/googleapis/java-iot/commit/dbf82b14cccab8bf59555fe8b5dca9ccf66a0860)) - -### [1.0.1](https://www.github.com/googleapis/java-iot/compare/v1.0.0...v1.0.1) (2020-04-07) - - -### Dependencies - -* update core dependencies ([#85](https://www.github.com/googleapis/java-iot/issues/85)) ([c9ab329](https://www.github.com/googleapis/java-iot/commit/c9ab3290f357f136f9aa4f50b9c31dad8492c7a2)) -* update dependency com.google.api:api-common to v1.9.0 ([#95](https://www.github.com/googleapis/java-iot/issues/95)) ([bcbce5c](https://www.github.com/googleapis/java-iot/commit/bcbce5c4c0ae318dc0723f2a6e72284ba62c1055)) -* update dependency com.google.cloud:google-cloud-core to v1.93.4 ([#104](https://www.github.com/googleapis/java-iot/issues/104)) ([2769135](https://www.github.com/googleapis/java-iot/commit/2769135a7ac9d57d702dd332d14babd7a75d15f5)) -* update dependency com.google.cloud.samples:shared-configuration to v1.0.13 ([#94](https://www.github.com/googleapis/java-iot/issues/94)) ([9a8d54d](https://www.github.com/googleapis/java-iot/commit/9a8d54dd36319642a36f6a50d3739b1335d8a939)) -* update dependency org.threeten:threetenbp to v1.4.3 ([#91](https://www.github.com/googleapis/java-iot/issues/91)) ([d41fc82](https://www.github.com/googleapis/java-iot/commit/d41fc8267dd59020b3de34d47f1eaeae928b9209)) - -## [1.0.0](https://www.github.com/googleapis/java-iot/compare/v0.117.1...v1.0.0) (2020-03-03) - - -### Features - -* promote to GA ([#78](https://www.github.com/googleapis/java-iot/issues/78)) ([5573219](https://www.github.com/googleapis/java-iot/commit/55732197b5aba712be602fb962edab8fe1a2894d)) - - -### Dependencies - -* update core dependencies to v1.54.0 ([#79](https://www.github.com/googleapis/java-iot/issues/79)) ([5f41e9f](https://www.github.com/googleapis/java-iot/commit/5f41e9f499eabb9d271b0773ae5a10f3c2413a39)) -* update dependency com.google.cloud:google-cloud-core to v1.92.5 ([c326f85](https://www.github.com/googleapis/java-iot/commit/c326f8535da3aeed6d6b55d7dca5f734ec28ce84)) -* update dependency com.google.cloud:google-cloud-core to v1.93.0 ([#81](https://www.github.com/googleapis/java-iot/issues/81)) ([fc699d3](https://www.github.com/googleapis/java-iot/commit/fc699d3bf454937c8a551cf2be79ad879169a1f4)) -* update dependency com.google.cloud:google-cloud-core to v1.93.1 ([#83](https://www.github.com/googleapis/java-iot/issues/83)) ([397933a](https://www.github.com/googleapis/java-iot/commit/397933ab7fa9cb8bd61e1718fa2e07f5ae706170)) -* update dependency com.google.protobuf:protobuf-java to v3.11.4 ([e85d455](https://www.github.com/googleapis/java-iot/commit/e85d455b308c9ddb7dfdaafbdc99899ba4862d57)) -* update dependency io.grpc:grpc-bom to v1.27.1 ([ae3471e](https://www.github.com/googleapis/java-iot/commit/ae3471eb7ccbbe9a6b83a084ca9987c038c42314)) -* update dependency io.grpc:grpc-bom to v1.27.2 ([ff82b00](https://www.github.com/googleapis/java-iot/commit/ff82b0011b061e432f76e56de34ac29798719bf6)) - - -### Documentation - -* **regen:** update sample code to set total timeout, add API client header test ([bbbc09f](https://www.github.com/googleapis/java-iot/commit/bbbc09f9472a308a84f16dd6317fe39eae8797c8)) - -### [0.117.1](https://www.github.com/googleapis/java-iot/compare/v0.117.0...v0.117.1) (2020-02-04) - - -### Dependencies - -* update core dependencies ([#41](https://www.github.com/googleapis/java-iot/issues/41)) ([8f9ffa9](https://www.github.com/googleapis/java-iot/commit/8f9ffa90245a86a947b5969cfab4c64506a8c195)) -* update core dependencies ([#56](https://www.github.com/googleapis/java-iot/issues/56)) ([7727de7](https://www.github.com/googleapis/java-iot/commit/7727de7968c141218bf167287d779e7615687578)) -* update dependency com.google.guava:guava-bom to v28.2-android ([#39](https://www.github.com/googleapis/java-iot/issues/39)) ([fe1bddc](https://www.github.com/googleapis/java-iot/commit/fe1bddc373ca7ba4754c7a9c1182ef8b9026d41a)) -* update dependency com.google.protobuf:protobuf-java to v3.11.3 ([#58](https://www.github.com/googleapis/java-iot/issues/58)) ([81a6775](https://www.github.com/googleapis/java-iot/commit/81a6775a88f0b88c2a6fc66a031c90e3d73174ae)) -* update dependency org.threeten:threetenbp to v1.4.1 ([b337cae](https://www.github.com/googleapis/java-iot/commit/b337cae09704b0451c23e01da69ce4080478c317)) - -## [0.117.0](https://www.github.com/googleapis/java-iot/compare/v0.116.0...v0.117.0) (2020-01-07) - - -### ⚠ BREAKING CHANGES - -* setIamPolicy now accepts ResourceName instead of ResourceName subtypes (#21) - -### Features - -* setIamPolicy now accepts ResourceName instead of ResourceName subtypes ([#21](https://www.github.com/googleapis/java-iot/issues/21)) ([d90614c](https://www.github.com/googleapis/java-iot/commit/d90614c9a88ac9d4e509c6905dd001f59b8d66d9)) - - -### Dependencies - -* update core dependencies ([aec8e5b](https://www.github.com/googleapis/java-iot/commit/aec8e5b855afb96d69ec875494f4be355dd4cdba)) -* update dependency com.google.protobuf:protobuf-java to v3.11.0 ([#24](https://www.github.com/googleapis/java-iot/issues/24)) ([5981edb](https://www.github.com/googleapis/java-iot/commit/5981edbb973592e90721f6fe9eb46476ad6157f4)) -* update dependency com.google.protobuf:protobuf-java to v3.11.1 ([a998d6a](https://www.github.com/googleapis/java-iot/commit/a998d6a0b23d6885a6b844947771ff79a7c9b1bc)) -* update dependency io.grpc:grpc-bom to v1.26.0 ([#32](https://www.github.com/googleapis/java-iot/issues/32)) ([fff06a9](https://www.github.com/googleapis/java-iot/commit/fff06a913811cccef1fe9555b2fea3adfe3b89f0)) - - -### Documentation - -* reference libraries-bom in docs ([#16](https://www.github.com/googleapis/java-iot/issues/16)) ([6c21666](https://www.github.com/googleapis/java-iot/commit/6c2166694a51fd4b9d0590740a852b86a97e557c)) -* **regen:** update javadocs from protoc update ([#35](https://www.github.com/googleapis/java-iot/issues/35)) ([634572b](https://www.github.com/googleapis/java-iot/commit/634572baef98d9e2d9bc5f496d015e54ab48deb5)) - -## [0.116.0](https://www.github.com/googleapis/java-iot/compare/0.115.0...v0.116.0) (2019-10-28) - - -### Features - -* make repo releasable, add parent/bom ([#1](https://www.github.com/googleapis/java-iot/issues/1)) ([6c0ce94](https://www.github.com/googleapis/java-iot/commit/6c0ce94db78bc9d7f310f677eedbcb0a5af6c576)) - - -### Dependencies - -* update dependency io.grpc:grpc-bom to v1.24.1 ([764b21a](https://www.github.com/googleapis/java-iot/commit/764b21a4d4645d515ecb724aa3a126bcbae2b6e2)) -* update gax.version to v1.49.1 ([f36d626](https://www.github.com/googleapis/java-iot/commit/f36d62623797faac6688454360a2344ebc53207d)) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 2add2547..00000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,94 +0,0 @@ - -# 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 deleted file mode 100644 index b65dd279..00000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,92 +0,0 @@ -# How to Contribute - -We'd love to accept your patches and contributions to this project. There are -just a few small guidelines you need to follow. - -## Contributor License Agreement - -Contributions to this project must be accompanied by a Contributor License -Agreement. You (or your employer) retain the copyright to your contribution; -this simply gives us permission to use and redistribute your contributions as -part of the project. Head over to to see -your current agreements on file or to sign a new one. - -You generally only need to submit a CLA once, so if you've already submitted one -(even if it was for a different project), you probably don't need to do it -again. - -## Code reviews - -All submissions, including submissions by project members, require review. We -use GitHub pull requests for this purpose. Consult -[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more -information on using pull requests. - -## Community Guidelines - -This project follows -[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). - -## Building the project - -To build, package, and run all unit tests run the command - -``` -mvn clean verify -``` - -### Running Integration tests - -To include integration tests when building the project, you need access to -a GCP Project with a valid service account. - -For instructions on how to generate a service account and corresponding -credentials JSON see: [Creating a Service Account][1]. - -Then run the following to build, package, run all unit tests and run all -integration tests. - -```bash -export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json -mvn -Penable-integration-tests clean verify -``` - -## Code Samples - -All code samples must be in compliance with the [java sample formatting guide][3]. -Code Samples must be bundled in separate Maven modules. - -The samples must be separate from the primary project for a few reasons: -1. Primary projects have a minimum Java version of Java 8 whereas samples can have - Java version of Java 11. Due to this we need the ability to - selectively exclude samples from a build run. -2. Many code samples depend on external GCP services and need - credentials to access the service. -3. Code samples are not released as Maven artifacts and must be excluded from - release builds. - -### Building - -```bash -mvn clean verify -``` - -Some samples require access to GCP services and require a service account: - -```bash -export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json -mvn clean verify -``` - -### Code Formatting - -Code in this repo is formatted with -[google-java-format](https://github.com/google/google-java-format). -To run formatting on your project, you can run: -``` -mvn com.coveo:fmt-maven-plugin:format -``` - -[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account -[2]: https://maven.apache.org/settings.html#Active_Profiles -[3]: https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md \ No newline at end of file diff --git a/LICENSE b/LICENSE index 261eeb9e..6e999024 100644 --- a/LICENSE +++ b/LICENSE @@ -2,180 +2,180 @@ 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. +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 "[]" @@ -186,16 +186,16 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] +Copyright 2022 ClearBlade 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 +Licensed under the Apache License, Version 2.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. +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md index 8a4817f8..5a3fe585 100644 --- a/README.md +++ b/README.md @@ -1,225 +1,147 @@ -# Google Cloud Internet of Things (IoT) Core Client for Java +# ClearBlade IoT Core Java Client -Java idiomatic client for [Cloud Internet of Things (IoT) Core][product-docs]. - -[![Maven][maven-version-image]][maven-version-link] -![Stability][stability-image] +Java library and samples for [ClearBlade IoT Core][product-docs]. - [Product Documentation][product-docs] -- [Client Library Documentation][javadocs] - +- [Client Library Documentation][javasdk] +- [Quickstart for Java][quickstart] -## Quickstart +## Supported Java versions -If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file: +Java 11 or above is required for using this client. Java 17 is the best choice for new development. -```xml - - - - com.google.cloud - libraries-bom - 26.1.2 - pom - import - - - - - - - com.google.cloud - google-cloud-iot - +# Usage -``` +You can use the Maven artifact or do a Maven local installation and setup. -If you are using Maven without BOM, add this to your dependencies: +## Maven artifact +If you are using the Maven artifact, add the following dependency to your pom.xml file in a newly created/generated Maven app: ```xml - com.google.cloud - google-cloud-iot - 2.3.4 + io.github.clearblade + clearblade-cloud-iot + 1.0.5 - -``` - -If you are using Gradle 5.x or later, add this to your dependencies: - -```Groovy -implementation platform('com.google.cloud:libraries-bom:26.1.2') - -implementation 'com.google.cloud:google-cloud-iot' -``` -If you are using Gradle without BOM, add this to your dependencies: - -```Groovy -implementation 'com.google.cloud:google-cloud-iot:2.3.4' -``` - -If you are using SBT, add this to your dependencies: - -```Scala -libraryDependencies += "com.google.cloud" % "google-cloud-iot" % "2.3.4" ``` -## Authentication - -See the [Authentication][authentication] section in the base directory's README. - -## Authorization - -The client application making API calls must be granted [authorization scopes][auth-scopes] required for the desired Cloud Internet of Things (IoT) Core APIs, and the authenticated principal must have the [IAM role(s)][predefined-iam-roles] required to access GCP resources using the Cloud Internet of Things (IoT) Core API calls. - -## Getting Started - -### Prerequisites - -You will need a [Google Cloud Platform Console][developer-console] project with the Cloud Internet of Things (IoT) Core [API enabled][enable-api]. -You will need to [enable billing][enable-billing] to use Google Cloud Internet of Things (IoT) Core. -[Follow these instructions][create-project] to get your project set up. You will also need to set up the local development environment by -[installing the Google Cloud SDK][cloud-sdk] and running the following commands in command line: -`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. - -### Installation and setup +## Local installation and setup -You'll need to obtain the `google-cloud-iot` library. See the [Quickstart](#quickstart) section -to add `google-cloud-iot` as a dependency in your code. +For Maven local installation: -## About Cloud Internet of Things (IoT) Core +In the [clearblade-cloud-iot](./clearblade-cloud-iot) folder, run the following command to install the libraries and build the Maven sample: + mvn clean install -[Cloud Internet of Things (IoT) Core][product-docs] is a complete set of tools to connect, process, store, and analyze data both at the edge and in the cloud. The platform consists of scalable, fully-managed cloud services; an integrated software stack for edge/on-premises computing with machine learning capabilities for all your IoT needs. - -See the [Cloud Internet of Things (IoT) Core client library docs][javadocs] to learn how to -use this Cloud Internet of Things (IoT) Core Client Library. - - - - - - -## Troubleshooting - -To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. - -## Transport - -Cloud Internet of Things (IoT) Core uses gRPC for the transport layer. - -## Supported Java Versions - -Java 8 or above is required for using this client. - -Google's Java client libraries, -[Google Cloud Client Libraries][cloudlibs] -and -[Google Cloud API Libraries][apilibs], -follow the -[Oracle Java SE support roadmap][oracle] -(see the Oracle Java SE Product Releases section). - -### For new development - -In general, new feature development occurs with support for the lowest Java -LTS version covered by Oracle's Premier Support (which typically lasts 5 years -from initial General Availability). If the minimum required JVM for a given -library is changed, it is accompanied by a [semver][semver] major release. - -Java 11 and (in September 2021) Java 17 are the best choices for new -development. +## Quickstart -### Keeping production systems current +1. From the [ClearBlade Migration from Google IoT Core section](https://clearblade.atlassian.net/wiki/spaces/IC/pages/2202664969/Migration+from+Google+IoT+Core) + migrate your existing Google IoT Core registries and devices into ClearBlade IoT Core or use the ClearBlade IoT Core Console, [create a device registry and devices](https://clearblade.atlassian.net/wiki/spaces/IC/pages/2202206388/Creating+registries+and+devices). -Google tests its client libraries with all current LTS versions covered by -Oracle's Extended Support (which typically lasts 8 years from initial -General Availability). +2. [Add service accounts to a project](https://clearblade.atlassian.net/wiki/spaces/IC/pages/2240675843/Add+service+accounts+to+a+project) and download the JSON file with your service account’s credentials. -#### Legacy support +3. Use the following to set your environment variables keys in your terminal or IDE environment configurations: -Google's client libraries support legacy versions of Java runtimes with long -term stable libraries that don't receive feature updates on a best efforts basis -as it may not be possible to backport all patches. + ``` + export CLEARBLADE_CONFIGURATION=/path/to/file.json + ``` -Google provides updates on a best efforts basis to apps that continue to use -Java 7, though apps might need to upgrade to current versions of the library -that supports their JVM. + Optional -#### Where to find specific information + ``` + export CLEARBLADE_REGISTRY=[your-registry] + export CLEARBLADE_REGION=[your-region] + export BINARYDATA_AND_TIME_GOOGLE_FORMAT=true + ``` -The latest versions and the supported Java versions are identified on -the individual GitHub repository `github.com/GoogleAPIs/java-SERVICENAME` -and on [google-cloud-java][g-c-j]. +4. Use the HTTP or MQTT samples in the [samples](./clearblade-cloud-iot/samples) folder. -## Versioning +## ClearBlade IoT Core Java samples +The sample apps demonstrate registry and device creation for ClearBlade IoT Core. The [samples](./clearblade-cloud-iot/samples) folder contains all the Java samples demonstrating an overview of the ClearBlade IoT Core Platform. -This library follows [Semantic Versioning](http://semver.org/). +Before running the sample, you must configure your development environment and terminal as described in the Quickstart above or the [samples](./clearblade-cloud-iot/samples) folder. +Before running the samples, you must set the `CLEARBLADE_CONFIGURATION`. Optionally, set the `CLEARBLADE_REGISTRY` and `CLEARBLADE_REGION` environment variables to avoid changing them in the sample app every time you run it. +If you set the `BINARYDATA_AND_TIME_GOOGLE_FORMAT` environment variable, then it will give the binaryData object's response in binary form and time in timestamp format, which will have seconds and nanoseconds, following Google's structure. It's applicable on the get device state list and modify and device config version methods. Cast the data in the proper format. -## Contributing +``` + ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(request); + if(response != null) { + for (DeviceState element : response.getDeviceStatesList()) { + System.out.println(((ByteString)element.getBinaryData()).toByteArray()); + System.out.println(((ByteString)element.getBinaryData()).toStringUtf8()); + System.out.println(((Timestamp)element.getUpdateTime()).getSeconds()); + System.out.println(((Timestamp)element.getUpdateTime()).getNanos()); + } + } +``` +When switching to use new registries and regions, either: -Contributions to this library are always welcome and highly encouraged. +1. Update the `CLEARBLADE_REGISTRY` and `CLEARBLADE_REGION` environment variables; or +2. Change the `REGISTRY` and `REGION` variables in the sample code/app. -See [CONTRIBUTING][contributing] for more information how to get started. +## Using the client library within an example app -Please note that this project is released with a Contributor Code of Conduct. By participating in -this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more -information. +``` +public class App { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = "your-project-id"; + LOCATION = "your-region"; + REGISTRY = "your-registry"; + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncDevicesList(); + } + + public static void asyncDevicesList() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + RegistryName parent = RegistryName.of(PROJECT, LOCATION, REGISTRY); + DevicesListRequest request = DevicesListRequest.Builder.newBuilder().setParent(parent.toString()) + .setGatewayListOptions(GatewayListOptions.newBuilder().setGatewayType(GatewayType.NON_GATEWAY).build()) + .setPageSize(10) + .build(); + DevicesListResponse response = deviceManagerAsyncClient.listDevices(request); +``` +## Running the sample: command line -## License +The following command summarizes the sample usage: -Apache 2.0 - See [LICENSE][license] for more information. +First, compile the sample. -## CI Status +Run registry example: -Java Version | Status ------------- | ------ -Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] -Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] -Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] -Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] + mvn exec:java \ + -Dexec.cleanupDaemonThreads=false \ + -Dexec.mainClass="com.clearblade.cloud.iot.v1.samples.createdeviceregistry.SyncCreateDeviceRegistry" \ + -DprojectName="your-project-id" \ + -Dlocation="your-region" \ + -DregistryName="your-registry" -Java is a registered trademark of Oracle and/or its affiliates. +Run device example: -[product-docs]: https://cloud.google.com/iot -[javadocs]: https://cloud.google.com/java/docs/reference/google-cloud-iot/latest/history -[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java7.svg -[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java7.html -[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java8.svg -[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java8.html -[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java8-osx.svg -[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java8-osx.html -[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java8-win.svg -[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java8-win.html -[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java11.svg -[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-iot/java11.html -[stability-image]: https://img.shields.io/badge/stability-stable-green -[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-iot.svg -[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-iot&core=gav -[authentication]: https://github.com/googleapis/google-cloud-java#authentication -[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes -[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles -[iam-policy]: https://cloud.google.com/iam/docs/overview#cloud-iam-policy -[developer-console]: https://console.developers.google.com/ -[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects -[cloud-sdk]: https://cloud.google.com/sdk/ -[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/main/troubleshooting/readme.md#troubleshooting -[contributing]: https://github.com/googleapis/java-iot/blob/main/CONTRIBUTING.md -[code-of-conduct]: https://github.com/googleapis/java-iot/blob/main/CODE_OF_CONDUCT.md#contributor-code-of-conduct -[license]: https://github.com/googleapis/java-iot/blob/main/LICENSE -[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing -[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudiot.googleapis.com -[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png + mvn exec:java \ + -Dexec.cleanupDaemonThreads=false \ + -Dexec.mainClass="com.clearblade.cloud.iot.v1.samples.createdevice.AsyncCreateDevice" \ + -DprojectName="your-project-id" \ + -Dlocation="your-region" \ + -DregistryName="your-registry" \ + -DdeviceName="your-device-id" \ -[semver]: https://semver.org/ -[cloudlibs]: https://cloud.google.com/apis/docs/client-libraries-explained -[apilibs]: https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries -[oracle]: https://www.oracle.com/java/technologies/java-se-support-roadmap.html -[g-c-j]: http://github.com/googleapis/google-cloud-java +[product-docs]: https://clearblade.atlassian.net/wiki/spaces/IC/overview +[javasdk]: https://clearblade.atlassian.net/wiki/spaces/IC/pages/2231173185/Java +[quickstart]: https://clearblade.atlassian.net/wiki/spaces/IC/pages/2352611329/Java+SDK+quick+start diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 8b58ae9c..00000000 --- a/SECURITY.md +++ /dev/null @@ -1,7 +0,0 @@ -# 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/clearblade-cloud-iot/CHANGELOG.md b/clearblade-cloud-iot/CHANGELOG.md new file mode 100644 index 00000000..44822973 --- /dev/null +++ b/clearblade-cloud-iot/CHANGELOG.md @@ -0,0 +1,59 @@ +# Changelog + +## 1.0.6 +- Added environment variables to improve performance as the REST call can be prevented by passing the API keys as environment variables. + +## 1.0.5 +- Added interface for DeviceManagerClient + +## 1.0.4 +- Added fieldMask parameter in ListDeviceRegistriesRequest +- Updated fieldMask to support URL encoding + +## 1.0.3 +- Support % in character in device ID + +## 1.0.2 + +- Replace URL string with URLEncoded to support % in a device name. + +## 1.0.1 + +- Convert URL string to URLEncoded to support % in a device name. + +## 1.0.0 + +- Updated UpdateDeviceRequest, to set name as DeviceName instead of only device_id. See below example, + UpdateDeviceRequest.Builder.newBuilder().setName(**DeviceName.of(PROJECT,LOCATION,REGISTRY,DEVICE).toString()**).setDevice(device.build()) +- Removed static variables from ConfigParameters and its dependency. +- Updated CreateDeviceRequest.java to support parent as String instead of RegistryName. See below example, + +CreateDeviceRequest.Builder.newBuilder()**.setParent(RegistryName.of(PROJECT, LOCATION, REGISTRY).toString())**.setDevice(device).build(); + +## 0.1.5 + +- Minor fixes + +## 0.1.4 + +- Minor fixes + +## 0.1.3 + +- Minor fixes + +## 0.1.2 + +- Minor fixes + +## 0.1.1 + +- Minor fixes + +## 0.1.0 + +- Minor fixes + +## 0.0.1 + +- Initial release of clearblade-cloud-iot diff --git a/clearblade-cloud-iot/pom.xml b/clearblade-cloud-iot/pom.xml new file mode 100644 index 00000000..d0c0928e --- /dev/null +++ b/clearblade-cloud-iot/pom.xml @@ -0,0 +1,213 @@ + + 4.0.0 + + io.github.clearblade + clearblade-cloud-iot + 1.0.7 + jar + + Java Client Library for ClearBlade IoT Core + ClearBlade Java SDK allows for rapid development of ClearBlade IoT Core clients. + https://github.com/ClearBlade/java-iot + + + + The Apache License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + + + + + + ClearBlade Inc. + maro@clearblade.com + ClearBlade + http://www.clearblade.com + + + + + scm:git:git://github.com/ClearBlade/java-iot.git + scm:git:ssh://github.com:ClearBlade/java-iot.git + https://github.com/ClearBlade/java-iot + + + + + java8-doclint-disabled + + [11,17) + + + -Xdoclint:none + + + + + + src + + + org.apache.maven.plugins + maven-compiler-plugin + 3.10.1 + + 11 + 11 + + + + org.sonatype.central + central-publishing-maven-plugin + 0.7.0 + true + + central + true + published + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + generate-sources + + add-source + + + + samples + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.3.0 + + + copy-dependencies + package + + copy-dependencies + + + ./target + false + true + true + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.4.0 + + java + + + + io.github.clearblade + clearblade-cloud-iot + 0.0.1 + jar + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.1 + + + attach-javadocs + + jar + + + none + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + + org.junit.jupiter + junit-jupiter-api + 5.8.2 + test + + + + org.junit.jupiter + junit-jupiter-engine + 5.8.2 + test + + + + com.google.code.findbugs + jsr305 + 3.0.2 + + + com.google.guava + guava + 31.1-jre + + + org.junit.jupiter + junit-jupiter-api + 5.8.2 + compile + + + \ No newline at end of file diff --git a/clearblade-cloud-iot/samples/README.md b/clearblade-cloud-iot/samples/README.md new file mode 100644 index 00000000..c99ef69b --- /dev/null +++ b/clearblade-cloud-iot/samples/README.md @@ -0,0 +1,33 @@ +# ClearBlade IoT Core Platform Java samples + +## Quickstart + +1. Migrate your Google IoT Core registries and devices into ClearBlade IoT Core from the [ClearBlade Migration from Google IoT Core section](https://clearblade.atlassian.net/wiki/spaces/IC/pages/2202664969/Migration+from+Google+IoT+Core) or + [Creating registries and devices section](https://clearblade.atlassian.net/wiki/spaces/IC/pages/2202206388/Creating+registries+and+devices). + +2. [Add service accounts to a project](https://clearblade.atlassian.net/wiki/spaces/IC/pages/2240675843/Add+service+accounts+to+a+project) and download the JSON file with your service + account’s credentials. + +3. Use the following to set your environment variables keys: + + ``` + export CLEARBLADE_CONFIGURATION=/path/to/configuration_file.json + + ``` + + Optional + + ``` + export CLEARBLADE_REGISTRY=[your-registry] + export CLEARBLADE_REGION=[your-region] + ``` + +## Note about performance: + +By default, calls to some SDK functions cause a REST request to be sent to acquire the registry API keys found on the IoTCore UI Registry Details page. Those keys are cached for subsequent operations to improve performance. However, these caches do not persist if the application is stopped and restarted, as would be the case with typical serverless functions (e.g., Google Cloud Functions, AWS Lambda, etc.). To improve those functions' performance, the REST call can be prevented by passing the API keys as environment variables: + + ``` + REGISTRY_URL: string + REGISTRY_SYSKEY: string + REGISTRY_TOKEN: string + ``` diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/binddevicetogateway/AsyncBindDeviceToGateway.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/binddevicetogateway/AsyncBindDeviceToGateway.java new file mode 100644 index 00000000..3d038a7e --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/binddevicetogateway/AsyncBindDeviceToGateway.java @@ -0,0 +1,74 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.binddevicetogateway; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayResponse; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncBindDeviceToGateway { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String GATEWAY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + GATEWAY = System.getProperty("gatewayName"); + DEVICE = System.getProperty("deviceName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncBindDeviceToGateway(); + } + + public static void asyncBindDeviceToGateway() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + BindDeviceToGatewayRequest request = BindDeviceToGatewayRequest.Builder.newBuilder() + .setParent(RegistryName.of(PROJECT, LOCATION, REGISTRY).toString()) + .setGateway(GATEWAY).setDevice(DEVICE).build(); + BindDeviceToGatewayResponse response = deviceManagerAsyncClient.bindDeviceToGateway(request); + if(response != null) { + System.out.println("BindDeviceToGateway execution successful"); + }else { + System.out.println("BindDeviceToGateway execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/binddevicetogateway/SyncBindDeviceToGateway.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/binddevicetogateway/SyncBindDeviceToGateway.java new file mode 100644 index 00000000..39f35775 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/binddevicetogateway/SyncBindDeviceToGateway.java @@ -0,0 +1,74 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.binddevicetogateway; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayResponse; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncBindDeviceToGateway { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String GATEWAY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + GATEWAY = System.getProperty("gatewayName"); + DEVICE = System.getProperty("deviceName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncBindDeviceToGateway(); + } + + public static void syncBindDeviceToGateway() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + BindDeviceToGatewayRequest request = BindDeviceToGatewayRequest.Builder.newBuilder() + .setParent(RegistryName.of(PROJECT, LOCATION, REGISTRY).toString()) + .setGateway(GATEWAY).setDevice(DEVICE).build(); + BindDeviceToGatewayResponse response = deviceManagerClient.bindDeviceToGateway(request); + if(response != null) { + System.out.println("BindDeviceToGateway execution successful"); + }else { + System.out.println("BindDeviceToGateway execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdevice/AsyncCreateDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdevice/AsyncCreateDevice.java new file mode 100644 index 00000000..07619383 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdevice/AsyncCreateDevice.java @@ -0,0 +1,126 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.createdevice; + +import java.awt.Taskbar.State; +import java.sql.Time; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceCredential; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceState; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayAuthMethod; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayConfig; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayType; +import com.clearblade.cloud.iot.v1.devicetypes.Status; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.registrytypes.PublicKeyCredential; +import com.clearblade.cloud.iot.v1.registrytypes.PublicKeyFormat; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import com.clearblade.cloud.iot.v1.utils.LogLevel; + +public class AsyncCreateDevice { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String NUMID = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + NUMID = System.getProperty("numId"); + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncCreateDevice(); + } + + public static void asyncCreateDevice() { + String TEST_KEYVAL = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5P0Z4OUD5PSjri8xexGo\n6eQ39NGyQbXamIgWAwvnAs/oDRVqEejE2nwDhnpykaCGLkuDEN0LPd2wF+vC2Cq3\nY3YvkJh71IkjuAjMZQ+00CXdezfCjmTtEpMCNA3cV+G1g6uIcdEpHKs0YHfC9CFQ\nrjkc7tl3idmcQLngIov/gsFY7D1pbOgkCVVcZCRLgsdFfhCUYwYCvdEVJP3w+5mG\nybvmhNRbbFG7eG3+hmZoOg0h3f6r2fqgSx6l0+Z3D77SRT6lBEHvGDlxb08ASeuE\n0SJAc6PdAKd3FDqdZok4z1qJsgMqtU/ZGJJG54pNECWmhoOar+aQmmqnZ6kGQ5cn\nEwIDAQAB\n-----END PUBLIC KEY-----\n"; + + PublicKeyCredential publicKeyCredential = new PublicKeyCredential(); + publicKeyCredential.setKey(TEST_KEYVAL); + publicKeyCredential.setFormat(PublicKeyFormat.ES256_PEM); + + DeviceCredential devCredential = new DeviceCredential(); + devCredential.setPublicKey(publicKeyCredential); + + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + + RegistryName parent = RegistryName.of(PROJECT, LOCATION, REGISTRY); + GatewayConfig gatewayCfg = new GatewayConfig(); + gatewayCfg.setGatewayAuthMethod(GatewayAuthMethod.GATEWAY_AUTH_METHOD_UNSPECIFIED); + gatewayCfg.setGatewayType(GatewayType.NON_GATEWAY); + + Status status = new Status(); + status.setCode(200); + status.setMessage("Test status"); + + DeviceConfig deviceConfig = new DeviceConfig(); + deviceConfig.setVersion("1"); + deviceConfig.setBinaryData("VGVzdGluZw=="); + + HashMap metadata = new HashMap<>(); + metadata.put("test_key", "test_value"); + + DeviceState deviceState = new DeviceState(); + deviceState.setBinaryData("VGVzdGluZw=="); + deviceState.setUpdateTime(String.valueOf(System.currentTimeMillis())); + + Device device = Device.newBuilder().setId(DEVICE).setNumId(NUMID).setBlocked(false).setGatewayConfig(gatewayCfg) + .setLogLevel(LogLevel.ERROR).setCredentials(List.of(devCredential)).setConfig(deviceConfig) + .setMetadata(metadata).build(); + + CreateDeviceRequest request = CreateDeviceRequest.Builder.newBuilder().setParent(parent.toString()).setDevice(device) + .build(); + Device response = null; + try { + response = deviceManagerAsyncClient.createDevice(request); + } catch (ApplicationException e) { + // TODO: handle exception + e.printStackTrace(); + System.out.println(e.getMessage()); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdevice/SyncCreateDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdevice/SyncCreateDevice.java new file mode 100644 index 00000000..00469f33 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdevice/SyncCreateDevice.java @@ -0,0 +1,96 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.createdevice; + +import java.util.ArrayList; +import java.util.HashMap; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayConfig; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayType; +import com.clearblade.cloud.iot.v1.devicetypes.Status; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import com.clearblade.cloud.iot.v1.utils.LogLevel; + +public class SyncCreateDevice { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String NUMID = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args){ + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + NUMID = System.getProperty("numId"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncCreateDevice(); + } + + public static void syncCreateDevice() { + + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + RegistryName parent = RegistryName.of(PROJECT,LOCATION, REGISTRY); + GatewayConfig gatewayCfg = new GatewayConfig(); + gatewayCfg.setGatewayType(GatewayType.GATEWAY); + Device device = Device.newBuilder() + .setId(DEVICE).setName(DEVICE) + .setNumId(NUMID).setBlocked(false) + .setGatewayConfig(gatewayCfg) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + CreateDeviceRequest request = CreateDeviceRequest.Builder.newBuilder().setParent(parent.toString()).setDevice(device) + .build(); + Device response = deviceManagerClient.createDevice(request); + if(response != null) { + System.out.println("CreateDevice execution successful"); + }else { + System.out.println("CreateDevice execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdeviceregistry/AsyncCreateDeviceRegistry.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdeviceregistry/AsyncCreateDeviceRegistry.java new file mode 100644 index 00000000..9b56608e --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdeviceregistry/AsyncCreateDeviceRegistry.java @@ -0,0 +1,73 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.createdeviceregistry; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.createdeviceregistry.CreateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncCreateDeviceRegistry { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncCreateDeviceRegistry(); + } + + public static void asyncCreateDeviceRegistry() { + DeviceManagerAsyncClient deviceManagerClient = new DeviceManagerAsyncClient(); + CreateDeviceRegistryRequest request = CreateDeviceRegistryRequest.Builder.newBuilder() + .setParent(LocationName.of(PROJECT, LOCATION).toString()) + .setDeviceRegistry(DeviceRegistry.newBuilder().setId(REGISTRY).build()).build(); + try { + DeviceRegistry response = deviceManagerClient.createDeviceRegistry(request); + System.out.print(response); + } catch (ApplicationException e) { + // TODO: handle exception + e.printStackTrace(); + } + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdeviceregistry/SyncCreateDeviceRegistry.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdeviceregistry/SyncCreateDeviceRegistry.java new file mode 100644 index 00000000..36dd3a24 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/createdeviceregistry/SyncCreateDeviceRegistry.java @@ -0,0 +1,74 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.createdeviceregistry; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.createdeviceregistry.CreateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncCreateDeviceRegistry { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncCreateDeviceRegistry(); + } + + public static void syncCreateDeviceRegistry() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + CreateDeviceRegistryRequest request = CreateDeviceRegistryRequest.Builder.newBuilder() + .setParent(LocationName.of(PROJECT, LOCATION).toString()) + .setDeviceRegistry( + DeviceRegistry.newBuilder().setId(REGISTRY).build()) + .build(); + DeviceRegistry response = deviceManagerClient.createDeviceRegistry(request); + if(response != null) { + System.out.println("CreateDeviceRegistry execution successful"); + }else { + System.out.println("CreateDeviceRegistry execution failed"); + } + + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedevice/AsyncDeleteDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedevice/AsyncDeleteDevice.java new file mode 100644 index 00000000..cd83e209 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedevice/AsyncDeleteDevice.java @@ -0,0 +1,72 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.deletedevice; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncDeleteDevice { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncDeleteDevice(); + } + + public static void asyncDeleteDevice() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + DeviceName deviceName = DeviceName.of(PROJECT, LOCATION, REGISTRY, DEVICE); + DeleteDeviceRequest request = DeleteDeviceRequest.Builder.newBuilder().setName(deviceName).build(); + try { + deviceManagerAsyncClient.deleteDevice(request); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedevice/SyncDeleteDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedevice/SyncDeleteDevice.java new file mode 100644 index 00000000..e6f5f019 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedevice/SyncDeleteDevice.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.deletedevice; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncDeleteDevice { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncDeleteDevice(); + } + + public static void syncDeleteDevice() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + DeviceName deviceName = DeviceName.of(PROJECT, LOCATION, REGISTRY, DEVICE); + DeleteDeviceRequest request = DeleteDeviceRequest.Builder.newBuilder().setName(deviceName).build(); + deviceManagerClient.deleteDevice(request); + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedeviceregistry/AsyncDeleteDeviceRegistry.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedeviceregistry/AsyncDeleteDeviceRegistry.java new file mode 100644 index 00000000..6235c606 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedeviceregistry/AsyncDeleteDeviceRegistry.java @@ -0,0 +1,72 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.deletedeviceregistry; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.deletedeviceregistry.DeleteDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncDeleteDeviceRegistry { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) throws Exception { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncDeleteDeviceRegistry(); + } + + public static void asyncDeleteDeviceRegistry() throws Exception { + + DeviceManagerAsyncClient deviceManagerClient = new DeviceManagerAsyncClient(); + DeleteDeviceRegistryRequest request = DeleteDeviceRegistryRequest.Builder.newBuilder() + .setName(RegistryName.of(PROJECT, LOCATION, REGISTRY).getRegistryFullName()).build(); + try { + deviceManagerClient.deleteDeviceRegistry(request); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + System.out.print(e.getMessage()); + } + } + +} \ No newline at end of file diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedeviceregistry/SyncDeleteDeviceRegistry.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedeviceregistry/SyncDeleteDeviceRegistry.java new file mode 100644 index 00000000..dc370435 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deletedeviceregistry/SyncDeleteDeviceRegistry.java @@ -0,0 +1,67 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.deletedeviceregistry; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.deletedeviceregistry.DeleteDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncDeleteDeviceRegistry { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) throws Exception { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncDeleteDeviceRegistry(); + } + + public static void syncDeleteDeviceRegistry() throws Exception { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + DeleteDeviceRegistryRequest request = DeleteDeviceRegistryRequest.Builder.newBuilder() + .setName(RegistryName.of(PROJECT,LOCATION,REGISTRY) + .getRegistryFullName()) + .build(); + deviceManagerClient.deleteDeviceRegistry(request); + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deviceslist/AsyncDevicesList.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deviceslist/AsyncDevicesList.java new file mode 100644 index 00000000..c7c8f909 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deviceslist/AsyncDevicesList.java @@ -0,0 +1,83 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.deviceslist; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListResponse; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayListOptions; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayType; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncDevicesList { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncDevicesList(); + } + + public static void asyncDevicesList() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + RegistryName parent = RegistryName.of(PROJECT, LOCATION, REGISTRY); + DevicesListRequest request = DevicesListRequest.Builder.newBuilder().setParent(parent.toString()) + .setGatewayListOptions(GatewayListOptions.newBuilder().setGatewayType(GatewayType.NON_GATEWAY).build()) + .setPageSize(2) + .build(); + DevicesListResponse response = deviceManagerAsyncClient.listDevices(request); + + if(response != null) { + System.out.println("DeviceList fetch successful"); + for (Device element : response.getDevicesList()) { + System.out.println(element.toBuilder().getName()); + + } + System.out.println(response.getNextPageToken()); + + }else { + System.out.println("DeviceList fetch failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deviceslist/SyncDevicesList.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deviceslist/SyncDevicesList.java new file mode 100644 index 00000000..2e6171ab --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/deviceslist/SyncDevicesList.java @@ -0,0 +1,84 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.deviceslist; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListResponse; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayListOptions; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayType; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncDevicesList { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncDevicesList(); + } + + public static void syncDevicesList() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + RegistryName parent = RegistryName.of(PROJECT, LOCATION, REGISTRY); + DevicesListRequest request = DevicesListRequest.Builder.newBuilder().setParent(parent.toString()) + .setGatewayListOptions(GatewayListOptions.newBuilder().setGatewayType(GatewayType.NON_GATEWAY).build()) + .setPageSize(2) + .build(); + DevicesListResponse response = deviceManagerClient.listDevices(request); + + if(response != null) { + System.out.println("DeviceList fetch successful"); + for (Device element : response.getDevicesList()) { + System.out.println(element.toBuilder().getName()); + + } + System.out.println(response.getNextPageToken()); + + }else { + System.out.println("DeviceList fetch failed"); + } + + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/devicestateslist/AsyncDeviceStatesList.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/devicestateslist/AsyncDeviceStatesList.java new file mode 100644 index 00000000..9a32f47e --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/devicestateslist/AsyncDeviceStatesList.java @@ -0,0 +1,82 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.devicestateslist; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesRequest; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesResponse; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceState; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncDeviceStatesList { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncDeviceStatesList(); + } + + public static void asyncDeviceStatesList() { + DeviceManagerAsyncClient deviceManagerClient = new DeviceManagerAsyncClient(); + + ListDeviceStatesRequest request = ListDeviceStatesRequest.Builder.newBuilder().setName(DeviceName + .of(PROJECT, LOCATION, REGISTRY, DEVICE) + .toString()).setNumStates(1643330779).build(); + ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(request); + + if(response != null) { + System.out.println("DeviceStatesList fetch successful"); + for (DeviceState element : response.getDeviceStatesList()) { + System.out.println(element.toString()); + } + + }else { + System.out.println("DeviceStatesList fetch failed"); + } + + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/devicestateslist/SyncDeviceStatesList.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/devicestateslist/SyncDeviceStatesList.java new file mode 100644 index 00000000..544dc1ee --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/devicestateslist/SyncDeviceStatesList.java @@ -0,0 +1,78 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.devicestateslist; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesRequest; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesResponse; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceState; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncDeviceStatesList { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncDeviceStatesList(); + } + + public static void syncDeviceStatesList() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + + ListDeviceStatesRequest request = ListDeviceStatesRequest.Builder.newBuilder().setName(DeviceName + .of(PROJECT, LOCATION, REGISTRY, DEVICE) + .toString()).setNumStates(1643330779).build(); + ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(request); + if(response != null) { + System.out.println("DeviceStatesList fetch successful"); + for (DeviceState element : response.getDeviceStatesList()) { + System.out.println(element.toString()); + } + }else { + System.out.println("DeviceStatesList fetch failed"); + } + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdevice/AsyncGetDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdevice/AsyncGetDevice.java new file mode 100644 index 00000000..1253d271 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdevice/AsyncGetDevice.java @@ -0,0 +1,74 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.getdevice; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.devicetypes.FieldMask; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncGetDevice { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncGetDevice(); + } + + public static void asyncGetDevice() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + DeviceName name = DeviceName.of(PROJECT, LOCATION, REGISTRY, DEVICE); + GetDeviceRequest request = GetDeviceRequest.Builder.newBuilder().setName(name) + .setFieldMask(FieldMask.newBuilder().build()).build(); + try { + Device response = deviceManagerAsyncClient.getDevice(request); + System.out.print(response); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdevice/SyncGetDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdevice/SyncGetDevice.java new file mode 100644 index 00000000..50f21c6a --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdevice/SyncGetDevice.java @@ -0,0 +1,75 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.getdevice; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.devicetypes.FieldMask; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncGetDevice { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncGetDevice(); + } + + public static void syncGetDevice() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + DeviceName name = DeviceName.of(PROJECT, LOCATION, REGISTRY, DEVICE); + GetDeviceRequest request = GetDeviceRequest.Builder.newBuilder().setName(name) + .setFieldMask(FieldMask.newBuilder().build()).build(); + Device response = deviceManagerClient.getDevice(request); + if(response != null) { + System.out.println("GetDevice execution successful ::" +response.toBuilder().getName()); + + }else { + System.out.println("GetDevice execution failed"); + } + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdeviceregistry/AsyncGetDeviceRegistry.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdeviceregistry/AsyncGetDeviceRegistry.java new file mode 100644 index 00000000..4ac8d221 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdeviceregistry/AsyncGetDeviceRegistry.java @@ -0,0 +1,72 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.getdeviceregistry; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncGetDeviceRegistry { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncGetDeviceRegistry(); + } + + public static void asyncGetDeviceRegistry() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + GetDeviceRegistryRequest request = GetDeviceRegistryRequest.Builder.newBuilder() + .setName(RegistryName.of(PROJECT, LOCATION, REGISTRY).getRegistryFullName()) + .build(); + DeviceRegistry response = deviceManagerAsyncClient.getDeviceRegistry(request); + if(response != null) { + System.out.println("GetDeviceRegistry execution successful ::"+response.toBuilder().getId()); + + }else { + System.out.println("GetDeviceRegistry execution failed"); + } + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdeviceregistry/SyncGetDeviceRegistry.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdeviceregistry/SyncGetDeviceRegistry.java new file mode 100644 index 00000000..d8c77f51 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/getdeviceregistry/SyncGetDeviceRegistry.java @@ -0,0 +1,71 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.getdeviceregistry; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncGetDeviceRegistry { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncGetDeviceRegistry(); + } + + public static void syncGetDeviceRegistry() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + GetDeviceRegistryRequest request = GetDeviceRegistryRequest.Builder.newBuilder() + .setName(RegistryName.of(PROJECT, LOCATION, REGISTRY).getRegistryFullName()) + .build(); + DeviceRegistry response = deviceManagerClient.getDeviceRegistry(request); + if(response != null) { + System.out.println("GetDeviceRegistry execution successful ::"+response.toBuilder().getId()); + }else { + System.out.println("GetDeviceRegistry execution failed"); + } + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceconfigversions/AsyncListDeviceConfigVersions.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceconfigversions/AsyncListDeviceConfigVersions.java new file mode 100644 index 00000000..469b4ce0 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceconfigversions/AsyncListDeviceConfigVersions.java @@ -0,0 +1,85 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.listdeviceconfigversions; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsResponse; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncListDeviceConfigVersions { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String NUMVERSION = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + NUMVERSION = System.getProperty("numVersion"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncDevicesConfigVersionsList(); + } + + public static void asyncDevicesConfigVersionsList() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + ListDeviceConfigVersionsRequest request = ListDeviceConfigVersionsRequest.Builder.newBuilder() + .setName(DeviceName + .of(PROJECT, LOCATION, REGISTRY, DEVICE) + .toString()) + .setNumVersions(Integer.parseInt(NUMVERSION)).build(); + ListDeviceConfigVersionsResponse response = deviceManagerAsyncClient.listDeviceConfigVersions(request); + + if(response != null) { + System.out.println("DeviceConfigVersionsList fetch successful"); + for (DeviceConfig element : response.getDeviceConfigList()) { + System.out.println(element.toString()); + } + + }else { + System.out.println("DeviceConfigVersionsList fetch failed"); + } + + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceconfigversions/SyncListDeviceConfigVersions.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceconfigversions/SyncListDeviceConfigVersions.java new file mode 100644 index 00000000..20b1b8f8 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceconfigversions/SyncListDeviceConfigVersions.java @@ -0,0 +1,83 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.listdeviceconfigversions; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsResponse; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncListDeviceConfigVersions { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String NUMVERSION = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + NUMVERSION = System.getProperty("numVersion"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncDevicesConfigVersionsList(); + } + + public static void syncDevicesConfigVersionsList() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + ListDeviceConfigVersionsRequest request = ListDeviceConfigVersionsRequest.Builder.newBuilder() + .setName(DeviceName + .of(PROJECT, LOCATION, REGISTRY, DEVICE) + .toString()) + .setNumVersions(Integer.parseInt(NUMVERSION)).build(); + ListDeviceConfigVersionsResponse response = deviceManagerClient.listDeviceConfigVersions(request); + if(response != null) { + System.out.println("DeviceConfigVersionsList fetch successful"); + for (DeviceConfig element : response.getDeviceConfigList()) { + System.out.println(element.toString()); + } + + }else { + System.out.println("DeviceConfigVersionsList fetch failed"); + } + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceregistries/AsyncListDeviceRegistries.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceregistries/AsyncListDeviceRegistries.java new file mode 100644 index 00000000..1c052f94 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceregistries/AsyncListDeviceRegistries.java @@ -0,0 +1,73 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.listdeviceregistries; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesRequest; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesResponse; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncListDeviceRegistries { + public static String PROJECT = ""; + public static String LOCATION = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) throws Exception{ + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncListDeviceRegistries(); + } + + public static void asyncListDeviceRegistries() throws Exception { + DeviceManagerAsyncClient deviceManagerClient = new DeviceManagerAsyncClient(); + ListDeviceRegistriesRequest request = ListDeviceRegistriesRequest.Builder.newBuilder() + .setParent(LocationName.of(PROJECT, LOCATION).getLocationFullName()) + .build(); + ListDeviceRegistriesResponse response = deviceManagerClient.listDeviceRegistries(request); + if(response != null) { + System.out.println("DeviceRegistriesList fetch successful"); + for (DeviceRegistry element : response.getDeviceRegistriesList()) { + System.out.println(element.toBuilder().getName()); + } + System.out.println(response.getNextPageToken()); + + }else { + System.out.println("DeviceRegistriesList fetch failed"); + } + + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceregistries/SyncListDeviceRegistries.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceregistries/SyncListDeviceRegistries.java new file mode 100644 index 00000000..cfee2f5f --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/listdeviceregistries/SyncListDeviceRegistries.java @@ -0,0 +1,72 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.listdeviceregistries; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesRequest; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesResponse; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncListDeviceRegistries { + public static String PROJECT = ""; + public static String LOCATION = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) throws Exception{ + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncListDeviceRegistries(); + } + + public static void syncListDeviceRegistries() throws Exception { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + ListDeviceRegistriesRequest request = ListDeviceRegistriesRequest.Builder.newBuilder() + .setParent(LocationName.of(PROJECT,LOCATION).getLocationFullName()) + .build(); + ListDeviceRegistriesResponse response = deviceManagerClient.listDeviceRegistries(request); + + if(response != null) { + System.out.println("DeviceRegistriesList fetch successful"); + for (DeviceRegistry element : response.getDeviceRegistriesList()) { + System.out.println(element.toBuilder().getName()); + } + System.out.println(response.getNextPageToken()); + + }else { + System.out.println("DeviceRegistriesList fetch failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/modifycloudtodeviceconfig/AsyncModifyCloudToDeviceConfig.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/modifycloudtodeviceconfig/AsyncModifyCloudToDeviceConfig.java new file mode 100644 index 00000000..7bebefb7 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/modifycloudtodeviceconfig/AsyncModifyCloudToDeviceConfig.java @@ -0,0 +1,78 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.modifycloudtodeviceconfig; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig.ModifyCloudToDeviceConfigRequest; +import com.clearblade.cloud.iot.v1.utils.ByteString; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncModifyCloudToDeviceConfig { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String BINARYDATA = ""; + public static String VERSIONTOUPDATE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + BINARYDATA = System.getProperty("binaryData"); + VERSIONTOUPDATE = System.getProperty("versionToUpdate"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncModifyCloudToDeviceConfig(); + } + + public static void asyncModifyCloudToDeviceConfig() { + DeviceManagerAsyncClient deviceManagerClient = new DeviceManagerAsyncClient(); + ModifyCloudToDeviceConfigRequest request = ModifyCloudToDeviceConfigRequest.Builder.newBuilder() + .setName(DeviceName.of(PROJECT,LOCATION, REGISTRY, DEVICE).toString()) + .setBinaryData(new ByteString(BINARYDATA)).setVersionToUpdate(VERSIONTOUPDATE).build(); + DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(request); + if(response != null) { + System.out.println("ModifyDeviceToConfig execution successful"); + }else { + System.out.println("ModifyDeviceToConfig execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfig.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfig.java new file mode 100644 index 00000000..c6a78150 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfig.java @@ -0,0 +1,78 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.modifycloudtodeviceconfig; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig.ModifyCloudToDeviceConfigRequest; +import com.clearblade.cloud.iot.v1.utils.ByteString; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncModifyCloudToDeviceConfig { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String BINARYDATA = ""; + public static String VERSIONTOUPDATE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + BINARYDATA = System.getProperty("binaryData"); + VERSIONTOUPDATE = System.getProperty("versionToUpdate"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncModifyCloudToDeviceConfig(); + } + + public static void syncModifyCloudToDeviceConfig() { + + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + ModifyCloudToDeviceConfigRequest request = ModifyCloudToDeviceConfigRequest.Builder.newBuilder() + .setName(DeviceName.of(PROJECT,LOCATION, REGISTRY, DEVICE).toString()) + .setBinaryData(new ByteString(BINARYDATA)).setVersionToUpdate(VERSIONTOUPDATE).build(); + DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(request); + if(response != null) { + System.out.println("ModifyDeviceToConfig execution successful"); + }else { + System.out.println("ModifyDeviceToConfig execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/sendcommandtodevice/AsyncSendCommandToDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/sendcommandtodevice/AsyncSendCommandToDevice.java new file mode 100644 index 00000000..12744006 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/sendcommandtodevice/AsyncSendCommandToDevice.java @@ -0,0 +1,82 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.sendcommandtodevice; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceResponse; +import com.clearblade.cloud.iot.v1.utils.ByteString; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncSendCommandToDevice { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String BINARYDATA = ""; + public static String SUBFOLDER = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + BINARYDATA = System.getProperty("binaryData"); + SUBFOLDER = System.getProperty("subFolder"); + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncSendCommandToDevice(); + } + + public static void asyncSendCommandToDevice() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + SendCommandToDeviceRequest request = SendCommandToDeviceRequest.Builder.newBuilder() + .setName(DeviceName.of(PROJECT, LOCATION, REGISTRY, DEVICE).toString()) + .setBinaryData(new ByteString(BINARYDATA)).setSubfolder(SUBFOLDER).build(); + try { + SendCommandToDeviceResponse response = deviceManagerAsyncClient.sendCommandToDevice(request); + if (response != null) { + System.out.println("SendCommandToDevice execution successful"); + } + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + } + + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/sendcommandtodevice/SyncSendCommandToDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/sendcommandtodevice/SyncSendCommandToDevice.java new file mode 100644 index 00000000..76f9dc7e --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/sendcommandtodevice/SyncSendCommandToDevice.java @@ -0,0 +1,78 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.sendcommandtodevice; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceResponse; +import com.clearblade.cloud.iot.v1.utils.ByteString; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncSendCommandToDevice { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String BINARYDATA = ""; + public static String SUBFOLDER = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + BINARYDATA = System.getProperty("binaryData"); + SUBFOLDER = System.getProperty("subFolder"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncSendCommandToDevice(); + } + + public static void syncSendCommandToDevice() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + SendCommandToDeviceRequest request = SendCommandToDeviceRequest.Builder.newBuilder() + .setName(DeviceName.of(PROJECT, LOCATION, REGISTRY, DEVICE).toString()) + .setBinaryData(new ByteString(BINARYDATA)).setSubfolder(SUBFOLDER).build(); + SendCommandToDeviceResponse response = deviceManagerClient.sendCommandToDevice(request); + if(response != null) { + System.out.println("SendCommandToDevice execution successful"); + }else { + System.out.println("SendCommandToDevice execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/unbinddevicefromgateway/AsyncUnbindDeviceFromGateway.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/unbinddevicefromgateway/AsyncUnbindDeviceFromGateway.java new file mode 100644 index 00000000..a86dff99 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/unbinddevicefromgateway/AsyncUnbindDeviceFromGateway.java @@ -0,0 +1,76 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.unbinddevicefromgateway; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayResponse; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class AsyncUnbindDeviceFromGateway { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String GATEWAY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + GATEWAY = System.getProperty("gatewayName"); + DEVICE = System.getProperty("deviceName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncUnbindDeviceFromGateway(); + } + + public static void asyncUnbindDeviceFromGateway() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + UnbindDeviceFromGatewayRequest request = UnbindDeviceFromGatewayRequest.Builder.newBuilder() + .setParent(RegistryName.of(PROJECT, LOCATION, REGISTRY).toString()) + .setGateway(GATEWAY).setDevice(DEVICE).build(); + + UnbindDeviceFromGatewayResponse response = deviceManagerAsyncClient.unbindDeviceFromGateway(request); + if(response != null) { + System.out.println("UnbindDeviceFromGateway execution successful"); + }else { + System.out.println("UnbindDeviceFromGateway execution failed"); + } + + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/unbinddevicefromgateway/SyncUnbindDeviceFromGateway.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/unbinddevicefromgateway/SyncUnbindDeviceFromGateway.java new file mode 100644 index 00000000..756b5795 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/unbinddevicefromgateway/SyncUnbindDeviceFromGateway.java @@ -0,0 +1,75 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.unbinddevicefromgateway; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayResponse; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class SyncUnbindDeviceFromGateway { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String GATEWAY = ""; + public static String DEVICE = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + GATEWAY = System.getProperty("gatewayName"); + DEVICE = System.getProperty("deviceName"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncUnbindDeviceFromGateway(); + } + + public static void syncUnbindDeviceFromGateway() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + UnbindDeviceFromGatewayRequest request = UnbindDeviceFromGatewayRequest.Builder.newBuilder() + .setParent(RegistryName.of(PROJECT, LOCATION, REGISTRY).toString()) + .setGateway(GATEWAY).setDevice(DEVICE).build(); + + UnbindDeviceFromGatewayResponse response = deviceManagerClient.unbindDeviceFromGateway(request); + if(response != null) { + System.out.println("UnbindDeviceFromGateway execution successful"); + }else { + System.out.println("UnbindDeviceFromGateway execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedevice/AsyncUpdateDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedevice/AsyncUpdateDevice.java new file mode 100644 index 00000000..c5b1ec02 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedevice/AsyncUpdateDevice.java @@ -0,0 +1,122 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.updatedevice; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.Device.Builder; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceCredential; +import com.clearblade.cloud.iot.v1.registrytypes.PublicKeyCredential; +import com.clearblade.cloud.iot.v1.registrytypes.PublicKeyFormat; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import com.clearblade.cloud.iot.v1.utils.LogLevel; + +public class AsyncUpdateDevice { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String UPDATEMASK = ""; + public static String ARG = ""; + public static String[] NEWARGS = null; + public static String KEYFORMAT = PublicKeyFormat.RSA_PEM.name(); + public static String KEYVAL = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + UPDATEMASK = System.getProperty("updateMask"); + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + if (!(System.getProperty("arg") == null || System.getProperty("arg").isBlank() + || System.getProperty("arg").isEmpty())) + ARG = System.getProperty("arg"); + if (System.getProperty("newArgs") != null) + NEWARGS = System.getProperty("newArgs").split(","); + if (System.getProperty("keyFormat") != null) + KEYFORMAT = System.getProperty("keyFormat"); + if (System.getProperty("keyVal") != null) + KEYVAL = System.getProperty("keyVal"); + asyncUpdateDevice(); + } + + public static void asyncUpdateDevice() { + DeviceManagerAsyncClient deviceManagerAsyncClient = new DeviceManagerAsyncClient(); + Builder device = Device.newBuilder().setId(DEVICE).setName(DEVICE); + if (UPDATEMASK.equals("logLevel")) { + device.setLogLevel(LogLevel.valueOf(ARG)); + } else if (UPDATEMASK.equals("blocked")) { + device.setBlocked(Boolean.valueOf(ARG)); + } else if (UPDATEMASK.equals("metadata")) { + Map metadata = new HashMap<>(); + for (int i = 0; i < NEWARGS.length; i++) { + String key = NEWARGS[i]; + String val = NEWARGS[i + 1]; + metadata.put(key, val); + } + } else if (UPDATEMASK.equals("credentials")) { + List listCredentials = new ArrayList<>(); + PublicKeyCredential publicKeyCredential = new PublicKeyCredential(); + publicKeyCredential.setFormat(PublicKeyFormat.valueOf(KEYFORMAT)); + publicKeyCredential.setKey(KEYVAL); + DeviceCredential credential = new DeviceCredential(); + credential.setPublicKey(publicKeyCredential); + listCredentials.add(credential); + device.setCredentials(listCredentials); + } + UpdateDeviceRequest request = UpdateDeviceRequest.Builder.newBuilder().setName(DeviceName.of(PROJECT,LOCATION,REGISTRY,DEVICE).toString()).setDevice(device.build()) + .setUpdateMask(UPDATEMASK).build(); + Device response = null; + try { + response = deviceManagerAsyncClient.updateDevice(request); + System.out.println("Response: " + response); + } catch (Exception e) { + // TODO: handle exception + e.printStackTrace(); + System.out.println("Ex: " + e.getMessage()); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedevice/SyncUpdateDevice.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedevice/SyncUpdateDevice.java new file mode 100644 index 00000000..5f58c4ec --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedevice/SyncUpdateDevice.java @@ -0,0 +1,120 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.updatedevice; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceCredential; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.registrytypes.PublicKeyCredential; +import com.clearblade.cloud.iot.v1.registrytypes.PublicKeyFormat; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import com.clearblade.cloud.iot.v1.utils.LogLevel; + +public class SyncUpdateDevice { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String DEVICE = ""; + public static String UPDATEMASK = ""; + public static String ARG=""; + public static String[] NEWARGS = null; + public static String KEYFORMAT =""; + public static String KEYVAL = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + DEVICE = System.getProperty("deviceName"); + UPDATEMASK = System.getProperty("updateMask"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + if(!(System.getProperty("arg").isBlank() || System.getProperty("arg").isEmpty()|| System.getProperty("arg")==null)) + ARG = System.getProperty("arg"); + if(System.getProperty("newArgs") != null) + NEWARGS = System.getProperty("newArgs").split(","); + if(System.getProperty("keyFormat") != null) + KEYFORMAT = System.getProperty("keyFormat"); + if(System.getProperty("keyVal") != null) + KEYVAL = System.getProperty("keyVal"); + syncUpdateDevice(); + } + + public static void syncUpdateDevice() { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + + Device device = new Device(); + device.toBuilder().setId(DEVICE).setName(DEVICE).build(); + if(UPDATEMASK .equals("logLevel")) { + device.toBuilder().setLogLevel(LogLevel.valueOf(ARG)); + }else if(UPDATEMASK .equals("blocked")) { + device.toBuilder().setBlocked(Boolean.valueOf(ARG)); + }else if(UPDATEMASK .equals("metadata")) { + Map metadata = new HashMap<>(); + for(int i=0;i listCredentials = new ArrayList<>(); + PublicKeyCredential publicKeyCredential = new PublicKeyCredential(); + publicKeyCredential.setFormat(PublicKeyFormat.valueOf(KEYFORMAT)); + publicKeyCredential.setKey(KEYVAL); + DeviceCredential credential = new DeviceCredential(); + credential.setPublicKey(publicKeyCredential); + listCredentials.add(credential); + device.toBuilder().setCredentials(listCredentials); + } + + UpdateDeviceRequest request = UpdateDeviceRequest.Builder.newBuilder().setName(DeviceName.of(PROJECT,LOCATION,REGISTRY,DEVICE).toString()).setDevice(device) + .setUpdateMask(UPDATEMASK).build(); + Device response = deviceManagerClient.updateDevice(request); + if(response != null) { + System.out.println("UpdateDevice execution successful"); + }else { + System.out.println("UpdateDevice execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedeviceregistry/AsyncUpdateDeviceRegistry.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedeviceregistry/AsyncUpdateDeviceRegistry.java new file mode 100644 index 00000000..bedfdf93 --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedeviceregistry/AsyncUpdateDeviceRegistry.java @@ -0,0 +1,80 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.updatedeviceregistry; + +import com.clearblade.cloud.iot.v1.DeviceManagerAsyncClient; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import com.clearblade.cloud.iot.v1.utils.LogLevel; + +public class AsyncUpdateDeviceRegistry { + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String LOGLEVEL = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) throws Exception { + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + LOGLEVEL = System.getProperty("logLevel"); + if (REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if (LOCATION != null) { + configParameters.setRegion(LOCATION); + } + asyncUpdateDeviceRegistry(); + } + + public static void asyncUpdateDeviceRegistry() throws Exception { + DeviceManagerAsyncClient deviceManagerClient = new DeviceManagerAsyncClient(); + RegistryName name = RegistryName.of(PROJECT, LOCATION, REGISTRY); + UpdateDeviceRegistryRequest request = UpdateDeviceRegistryRequest.Builder.newBuilder() + .setDeviceRegistry(DeviceRegistry.newBuilder().setId(REGISTRY).setName(name.getRegistryFullName()) + .setLogLevel(LogLevel.valueOf(LOGLEVEL)).build()) + .setName(name.getRegistryFullName()).setUpdateMask("logLevel").build(); + try { + DeviceRegistry response = deviceManagerClient.updateDeviceRegistry(request); + if (response != null) { + System.out.println(response); + } + } catch (Exception e) { + // TODO: handle exception + System.out.println(e.getMessage()); + //e.printStackTrace(); + } + } + +} diff --git a/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedeviceregistry/SyncUpdateDeviceRegistry.java b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedeviceregistry/SyncUpdateDeviceRegistry.java new file mode 100644 index 00000000..3c5c724b --- /dev/null +++ b/clearblade-cloud-iot/samples/com/clearblade/cloud/iot/v1/samples/updatedeviceregistry/SyncUpdateDeviceRegistry.java @@ -0,0 +1,80 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.samples.updatedeviceregistry; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import com.clearblade.cloud.iot.v1.utils.LogLevel; + +public class SyncUpdateDeviceRegistry { + + public static String PROJECT = ""; + public static String LOCATION = ""; + public static String REGISTRY = ""; + public static String LOGLEVEL = ""; + static ConfigParameters configParameters = ConfigParameters.getInstance(); + + public static void main(String[] args) throws Exception{ + PROJECT = System.getProperty("projectName"); + LOCATION = System.getProperty("location"); + REGISTRY = System.getProperty("registryName"); + LOGLEVEL = System.getProperty("logLevel"); + if(REGISTRY != null) { + configParameters.setRegistry(REGISTRY); + } + if(LOCATION != null) { + configParameters.setRegion(LOCATION); + } + syncUpdateDeviceRegistry(); + } + + public static void syncUpdateDeviceRegistry() throws Exception { + DeviceManagerClient deviceManagerClient = new DeviceManagerClient(); + RegistryName name = RegistryName.of(PROJECT, LOCATION, REGISTRY); + + UpdateDeviceRegistryRequest request = UpdateDeviceRegistryRequest.Builder.newBuilder() + .setDeviceRegistry(DeviceRegistry.newBuilder().setId(REGISTRY) + .setName(name.getRegistryFullName()) + .setLogLevel(LogLevel.valueOf(LOGLEVEL)) + .build()) + .setName(name.getRegistryFullName()).setUpdateMask("logLevel").build(); + + DeviceRegistry response = deviceManagerClient.updateDeviceRegistry(request); + if(response != null) { + System.out.println("UpdateDeviceRegistry execution successful"); + }else { + System.out.println("UpdateDeviceRegistry execution failed"); + } + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/AsyncClient.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/AsyncClient.java new file mode 100644 index 00000000..1decbf56 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/AsyncClient.java @@ -0,0 +1,418 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1; + +import java.io.IOException; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpRequest.BodyPublisher; +import java.net.http.HttpRequest.BodyPublishers; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.concurrent.CompletableFuture; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesRequest; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsRequest; +import com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig.ModifyCloudToDeviceConfigRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.utils.AuthParams; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import com.clearblade.cloud.iot.v1.utils.Constants; +import org.json.simple.parser.ParseException; + +public class AsyncClient { + + static Logger log = Logger.getLogger(AsyncClient.class.getName()); + private String[] responseArray = new String[3]; + private boolean isAdmin = false; + private AuthParams authParams = new AuthParams(); + + /** + * Method used to generate URL for apicall + * + * @param apiName - path to api + * @param params - parameters to be attached to request + * @return URL formed and to be used + */ + private String generateURL(AuthParams authParams, String apiName, String params) { + + return authParams.getApiBaseURL().concat(Constants.ENDPOINTPORT).concat(Constants.WEBHOOK).concat(authParams.getUserSystemKey()).concat(apiName).concat("?" + params); + } + + /** + * Method used to generate URL for apicall + * + * @param apiName - path to api + * @param params - parameters to be attached to request + * @return URL formed and to be used + */ + private String generateAdminURL(AuthParams authParams, String apiName, String params) { + + return authParams.getBaseURL().concat(Constants.WEBHOOK).concat(authParams.getAdminSystemKey()).concat(apiName).concat("?" + params); + } + + /** + * Method used to Calls HTTP Get request + * + * @param apiName + * @return String[] containing responseCode, responseMessage and response object + * @throws IOException + * @throws ApplicationException + */ + public String[] get(String apiName, GetDeviceRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, request.toString()); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, DevicesListRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, ListDeviceStatesRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, GetDeviceRegistryRequest request) { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, ListDeviceConfigVersionsRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String finalURL, String token) { + try { + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(finalURL)).headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, token, Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE).GET().build(); + + CompletableFuture> response = HttpClient.newBuilder().build().sendAsync(request, HttpResponse.BodyHandlers.ofString()); + + HttpResponse httpResponse = response.get(); + responseArray[0] = String.valueOf(httpResponse.statusCode()); + responseArray[1] = ""; + responseArray[2] = httpResponse.body(); + + } catch (InterruptedException ex) { + log.log(Level.SEVERE, ex.getMessage()); + Thread.currentThread().interrupt(); + throw new ApplicationException(ex); + } catch (Exception ec) { + log.log(Level.SEVERE, ec.getMessage()); + throw new ApplicationException(ec); + } + return responseArray; + } + + public String[] post(String apiName, String params, String body, CreateDeviceRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, SendCommandToDeviceRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getDeviceName().getProject(), request.getDeviceName().getRegistry(), request.getDeviceName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, BindDeviceToGatewayRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, ModifyCloudToDeviceConfigRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getDeviceName().getProject(), request.getDeviceName().getRegistry(), request.getDeviceName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, UnbindDeviceFromGatewayRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + /** + * Method used to call HTTP Post request + * + * @param body + * @return String[] containing responseCode, responseMessage and response object + * @throws IOException + * @throws ApplicationException + */ + public String[] post(String finalURL, String body, String token) { + try { + BodyPublisher jsonPayload = BodyPublishers.ofString(body); + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(finalURL)).method(Constants.HTTP_REQUEST_METHOD_TYPE_POST, jsonPayload).headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, token, Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE).build(); + + CompletableFuture> response = HttpClient.newBuilder().version(HttpClient.Version.HTTP_2).connectTimeout(Duration.ofSeconds(20)).build().sendAsync(request, HttpResponse.BodyHandlers.ofString()); + + HttpResponse httpResponse = response.get(); + responseArray[0] = String.valueOf(httpResponse.statusCode()); + responseArray[1] = ""; + responseArray[2] = httpResponse.body(); + + } catch (InterruptedException ex) { + log.log(Level.SEVERE, ex.getMessage()); + Thread.currentThread().interrupt(); + throw new ApplicationException(ex); + } catch (Exception ec) { + log.log(Level.SEVERE, ec.getMessage()); + throw new ApplicationException(ec); + } + return responseArray; + + } + + public String[] delete(String apiName, String params, DeleteDeviceRequest request) throws IOException { + String finalURL = ""; + String token = ""; + if (isAdmin) { + try { + authParams.setAdminCredentials(); + } catch (Exception e) { + throw new ApplicationException(e); + } + finalURL = generateAdminURL(authParams, apiName, params); + token = authParams.getAdminToken(); + } else { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + finalURL = generateURL(authParams, apiName, params); + token = authParams.getUserToken(); + } + return delete(finalURL, token); + } + + /** + * Method used to call HTTP delete request + * + * @return String[] containing responseCode, responseMessage and response object + * @throws IOException + * @throws ApplicationException + */ + public String[] delete(String finalURL, String token) { + try { + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(finalURL)).headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, token, Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE).DELETE().build(); + + CompletableFuture> response = HttpClient.newBuilder().build().sendAsync(request, HttpResponse.BodyHandlers.ofString()); + + HttpResponse httpResponse = response.get(); + responseArray[0] = String.valueOf(httpResponse.statusCode()); + responseArray[1] = ""; + responseArray[2] = httpResponse.body(); + + } catch (InterruptedException ex) { + log.log(Level.SEVERE, ex.getMessage()); + Thread.currentThread().interrupt(); + throw new ApplicationException(ex); + } catch (Exception ec) { + log.log(Level.SEVERE, ec.getMessage()); + throw new ApplicationException(ec); + } + return responseArray; + + } + + public String[] update(String apiName, String params, String body, UpdateDeviceRegistryRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return update(finalURL, body, token); + } + + public String[] update(String apiName, String params, String body, UpdateDeviceRequest request) throws IOException, ParseException { + try { + authParams.setRegistryCredentials(request.getDeviceName().getProject(), request.getDeviceName().getRegistry(), request.getDeviceName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return update(finalURL, body, token); + } + + /** + * Method used to call HTTP Patch request + * + * @param body + * @return String[] Object containing responseCode, responseMessage and response + * object + */ + public String[] update(String finalURL, String body, String token) { + try { + BodyPublisher jsonPayload = BodyPublishers.ofString(body); + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(finalURL)).method(Constants.HTTP_REQUEST_METHOD_TYPE_PATCH, jsonPayload).headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, token, Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE).build(); + + CompletableFuture> response = HttpClient.newBuilder().build().sendAsync(request, HttpResponse.BodyHandlers.ofString()); + + HttpResponse httpResponse = response.get(); + responseArray[0] = String.valueOf(httpResponse.statusCode()); + responseArray[1] = ""; + responseArray[2] = httpResponse.body(); + + } catch (InterruptedException ex) { + log.log(Level.SEVERE, ex.getMessage()); + Thread.currentThread().interrupt(); + throw new ApplicationException(ex); + } catch (Exception ec) { + log.log(Level.SEVERE, ec.getMessage()); + throw new ApplicationException(ec); + } + + return responseArray; + } + + // Registry Apis + + public String[] asyncCreateDeviceRegistry(String apiName, String params, String body, boolean isAdmin) throws IOException { + String finalURL = ""; + String token = ""; + if (isAdmin) { + try { + authParams.setAdminCredentials(); + } catch (Exception e) { + throw new ApplicationException(e); + } + finalURL = generateAdminURL(authParams, apiName, params); + token = authParams.getAdminToken(); + } + return post(finalURL, body, token); + } + + + public String[] asyncDeleteDeviceRegistry(String apiName, String params, boolean isAdmin) throws IOException { + try { + authParams.setAdminCredentials(); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateAdminURL(authParams, apiName, params); + String token = authParams.getAdminToken(); + return this.delete(finalURL, token); + } + + + public String[] asyncListDeviceRegistries(String apiName, String params, boolean isAdmin) throws IOException { + String finalURL = ""; + String token = ""; + if (isAdmin) { + try { + authParams.setAdminCredentials(); + } catch (Exception e) { + throw new ApplicationException(e); + } + finalURL = generateAdminURL(authParams, apiName, params); + token = authParams.getAdminToken(); + } + return this.get(finalURL, token); + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/ClearBladeDeviceManager.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/ClearBladeDeviceManager.java new file mode 100644 index 00000000..3eb4262a --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/ClearBladeDeviceManager.java @@ -0,0 +1,482 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1; + +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayResponse; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListResponse; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesRequest; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesResponse; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsResponse; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesRequest; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesResponse; +import com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig.ModifyCloudToDeviceConfigRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceResponse; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayResponse; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import org.json.simple.parser.ParseException; + +public class ClearBladeDeviceManager { + static Logger log = Logger.getLogger(ClearBladeDeviceManager.class.getName()); + ConfigParameters configParameters = ConfigParameters.getInstance(); + + public Device getDevice(GetDeviceRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] responseArray = syncClient.get(configParameters.getDevicesURLExtension(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + Device device = Device.newBuilder().build(); + device.loadFromString(responseArray[2]); + return device; + } else { + throw new ApplicationException(responseArray[2]); + } + } + return null; + } + + public Device asyncGetDevice(GetDeviceRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] responseArray = asyncClient.get(configParameters.getDevicesURLExtension(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + Device device = Device.newBuilder().build(); + device.loadFromString(responseArray[2]); + return device; + } else { + throw new ApplicationException(responseArray[2]); + } + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + return null; + } + + public Device createDevice(CreateDeviceRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] params = request.getParams(); + String reqParams = params[0]; + String body = params[1]; + String[] responseArray = syncClient.post(configParameters.getDevicesURLExtension(), reqParams, body, request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + Device deviceObj = Device.newBuilder().build(); + deviceObj.loadFromString(responseArray[2]); + return deviceObj; + } else { + throw new ApplicationException(responseArray[2]); + } + } else { + throw new ApplicationException(""); + } + } + + public Device asyncCreateDevice(CreateDeviceRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] params = request.getParams(); + String reqParams = params[0]; + String body = params[1]; + String[] responseArray = asyncClient.post(configParameters.getDevicesURLExtension(), reqParams, body, request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + Device deviceObj = Device.newBuilder().build(); + deviceObj.loadFromString(responseArray[2]); + return deviceObj; + } else { + throw new ApplicationException(responseArray[2]); + } + } + return null; + } catch (Exception e) { + // TODO: handle exception + throw new ApplicationException(e.getMessage(), e); + } + } + + public void deleteDevice(DeleteDeviceRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] responseArray = syncClient.delete(configParameters.getDevicesURLExtension(), request.toString(), false, request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode != 200) { + throw new ApplicationException(responseArray[2]); + } + } else { + throw new ApplicationException(""); + } + } + + public void asyncDeleteDevice(DeleteDeviceRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] responseArray = asyncClient.delete(configParameters.getDevicesURLExtension(), request.toString(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode != 200) { + throw new ApplicationException(responseArray[2]); + } + } else { + throw new ApplicationException(""); + } + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + throw new ApplicationException(e.getMessage(), e); + } + } + + public Device updateDevice(UpdateDeviceRequest request) throws ApplicationException { + try { + SyncClient syncClient = new SyncClient(); + String[] params = request.getBodyAndParams(); + String reqParams = params[0]; + String body = params[1]; + String[] responseArray; + responseArray = syncClient.update(configParameters.getDevicesURLExtension(), reqParams, body, request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + Device deviceObj = Device.newBuilder().build(); + deviceObj.loadFromString(responseArray[2]); + return deviceObj; + } else { + throw new ApplicationException(responseArray[2]); + } + } else { + throw new ApplicationException(); + } + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + Thread.currentThread().interrupt(); + throw new ApplicationException(e.getMessage(), e); + } + } + + public Device asyncUpdateDevice(UpdateDeviceRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] params = request.getBodyAndParams(); + String reqParams = params[0]; + String body = params[1]; + String[] responseArray = asyncClient.update(configParameters.getDevicesURLExtension(), reqParams, body, request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + Device deviceObj = Device.newBuilder().build(); + deviceObj.loadFromString(responseArray[2]); + return deviceObj; + } else { + throw new ApplicationException(responseArray[2]); + } + } else { + throw new ApplicationException(responseArray[2]); + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + } + + public BindDeviceToGatewayResponse bindDeviceToGateway(BindDeviceToGatewayRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] paramBody = request.getBodyAndParams(); + String[] responseArray = syncClient.post(configParameters.getCloudiotURLExtension(), paramBody[0], paramBody[1], request); + BindDeviceToGatewayResponse response = BindDeviceToGatewayResponse.Builder.newBuilder().build(); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + response.setHttpStatusCode(Integer.parseInt(responseArray[0])); + response.setHttpStatusResponse(responseArray[1]); + } else { + throw new ApplicationException(responseArray[2]); + } + } + return response; + } + + public BindDeviceToGatewayResponse asyncBindDeviceToGateway(BindDeviceToGatewayRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] paramBody = request.getBodyAndParams(); + String[] responseArray = asyncClient.post(configParameters.getCloudiotURLExtension(), paramBody[0], paramBody[1], request); + BindDeviceToGatewayResponse response = BindDeviceToGatewayResponse.Builder.newBuilder().build(); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + response.setHttpStatusCode(Integer.parseInt(responseArray[0])); + response.setHttpStatusResponse(responseArray[1]); + } else { + throw new ApplicationException(responseArray[2]); + } + } + return response; + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + } + return null; + } + + public UnbindDeviceFromGatewayResponse unbindDeviceFromGateway(UnbindDeviceFromGatewayRequest request) throws ApplicationException { + SyncClient syncClinet = new SyncClient(); + String[] paramBody = request.getBodyAndParams(); + String[] responseArray = syncClinet.post(configParameters.getCloudiotURLExtension(), paramBody[0], paramBody[1], request); + UnbindDeviceFromGatewayResponse response = UnbindDeviceFromGatewayResponse.Builder.newBuilder().build(); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + response.setHttpStatusCode(Integer.parseInt(responseArray[0])); + response.setHttpStatusResponse(responseArray[1]); + } else { + throw new ApplicationException(responseArray[2]); + } + } + return response; + } + + public UnbindDeviceFromGatewayResponse asyncUnbindDeviceFromGateway(UnbindDeviceFromGatewayRequest request) throws ApplicationException { + try { + AsyncClient asyncClinet = new AsyncClient(); + String[] paramBody = request.getBodyAndParams(); + String[] responseArray = asyncClinet.post(configParameters.getCloudiotURLExtension(), paramBody[0], paramBody[1], request); + UnbindDeviceFromGatewayResponse response = UnbindDeviceFromGatewayResponse.Builder.newBuilder().build(); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + response.setHttpStatusCode(Integer.parseInt(responseArray[0])); + response.setHttpStatusResponse(responseArray[1]); + } else { + throw new ApplicationException(responseArray[2]); + } + } + return response; + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + } + + public SendCommandToDeviceResponse sendCommandToDevice(SendCommandToDeviceRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] paramBody = request.getBodyAndParams(); + String[] responseArray = syncClient.post(configParameters.getDevicesURLExtension(), paramBody[0], paramBody[1], request); + SendCommandToDeviceResponse response = SendCommandToDeviceResponse.Builder.newBuilder().build(); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200 || responseCode == 204) { + response.setHttpStatusCode(Integer.parseInt(responseArray[0])); + response.setHttpStatusResponse(responseArray[1]); + } else { + throw new ApplicationException(responseArray[2]); + } + } + return response; + } + + public SendCommandToDeviceResponse asyncSendCommandToDevice(SendCommandToDeviceRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] paramBody = request.getBodyAndParams(); + String[] responseArray = asyncClient.post(configParameters.getDevicesURLExtension(), paramBody[0], paramBody[1], request); + SendCommandToDeviceResponse response = SendCommandToDeviceResponse.Builder.newBuilder().build(); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200 || responseCode == 204) { + response.setHttpStatusCode(Integer.parseInt(responseArray[0])); + response.setHttpStatusResponse(responseArray[1]); + } else { + throw new ApplicationException(responseArray[2]); + } + } + return response; + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + } + + public DevicesListResponse listDevices(DevicesListRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] responseArray = syncClient.get(configParameters.getDevicesURLExtension(), request.getParamsForList(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + return DevicesListResponse.Builder.newBuilder().buildResponse(responseArray[2]).build(); + } else { + throw new ApplicationException(responseArray[2]); + } + } + return null; + } + + public DevicesListResponse asyncListDevices(DevicesListRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] responseArray = asyncClient.get(configParameters.getDevicesURLExtension(), request.getParamsForList(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + return DevicesListResponse.Builder.newBuilder().buildResponse(responseArray[2]).build(); + } else { + throw new ApplicationException(responseArray[2]); + } + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + return null; + } + + public DeviceConfig modifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] paramBody = request.getBodyAndParams(); + String[] responseArray = syncClient.post(configParameters.getDevicesURLExtension(), paramBody[0], paramBody[1], request); + DeviceConfig deviceConfig = DeviceConfig.newBuilder().build(); + if (responseArray[0] != null) { + if (Integer.parseInt(responseArray[0]) == 200) deviceConfig.loadFromString(responseArray[2]); + else throw new ApplicationException(responseArray[2]); + } + return deviceConfig; + } + + public DeviceConfig asyncModifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] paramBody = request.getBodyAndParams(); + String[] responseArray = asyncClient.post(configParameters.getDevicesURLExtension(), paramBody[0], paramBody[1], request); + DeviceConfig deviceConfig = DeviceConfig.newBuilder().build(); + if (responseArray[0] != null) { + if (Integer.parseInt(responseArray[0]) == 200) deviceConfig.loadFromString(responseArray[2]); + else throw new ApplicationException(responseArray[2]); + } + return deviceConfig; + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + } + + public ListDeviceStatesResponse listDeviceStates(ListDeviceStatesRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] responseArray = syncClient.get(configParameters.getDevicesStatesURLExtension(), request.getParamsForList(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + return ListDeviceStatesResponse.Builder.newBuilder().buildResponse(responseArray[2]).build(); + } else throw new ApplicationException(responseArray[2]); + } + return null; + } + + public ListDeviceStatesResponse asyncListDeviceStates(ListDeviceStatesRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] responseArray = asyncClient.get(configParameters.getDevicesStatesURLExtension(), request.getParamsForList(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + return ListDeviceStatesResponse.Builder.newBuilder().buildResponse(responseArray[2]).build(); + } else throw new ApplicationException(responseArray[2]); + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + return null; + } + + public ListDeviceConfigVersionsResponse listDeviceConfigVersions(ListDeviceConfigVersionsRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] responseArray = syncClient.get(configParameters.getCloudiotConfigURLExtension(), request.getParamsForList(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + return ListDeviceConfigVersionsResponse.Builder.newBuilder().buildResponse(responseArray[2]).build(); + } else throw new ApplicationException(responseArray[2]); + } + return null; + } + + public ListDeviceConfigVersionsResponse asyncListDeviceConfigVersions(ListDeviceConfigVersionsRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] responseArray = asyncClient.get(configParameters.getCloudiotConfigURLExtension(), request.getParamsForList(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + return ListDeviceConfigVersionsResponse.Builder.newBuilder().buildResponse(responseArray[2]).build(); + } else throw new ApplicationException(responseArray[2]); + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + return null; + } + + public ListDeviceRegistriesResponse listDeviceRegistries(ListDeviceRegistriesRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] responseArray = syncClient.get(configParameters.getCloudiotURLExtension(), request.getParamsForList(), true); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + return ListDeviceRegistriesResponse.Builder.newBuilder().buildResponse(responseArray[2]).build(); + } else throw new ApplicationException(responseArray[2]); + } + return null; + } + + public ListDeviceRegistriesResponse asyncListDeviceRegistries(ListDeviceRegistriesRequest request) throws ApplicationException, IOException { + AsyncClient asyncClient = new AsyncClient(); + String[] responseArray = asyncClient.asyncListDeviceRegistries(configParameters.getCloudiotURLExtension(), request.getParamsForList(), true); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + return ListDeviceRegistriesResponse.Builder.newBuilder().buildResponse(responseArray[2]).build(); + } else throw new ApplicationException(responseArray[2]); + } + return null; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/ClearBladeRegistryManager.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/ClearBladeRegistryManager.java new file mode 100644 index 00000000..d192ec20 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/ClearBladeRegistryManager.java @@ -0,0 +1,212 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1; + +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.clearblade.cloud.iot.v1.createdeviceregistry.CreateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deletedeviceregistry.DeleteDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; + +public class ClearBladeRegistryManager { + static Logger log = Logger.getLogger(ClearBladeRegistryManager.class.getName()); + ConfigParameters configParameters = ConfigParameters.getInstance(); + + public DeviceRegistry getRegistry(GetDeviceRegistryRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] responseArray = syncClient.get(configParameters.getCloudiotURLExtension(), request.toString(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); + deviceRegistry.loadFromString(responseArray[2]); + return deviceRegistry; + } else { + throw new ApplicationException(responseArray[2]); + } + } + return null; + } + + public DeviceRegistry asyncGetDeviceRegistry(GetDeviceRegistryRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] responseArray = asyncClient.get(configParameters.getCloudiotURLExtension(), request.toString(), request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); + deviceRegistry.loadFromString(responseArray[2]); + return deviceRegistry; + } else { + throw new ApplicationException(responseArray[2]); + } + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + return null; + } + + public DeviceRegistry createDeviceRegistry(CreateDeviceRegistryRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String[] bodyParams = request.getBodyAndParams(); + + String[] responseArray = syncClient.post(configParameters.getCloudiotURLExtension(), bodyParams[0], + bodyParams[1], true, request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); + deviceRegistry.loadFromString(responseArray[2]); + return deviceRegistry; + } else { + throw new ApplicationException(responseArray[2]); + } + } + return null; + } + + public DeviceRegistry asyncCreateDeviceRegistry(CreateDeviceRegistryRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] bodyParams = request.getBodyAndParams(); + + String[] responseArray = asyncClient.asyncCreateDeviceRegistry(configParameters.getCloudiotURLExtension(), + bodyParams[0], bodyParams[1], true); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); + deviceRegistry.loadFromString(responseArray[2]); + return deviceRegistry; + } else { + throw new ApplicationException(responseArray[2]); + } + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + return null; + } + + public DeviceRegistry updateDeviceRegistry(UpdateDeviceRegistryRequest request) throws ApplicationException { + try { + SyncClient syncClient = new SyncClient(); + String[] bodyParams = request.getBodyAndParams(); + + String[] responseArray = syncClient.update(configParameters.getCloudiotURLExtension(), bodyParams[0], + bodyParams[1], request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); + deviceRegistry.loadFromString(responseArray[2]); + return deviceRegistry; + } else { + throw new ApplicationException(responseArray[2]); + } + } + } catch (Exception e) { + Thread.currentThread().interrupt(); + throw new ApplicationException(e.getMessage(), e); + } + return null; + } + + public DeviceRegistry asyncUpdateDeviceRegistry(UpdateDeviceRegistryRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String[] bodyParams = request.getBodyAndParams(); + + String[] responseArray = asyncClient.update(configParameters.getCloudiotURLExtension(), bodyParams[0], + bodyParams[1], request); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200) { + DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); + deviceRegistry.loadFromString(responseArray[2]); + return deviceRegistry; + } else { + throw new ApplicationException(responseArray[2]); + } + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + return null; + } + + public void deleteDeviceRegistry(DeleteDeviceRegistryRequest request) throws ApplicationException { + SyncClient syncClient = new SyncClient(); + String bodyParams = request.getParams(); + + String[] responseArray = syncClient.delete(configParameters.getCloudiotURLExtension(), bodyParams, true); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200 || responseCode == 204) { + log.log(Level.INFO, + () -> "Response code " + responseArray[0] + " received with message" + responseArray[2]); + } else { + throw new ApplicationException(responseArray[2]); + } + } + + } + + public void asyncDeleteDeviceRegistry(DeleteDeviceRegistryRequest request) throws ApplicationException { + try { + AsyncClient asyncClient = new AsyncClient(); + String bodyParams = request.getParams(); + + String[] responseArray = asyncClient.asyncDeleteDeviceRegistry(configParameters.getCloudiotURLExtension(), + bodyParams, true); + if (responseArray[0] != null) { + int responseCode = Integer.parseInt(responseArray[0]); + if (responseCode == 200 || responseCode == 204) { + System.out.println("DeleteDeviceRegistry execution successful"); + } else { + throw new ApplicationException(responseArray[2]); + } + } else { + System.out.println("DeleteDeviceRegistry execution failed"); + } + } catch (Exception e) { + throw new ApplicationException(e.getMessage(), e); + } + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerAsyncClient.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerAsyncClient.java new file mode 100644 index 00000000..9041a8fe --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerAsyncClient.java @@ -0,0 +1,200 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1; + +import java.io.IOException; +import java.util.logging.Logger; + +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayResponse; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.createdeviceregistry.CreateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.deletedeviceregistry.DeleteDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListResponse; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesRequest; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesResponse; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsResponse; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesRequest; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesResponse; +import com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig.ModifyCloudToDeviceConfigRequest; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceResponse; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayResponse; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; + +public class DeviceManagerAsyncClient { + + static Logger log = Logger.getLogger(DeviceManagerAsyncClient.class.getName()); + + /** + * Calling getDevice api + * + * @param request + * @return Device object + */ + + public Device getDevice(GetDeviceRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncGetDevice(request); + } + + /** + * Calling createDevice api + * + * @param request + * @return Device object + */ + public Device createDevice(CreateDeviceRequest request) throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncCreateDevice(request); + } + + /** + * Calling deleteDevice api + * + * @param request + */ + public void deleteDevice(DeleteDeviceRequest request) throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + cbManager.asyncDeleteDevice(request); + } + + /** + * Calling updateDevice api + * + * @param request + * @return Device object + */ + public Device updateDevice(UpdateDeviceRequest request) throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncUpdateDevice(request); + } + + /** + * Calling bindDeviceToGateway api + * + * @param request + * @return + */ + public BindDeviceToGatewayResponse bindDeviceToGateway(BindDeviceToGatewayRequest request) + throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncBindDeviceToGateway(request); + } + + /** + * Calling unbindDeviceFromGateway api + * + * @param request + * @return + */ + public UnbindDeviceFromGatewayResponse unbindDeviceFromGateway(UnbindDeviceFromGatewayRequest request) + throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncUnbindDeviceFromGateway(request); + } + + public SendCommandToDeviceResponse sendCommandToDevice(SendCommandToDeviceRequest request) + throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncSendCommandToDevice(request); + + } + + public DeviceConfig modifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest request) + throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncModifyCloudToDeviceConfig(request); + } + + public DevicesListResponse listDevices(DevicesListRequest request) throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncListDevices(request); + } + + public ListDeviceStatesResponse listDeviceStates(ListDeviceStatesRequest request) throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncListDeviceStates(request); + } + + public ListDeviceConfigVersionsResponse listDeviceConfigVersions(ListDeviceConfigVersionsRequest request) + throws ApplicationException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncListDeviceConfigVersions(request); + } + + // Registry Apis + + /** + * Calling getDevice api + * + * @param request + * @return Device object + */ + + public DeviceRegistry getDeviceRegistry(GetDeviceRegistryRequest request) throws ApplicationException { + ClearBladeRegistryManager cbManager = new ClearBladeRegistryManager(); + return cbManager.asyncGetDeviceRegistry(request); + } + + public DeviceRegistry createDeviceRegistry(CreateDeviceRegistryRequest request) throws ApplicationException { + ClearBladeRegistryManager cbManager = new ClearBladeRegistryManager(); + return cbManager.asyncCreateDeviceRegistry(request); + } + + public DeviceRegistry updateDeviceRegistry(UpdateDeviceRegistryRequest request) throws ApplicationException { + ClearBladeRegistryManager cbManager = new ClearBladeRegistryManager(); + return cbManager.asyncUpdateDeviceRegistry(request); + } + + public void deleteDeviceRegistry(DeleteDeviceRegistryRequest request) throws ApplicationException { + ClearBladeRegistryManager cbManager = new ClearBladeRegistryManager(); + cbManager.asyncDeleteDeviceRegistry(request); + } + + public ListDeviceRegistriesResponse listDeviceRegistries(ListDeviceRegistriesRequest request) + throws ApplicationException, IOException { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.asyncListDeviceRegistries(request); + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerClient.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerClient.java new file mode 100644 index 00000000..ee1e6605 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerClient.java @@ -0,0 +1,205 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1; + +import java.io.IOException; +import java.util.logging.Logger; + +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayResponse; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.createdeviceregistry.CreateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.deletedeviceregistry.DeleteDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListResponse; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesRequest; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesResponse; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsResponse; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesRequest; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesResponse; +import com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig.ModifyCloudToDeviceConfigRequest; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceResponse; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayResponse; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; + +public class DeviceManagerClient implements DeviceManagerInterface{ + + static Logger log = Logger.getLogger(DeviceManagerClient.class.getName()); + /** + * Calling getDevice api + * + * @param request + * @return Device object + * @throws IOException + * @throws ApplicationException + */ + + public Device getDevice(GetDeviceRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.getDevice(request); + } + + /** + * Calling createDevice api + * + * @param request + * @return Device object + * @throws IOException + * @throws ApplicationException + */ + public Device createDevice(CreateDeviceRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.createDevice(request); + } + + /** + * Calling bindDeviceToGateway api + * + * @param request + * @return + * @throws IOException + * @throws ApplicationException + */ + public BindDeviceToGatewayResponse bindDeviceToGateway(BindDeviceToGatewayRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.bindDeviceToGateway(request); + } + + /** + * Calling unbindDeviceFromGateway api + * + * @param request + * @return + * @throws IOException + * @throws ApplicationException + */ + public UnbindDeviceFromGatewayResponse unbindDeviceFromGateway(UnbindDeviceFromGatewayRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.unbindDeviceFromGateway(request); + } + + /** + * Calling deleteDevice api + * + * @param request + * @throws IOException + * @throws ApplicationException + */ + public void deleteDevice(DeleteDeviceRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + cbManager.deleteDevice(request); + } + + /** + * Calling updateDevice api + * + * @param request + * @return Device object + */ + public Device updateDevice(UpdateDeviceRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.updateDevice(request); + } + + public SendCommandToDeviceResponse sendCommandToDevice(SendCommandToDeviceRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.sendCommandToDevice(request); + + } + + public DevicesListResponse listDevices(DevicesListRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.listDevices(request); + } + + public DeviceConfig modifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.modifyCloudToDeviceConfig(request); + } + + public ListDeviceStatesResponse listDeviceStates(ListDeviceStatesRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.listDeviceStates(request); + + } + + public ListDeviceConfigVersionsResponse listDeviceConfigVersions(ListDeviceConfigVersionsRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.listDeviceConfigVersions(request); + + } + + // Registry Apis + /** + * Calling getDeviceRegistry api + * + * @param request + * @return DeviceRegistry object + * @throws IOException + * @throws ApplicationException + */ + public DeviceRegistry getDeviceRegistry(GetDeviceRegistryRequest request) { + ClearBladeRegistryManager cbManager = new ClearBladeRegistryManager(); + return cbManager.getRegistry(request); + } + + public DeviceRegistry createDeviceRegistry(CreateDeviceRegistryRequest request) { + ClearBladeRegistryManager cbManager = new ClearBladeRegistryManager(); + return cbManager.createDeviceRegistry(request); + } + + public DeviceRegistry updateDeviceRegistry(UpdateDeviceRegistryRequest request) { + ClearBladeRegistryManager cbManager = new ClearBladeRegistryManager(); + return cbManager.updateDeviceRegistry(request); + } + + public void deleteDeviceRegistry(DeleteDeviceRegistryRequest request) { + ClearBladeRegistryManager cbManager = new ClearBladeRegistryManager(); + cbManager.deleteDeviceRegistry(request); + } + + public ListDeviceRegistriesResponse listDeviceRegistries(ListDeviceRegistriesRequest request) { + ClearBladeDeviceManager cbManager = new ClearBladeDeviceManager(); + return cbManager.listDeviceRegistries(request); + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerInterface.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerInterface.java new file mode 100644 index 00000000..b359aec2 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/DeviceManagerInterface.java @@ -0,0 +1,68 @@ +package com.clearblade.cloud.iot.v1; + +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayResponse; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.createdeviceregistry.CreateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.deletedeviceregistry.DeleteDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListResponse; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesRequest; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesResponse; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsResponse; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesRequest; +import com.clearblade.cloud.iot.v1.listdeviceregistries.ListDeviceRegistriesResponse; +import com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig.ModifyCloudToDeviceConfigRequest; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceResponse; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayResponse; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; + + +/** + * Manager interface for device management actions. + */ +public interface DeviceManagerInterface { + + Device getDevice(GetDeviceRequest request); + + Device createDevice(CreateDeviceRequest request); + + BindDeviceToGatewayResponse bindDeviceToGateway(BindDeviceToGatewayRequest request); + + UnbindDeviceFromGatewayResponse unbindDeviceFromGateway(UnbindDeviceFromGatewayRequest request); + + void deleteDevice(DeleteDeviceRequest request); + + Device updateDevice(UpdateDeviceRequest request); + + SendCommandToDeviceResponse sendCommandToDevice(SendCommandToDeviceRequest request); + + DevicesListResponse listDevices(DevicesListRequest request); + + DeviceConfig modifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest request); + + ListDeviceStatesResponse listDeviceStates(ListDeviceStatesRequest request); + + ListDeviceConfigVersionsResponse listDeviceConfigVersions( + ListDeviceConfigVersionsRequest request); + + DeviceRegistry getDeviceRegistry(GetDeviceRegistryRequest request); + + DeviceRegistry createDeviceRegistry(CreateDeviceRegistryRequest request); + + DeviceRegistry updateDeviceRegistry(UpdateDeviceRegistryRequest request); + + void deleteDeviceRegistry(DeleteDeviceRegistryRequest request); + + ListDeviceRegistriesResponse listDeviceRegistries(ListDeviceRegistriesRequest request); +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/SyncClient.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/SyncClient.java new file mode 100644 index 00000000..3c8e4f1c --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/SyncClient.java @@ -0,0 +1,385 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1; + +import java.io.IOException; +import java.net.ProxySelector; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpRequest.BodyPublisher; +import java.net.http.HttpRequest.BodyPublishers; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.util.logging.Level; +import java.util.logging.Logger; + +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.createdeviceregistry.CreateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.deletedeviceregistry.DeleteDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.devicestateslist.ListDeviceStatesRequest; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.listdeviceconfigversions.ListDeviceConfigVersionsRequest; +import com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig.ModifyCloudToDeviceConfigRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.utils.AuthParams; +import com.clearblade.cloud.iot.v1.utils.ConfigParameters; +import com.clearblade.cloud.iot.v1.utils.Constants; +import org.json.simple.parser.ParseException; + +public class SyncClient { + + static Logger log = Logger.getLogger(SyncClient.class.getName()); + private ConfigParameters configParameters = ConfigParameters.getInstance(); + + private AuthParams authParams = new AuthParams(); + + /** + * Method used to generate URL for apicall + * + * @param apiName - path to api + * @param params - parameters to be attached to request + * @return URL formed and to be used + */ + private String generateURL(AuthParams authParams, String apiName, String params) { + return authParams.getApiBaseURL().concat(configParameters.getEndpointPort()).concat(configParameters.getWebhook()).concat(authParams.getUserSystemKey()).concat(apiName).concat("?" + params); + } + + /** + * Method used to generate URL for apicall + * + * @param apiName - path to api + * @param params - parameters to be attached to request + * @return URL formed and to be used + */ + private String generateAdminURL(AuthParams authParams, String apiName, String params) { + return authParams.getBaseURL().concat(configParameters.getWebhook()).concat(authParams.getAdminSystemKey()).concat(apiName).concat("?" + params); + } + + public String[] get(String apiName, GetDeviceRequest request) { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, request.toString()); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, DevicesListRequest request) { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, ListDeviceStatesRequest request) { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, GetDeviceRegistryRequest request) { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, ListDeviceConfigVersionsRequest request) { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return get(finalURL, token); + } + + public String[] get(String apiName, String params, boolean isAdmin) { + String finalURL = ""; + String token = ""; + if (isAdmin) { + try { + authParams.setAdminCredentials(); + } catch (IOException e) { + throw new ApplicationException(e); + } + finalURL = generateAdminURL(authParams, apiName, params); + token = authParams.getAdminToken(); + } + return this.get(finalURL, token); + } + + /** + * Method used to Calls HTTP Get request + * + * @return String[] containing responseCode, responseMessage and response object + * @throws IOException + * @throws ApplicationException + */ + public String[] get(String finalURL, String token) { + String[] responseArray = new String[3]; + try { + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(finalURL)).headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, token, Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE).GET().build(); + + HttpResponse response = HttpClient.newBuilder().proxy(ProxySelector.getDefault()).build().send(request, BodyHandlers.ofString()); + + responseArray[0] = String.valueOf(response.statusCode()); + responseArray[1] = ""; + responseArray[2] = response.body(); + } catch (InterruptedException e) { + log.log(Level.SEVERE, e.getMessage()); + Thread.currentThread().interrupt(); + throw new ApplicationException(e); + } catch (Exception ex) { + log.log(Level.SEVERE, ex.getMessage()); + throw new ApplicationException(ex); + } + return responseArray; + } + + public String[] post(String apiName, String params, String body, CreateDeviceRequest request) { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, SendCommandToDeviceRequest request) { + try { + authParams.setRegistryCredentials(request.getDeviceName().getProject(), request.getDeviceName().getRegistry(), request.getDeviceName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, BindDeviceToGatewayRequest request) { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, ModifyCloudToDeviceConfigRequest request) { + try { + authParams.setRegistryCredentials(request.getDeviceName().getProject(), request.getDeviceName().getRegistry(), request.getDeviceName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, UnbindDeviceFromGatewayRequest request) { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return post(finalURL, body, token); + } + + public String[] post(String apiName, String params, String body, boolean isAdmin, CreateDeviceRegistryRequest request) { + String finalURL = ""; + String token = ""; + if (isAdmin) { + try { + authParams.setAdminCredentials(); + } catch (IOException e) { + throw new ApplicationException(e); + } + finalURL = generateAdminURL(authParams, apiName, params); + token = authParams.getAdminToken(); + } + return post(finalURL, body, token); + } + + /** + * Method used to call HTTP Post request + * + * @param body + * @return String[] containing responseCode, responseMessage and response object + * @throws IOException + * @throws ApplicationException + */ + public String[] post(String finalURL, String body, String token) { + String[] responseArray = new String[3]; + try { + BodyPublisher jsonPayload = BodyPublishers.ofString(body); + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(finalURL)).method(Constants.HTTP_REQUEST_METHOD_TYPE_POST, jsonPayload).headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, token, Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE).build(); + + HttpResponse response = HttpClient.newBuilder().proxy(ProxySelector.getDefault()).build().send(request, BodyHandlers.ofString()); + + responseArray[0] = String.valueOf(response.statusCode()); + responseArray[1] = ""; + responseArray[2] = response.body(); + } catch (InterruptedException e) { + log.log(Level.SEVERE, e.getMessage()); + Thread.currentThread().interrupt(); + throw new ApplicationException(e); + } catch (Exception ec) { + log.log(Level.SEVERE, ec.getMessage()); + throw new ApplicationException(ec); + } + return responseArray; + } + + public String[] delete(String apiName, String params, boolean isAdmin, DeleteDeviceRequest request) { + try { + authParams.setRegistryCredentials(request.getName().getProject(), request.getName().getRegistry(), request.getName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return this.delete(finalURL, token); + } + + public String[] delete(String apiName, String params, boolean isAdmin) { + try { + authParams.setAdminCredentials(); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateAdminURL(authParams, apiName, params); + String token = authParams.getAdminToken(); + return this.delete(finalURL, token); + } + + /** + * Method used to call HTTP delete request + * + * @return String[] containing responseCode, responseMessage and response object + * @throws IOException + * @throws ApplicationException + */ + public String[] delete(String finalURL, String token) { + String[] responseArray = new String[3]; + try { + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(finalURL)).headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, token, Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE).DELETE().build(); + + HttpResponse response = HttpClient.newBuilder().proxy(ProxySelector.getDefault()).build().send(request, BodyHandlers.ofString()); + + responseArray[0] = String.valueOf(response.statusCode()); + responseArray[1] = ""; + responseArray[2] = response.body(); + } catch (InterruptedException e) { + log.log(Level.SEVERE, e.getMessage()); + Thread.currentThread().interrupt(); + throw new ApplicationException(e); + } catch (Exception ex) { + log.log(Level.SEVERE, ex.getMessage()); + throw new ApplicationException(ex); + } + + return responseArray; + } + + public String[] update(String apiName, String params, String body, UpdateDeviceRequest request) throws InterruptedException { + try { + authParams.setRegistryCredentials(request.getDeviceName().getProject(), request.getDeviceName().getRegistry(), request.getDeviceName().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return update(finalURL, body, token); + } + + public String[] update(String apiName, String params, String body, UpdateDeviceRegistryRequest request) throws InterruptedException { + try { + authParams.setRegistryCredentials(request.getParent().getProject(), request.getParent().getRegistry(), request.getParent().getLocation()); + } catch (Exception e) { + throw new ApplicationException(e); + } + String finalURL = generateURL(authParams, apiName, params); + String token = authParams.getUserToken(); + return update(finalURL, body, token); + } + + + public String[] update(String finalURL, String body, String token) throws InterruptedException { + String[] responseArray = new String[3]; + try { + BodyPublisher jsonPayload = BodyPublishers.ofString(body); + HttpRequest request = HttpRequest.newBuilder().uri(URI.create(finalURL)).method(Constants.HTTP_REQUEST_METHOD_TYPE_PATCH, jsonPayload).headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, token, Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE).build(); + + HttpResponse response = HttpClient.newBuilder().proxy(ProxySelector.getDefault()).build().send(request, BodyHandlers.ofString()); + + responseArray[0] = String.valueOf(response.statusCode()); + responseArray[1] = ""; + responseArray[2] = response.body(); + + } catch (Exception ex) { + log.log(Level.SEVERE, ex.getMessage()); + throw new ApplicationException(ex); + } + return responseArray; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/binddevicetogateway/BindDeviceToGatewayRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/binddevicetogateway/BindDeviceToGatewayRequest.java new file mode 100644 index 00000000..bdd8e20a --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/binddevicetogateway/BindDeviceToGatewayRequest.java @@ -0,0 +1,134 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.binddevicetogateway; + +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import org.json.simple.JSONObject; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class BindDeviceToGatewayRequest { + private final String parent; + private final String gateway; + private final String device; + JSONObject requestParams; + JSONObject bodyParams; + + private BindDeviceToGatewayRequest(Builder builder) { + this.parent = builder.parent; + this.gateway = builder.gateway; + this.device = builder.device; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String parent; + private String gateway; + private String device; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setParent(String parent) { + this.parent = parent; + return this; + } + + public Builder setGateway(String gateway) { + this.gateway = gateway; + return this; + } + + public Builder setDevice(String device) { + this.device = device; + return this; + } + + // build method to deal with outer class + // to return outer instance + public BindDeviceToGatewayRequest build() { + return new BindDeviceToGatewayRequest(this); + } + } + + public void setRequestParams(JSONObject requestParams) { + this.requestParams = requestParams; + } + + public void setBodyParams(JSONObject bodyParams) { + this.bodyParams = bodyParams; + } + + public RegistryName getParent() { + return RegistryName.parse(this.parent); + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + requestParams = new JSONObject(); + bodyParams = new JSONObject(); + + String method = "bindDeviceToGateway"; + requestParams.put("method", method); + requestParams.put("parent", this.parent); + + bodyParams.put("gatewayId", this.gateway); + bodyParams.put("deviceId", this.device); + + this.setRequestParams(requestParams); + this.setBodyParams(bodyParams); + + return "parent=" + this.parent + ",gateway=" + this.gateway + ", device= " + this.device; + } + + @SuppressWarnings("unchecked") + public String[] getBodyAndParams() { + String[] output = new String[2]; + String params = "parent=" + URLEncoder.encode(this.parent, StandardCharsets.UTF_8) + "&method=" + "bindDeviceToGateway"; + bodyParams = new JSONObject(); + bodyParams.put("gatewayId", this.gateway); + bodyParams.put("deviceId", this.device); + + output[0] = params; + output[1] = bodyParams.toJSONString(); + return output; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/binddevicetogateway/BindDeviceToGatewayResponse.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/binddevicetogateway/BindDeviceToGatewayResponse.java new file mode 100644 index 00000000..1ffe9b21 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/binddevicetogateway/BindDeviceToGatewayResponse.java @@ -0,0 +1,98 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.binddevicetogateway; + +import java.util.logging.Logger; + +public class BindDeviceToGatewayResponse { + + static Logger log = Logger.getLogger(BindDeviceToGatewayResponse.class.getName()); + private final BindDeviceToGatewayRequest request; + private int httpStatusCode; + private String httpStatusResponse; + + protected BindDeviceToGatewayResponse(Builder builder) { + this.request = builder.request; + } + + public int getHttpStatusCode() { + return httpStatusCode; + } + + public void setHttpStatusCode(int httpStatusCode) { + this.httpStatusCode = httpStatusCode; + } + + public String getHttpStatusResponse() { + return httpStatusResponse; + } + + public void setHttpStatusResponse(String httpStatusResponse) { + this.httpStatusResponse = httpStatusResponse; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private BindDeviceToGatewayRequest request; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setBindDeviceToGatewayRequest(BindDeviceToGatewayRequest request) { + this.request = request; + return this; + } + + // build method to deal with outer class + // to return outer instance + public BindDeviceToGatewayResponse build() { + return new BindDeviceToGatewayResponse(this); + } + } + + @Override + public String toString() { + return "Http Status Code :: " + this.getHttpStatusCode() + " Http Status Response :: " + + this.getHttpStatusResponse(); + } + + public BindDeviceToGatewayRequest getRequest() { + return request; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/createdevice/CreateDeviceRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/createdevice/CreateDeviceRequest.java new file mode 100644 index 00000000..e30db49b --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/createdevice/CreateDeviceRequest.java @@ -0,0 +1,90 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.createdevice; + +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class CreateDeviceRequest { + private final String parent; + private final Device device; + + private CreateDeviceRequest(Builder builder) { + this.parent = builder.parent; + this.device = builder.device; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String parent; + private Device device; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setParent(String parent) { + this.parent = parent; + return this; + } + + public Builder setDevice(Device device) { + this.device = device; + return this; + } + + // build method to deal with outer class + // to return outer instance + public CreateDeviceRequest build() { + return new CreateDeviceRequest(this); + } + } + + public RegistryName getParent() { + return RegistryName.parse(this.parent); + } + + public String[] getParams() { + String[] params = new String[2]; + params[0] = "parent=" + URLEncoder.encode(getParent().getRegistryFullName(), StandardCharsets.UTF_8); + params[1] = this.device.createDeviceJSONObject(); + return params; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/createdeviceregistry/CreateDeviceRegistryRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/createdeviceregistry/CreateDeviceRegistryRequest.java new file mode 100644 index 00000000..2114486e --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/createdeviceregistry/CreateDeviceRegistryRequest.java @@ -0,0 +1,90 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.createdeviceregistry; + +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class CreateDeviceRegistryRequest { + private final String parent; + private final DeviceRegistry deviceRegistry; + + private CreateDeviceRegistryRequest(Builder builder) { + this.parent = builder.parent; + this.deviceRegistry = builder.deviceRegistry; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String parent; + private DeviceRegistry deviceRegistry; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setParent(String parent) { + this.parent = parent; + return this; + } + + public Builder setDeviceRegistry(DeviceRegistry deviceRegistry) { + this.deviceRegistry = deviceRegistry; + return this; + } + + // build method to deal with outer class + // to return outer instance + public CreateDeviceRegistryRequest build() { + return new CreateDeviceRegistryRequest(this); + } + } + + public LocationName getParent() { + return LocationName.parse(this.parent); + } + + public String[] getBodyAndParams() { + String[] output = new String[2]; + output[0] = "parent=" + URLEncoder.encode(this.parent, StandardCharsets.UTF_8); + output[1] = this.deviceRegistry.createDeviceJSONObject(parent); + return output; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deletedevice/DeleteDeviceRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deletedevice/DeleteDeviceRequest.java new file mode 100644 index 00000000..700a3fa4 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deletedevice/DeleteDeviceRequest.java @@ -0,0 +1,90 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.deletedevice; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import java.net.URLEncoder; + +public class DeleteDeviceRequest { + private DeviceName name; + + private DeleteDeviceRequest(Builder builder) { + this.name = builder.name; + } + + + public DeviceName getName() { + return name; + } + + public void setName(DeviceName name) { + this.name = name; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private DeviceName name; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // build method to deal with outer class + // to return outer instance + public DeleteDeviceRequest build() { + return new DeleteDeviceRequest(this); + } + + // Setter methods + public Builder setName(DeviceName name) { + this.name = name; + return this; + } + } + + @Override + public String toString() { + String params = ""; + try { + params = "name="+ URLEncoder.encode(this.name.toString(),"UTF-8"); + } catch (Exception e) { + throw new ApplicationException(e); + } + return params; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deletedeviceregistry/DeleteDeviceRegistryRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deletedeviceregistry/DeleteDeviceRegistryRequest.java new file mode 100644 index 00000000..6adaad5a --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deletedeviceregistry/DeleteDeviceRegistryRequest.java @@ -0,0 +1,74 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.deletedeviceregistry; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class DeleteDeviceRegistryRequest { + private final String name; + + private DeleteDeviceRegistryRequest(Builder builder) { + this.name = builder.name; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String name; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setName(String name) { + this.name = name; + return this; + } + + // build method to deal with outer class + // to return outer instance + public DeleteDeviceRegistryRequest build() { + return new DeleteDeviceRegistryRequest(this); + } + } + + public String getParams() { + return "name=" + URLEncoder.encode(this.name, StandardCharsets.UTF_8); + } + + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deviceslist/DevicesListRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deviceslist/DevicesListRequest.java new file mode 100644 index 00000000..ea015b99 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deviceslist/DevicesListRequest.java @@ -0,0 +1,160 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.deviceslist; + +import com.clearblade.cloud.iot.v1.devicetypes.GatewayListOptions; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class DevicesListRequest { + + private String parent; + private String deviceNumIds; + private String deviceIds; + private String fieldMask; + private int pageSize = -1; + private String pageToken; + private GatewayListOptions gatewayListOptions; + + private DevicesListRequest(Builder builder) { + this.parent = builder.parent; + this.deviceNumIds = builder.deviceNumIds; + this.deviceIds = builder.deviceIds; + this.fieldMask = builder.fieldMask; + this.pageSize = builder.pageSize; + this.pageToken = builder.pageToken; + this.gatewayListOptions = builder.gatewayListOptions; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String parent; + private String deviceNumIds; + private String deviceIds; + private String fieldMask; + private int pageSize; + private String pageToken; + private GatewayListOptions gatewayListOptions; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setParent(String parent) { + this.parent = parent; + return this; + } + + public Builder setDeviceNumIds(String deviceNumIds) { + this.deviceNumIds = deviceNumIds; + return this; + } + + public Builder setDeviceIds(String deviceIds) { + this.deviceIds = deviceIds; + return this; + } + + public Builder setFieldMask(String fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public Builder setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public Builder setGatewayListOptions(GatewayListOptions gatewayListOptions) { + this.gatewayListOptions = gatewayListOptions; + return this; + } + + // build method to deal with outer class + // to return outer instance + public DevicesListRequest build() { + return new DevicesListRequest(this); + } + + } + + public RegistryName getParent() { + return RegistryName.parse(this.parent); + } + + @Override + public String toString() { + return this.parent.toString(); + } + + public String getParamsForList() { + String params = ""; + params = "parent=" + this.parent; + if (this.deviceNumIds != null) + params += "&deviceNumIds=" + this.deviceNumIds; + if (this.deviceIds != null) + params += "&deviceIds=" + this.deviceIds; + if (this.fieldMask != null) + params += "&fieldMask=" + URLEncoder.encode(this.fieldMask, StandardCharsets.UTF_8); + if (this.pageSize > 0) + params += "&pageSize=" + String.valueOf(this.pageSize); + if (this.pageToken != null) + params += "&pageToken=" + this.pageToken; + if (this.gatewayListOptions != null) { + if (this.gatewayListOptions.getGatewayType() != null) { + params += "&gatewayListOptions.gatewayType=" + this.gatewayListOptions.getGatewayType().name(); + } + if (this.gatewayListOptions.getAssociationsDeviceId() != null) { + params += "&gatewayListOptions.associationsDeviceId=" + + this.gatewayListOptions.getAssociationsDeviceId(); + } + if (this.gatewayListOptions.getAssociationsGatewayId() != null) { + params += "&gatewayListOptions.associationsGatewayId=" + + this.gatewayListOptions.getAssociationsGatewayId(); + } + } + return params; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deviceslist/DevicesListResponse.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deviceslist/DevicesListResponse.java new file mode 100644 index 00000000..6542d377 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/deviceslist/DevicesListResponse.java @@ -0,0 +1,120 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.deviceslist; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import com.clearblade.cloud.iot.v1.devicetypes.Device; + +public class DevicesListResponse { + + static Logger log = Logger.getLogger(DevicesListResponse.class.getName()); + + private String nextPageToken; + private List devicesList; + + protected DevicesListResponse(Builder builder) { + this.devicesList = builder.devicesList; + this.nextPageToken = builder.nextPageToken; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public void setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + } + + public List getDevicesList() { + return devicesList; + } + + public void setDevicesList(List devicesList) { + this.devicesList = devicesList; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String nextPageToken; + private List devicesList = new ArrayList<>(); + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder buildResponse(String jsonString) { + try { + JSONObject jsonObj = new JSONObject(); + JSONParser jsonParser = new JSONParser(); + jsonObj = (JSONObject) (jsonParser.parse(jsonString)); + + JSONArray devicesArray = (JSONArray) jsonObj.get("devices"); + @SuppressWarnings("rawtypes") + Iterator deviceIterate = devicesArray.iterator(); + while (deviceIterate.hasNext()) { + JSONObject deviceJson = (JSONObject) deviceIterate.next(); + Device deviceObj = Device.newBuilder().build(); + deviceObj.loadFromString(deviceJson.toString()); + devicesList.add(deviceObj); + } + + if (jsonObj.containsKey("nextPageToken")) + nextPageToken = (String) jsonObj.get("nextPageToken"); + + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + } + return this; + } + + // build method to deal with outer class + // to return outer instance + public DevicesListResponse build() { + return new DevicesListResponse(this); + } + } + +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicestateslist/ListDeviceStatesRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicestateslist/ListDeviceStatesRequest.java new file mode 100644 index 00000000..41f8777f --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicestateslist/ListDeviceStatesRequest.java @@ -0,0 +1,110 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicestateslist; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import org.json.simple.JSONObject; + +public class ListDeviceStatesRequest { + + private final String name; + private final String numStates; + JSONObject requestParams; + + private ListDeviceStatesRequest(Builder builder) { + this.name = builder.name; + this.numStates = builder.numStates; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String name; + private String numStates; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setNumStates(int numStates) { + this.numStates = String.valueOf(numStates); + return this; + } + + // build method to deal with outer class + // to return outer instance + public ListDeviceStatesRequest build() { + return new ListDeviceStatesRequest(this); + } + + } + + public JSONObject getRequestParams() { + return requestParams; + } + + public void setRequestParams(JSONObject requestParams) { + this.requestParams = requestParams; + } + + public DeviceName getName() { + return DeviceName.parse(this.name); + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + requestParams = new JSONObject(); + requestParams.put("name", this.name); + requestParams.put("numStates", this.numStates); + this.setRequestParams(requestParams); + return "name=" + this.name + ",numStates=" + this.numStates; + } + + public String getParamsForList() { + String params = ""; + params = "name=" + this.name; + params += "&numStates=" + this.numStates; + + return params; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicestateslist/ListDeviceStatesResponse.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicestateslist/ListDeviceStatesResponse.java new file mode 100644 index 00000000..1c91ccc9 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicestateslist/ListDeviceStatesResponse.java @@ -0,0 +1,111 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicestateslist; + +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.ArrayList; +import java.util.Iterator; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceState; + +public class ListDeviceStatesResponse { + + static Logger log = Logger.getLogger(ListDeviceStatesResponse.class.getName()); + + private List deviceStatesList = new ArrayList<>(); + + protected ListDeviceStatesResponse(Builder builder) { + this.deviceStatesList = builder.deviceStatesList; + } + + // Static class Builder + public static class Builder { + + private List deviceStatesList = new ArrayList<>(); + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // build method to deal with outer class + // to return outer instance + public ListDeviceStatesResponse build() { + return new ListDeviceStatesResponse(this); + } + + public Builder buildResponse(String stateList) { + try { + JSONObject jsonObj = new JSONObject(); + JSONParser jsonParser = new JSONParser(); + jsonObj = (JSONObject) (jsonParser.parse(stateList)); + + JSONArray stateArray = (JSONArray) jsonObj.get("deviceStates"); + @SuppressWarnings("rawtypes") + Iterator stateIterator = stateArray.iterator(); + while (stateIterator.hasNext()) { + JSONObject stateJson = (JSONObject) stateIterator.next(); + DeviceState stateObj = DeviceState.newBuilder().setBinaryData((String) stateJson.get("binaryData")) + .setUpdateTime((String) stateJson.get("updateTime")) + .build(); + deviceStatesList.add(stateObj); + } + + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + } + return this; + + } + + } + + @Override + public String toString() { + return ""; + } + + public List getDeviceStatesList() { + return deviceStatesList; + } + + public void setDeviceStatesList(List deviceStatesList) { + this.deviceStatesList = deviceStatesList; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/Device.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/Device.java new file mode 100644 index 00000000..375ae120 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/Device.java @@ -0,0 +1,590 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import com.clearblade.cloud.iot.v1.utils.LogLevel; + +public class Device { + static Logger log = Logger.getLogger(Device.class.getName()); + + private String id; + private String name; + private String numId; + private List credentials; + private String lastHeartbeatTime; + private String lastEventTime; + private String lastStateTime; + private String lastConfigAckTime; + private String lastConfigSendTime; + private boolean blocked; + private String lastErrorTime; + private Status lastErrorStatus; + private DeviceConfig config; + private DeviceState state; + private LogLevel logLevel; + private Map metadata; + private GatewayConfig gatewayConfig; + + public Device() { + id = null; + name = null; + numId = null; + credentials = new ArrayList<>(); + lastHeartbeatTime = null; + lastEventTime = null; + lastStateTime = null; + lastConfigAckTime = null; + lastConfigSendTime = null; + blocked = false; + lastErrorTime = null; + lastErrorStatus = new Status(); + lastErrorStatus.setCode(0); + lastErrorStatus.setMessage(""); + config = new DeviceConfig(); + config.setCloudUpdateTime(""); + config.setBinaryData(""); + config.setDeviceAckTime(""); + config.setVersion(""); + state = new DeviceState(); + state.setBinaryData(""); + state.setUpdateTime(""); + logLevel = LogLevel.NONE; + metadata = new HashMap<>(); + gatewayConfig = new GatewayConfig(); + gatewayConfig.setGatewayAuthMethod(GatewayAuthMethod.UNRECOGNIZED); + gatewayConfig.setGatewayType(GatewayType.NON_GATEWAY); + gatewayConfig.setLastAccessedGatewayId(""); + gatewayConfig.setLastAccessedGatewayTime(""); + } + + private Device(Builder builder) { + id = builder.getId(); + name = builder.getName(); + numId = builder.getNumId(); + credentials = builder.getCredentials(); + lastHeartbeatTime = builder.getLastHeartbeatTime(); + lastEventTime = builder.getLastEventTime(); + lastStateTime = builder.getLastStateTime(); + lastConfigAckTime = builder.getLastConfigAckTime(); + lastConfigSendTime = builder.getLastConfigSendTime(); + blocked = builder.isBlocked(); + lastErrorTime = builder.getLastErrorTime(); + lastErrorStatus = builder.getLastErrorStatus(); + config = builder.getConfig(); + state = builder.getState(); + logLevel = builder.getLogLevel(); + metadata = builder.getMetadata(); + gatewayConfig = builder.getGatewayConfig(); + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static Device of(String id, String name, String numId, List credentials, + String lastHeartbeatTime, String lastEventTime, String lastStateTime, String lastConfigAckTime, + String lastConfigSendTime, boolean blocked, String lastErrorTime, Status lastErrorStatus, + DeviceConfig config, DeviceState state, LogLevel logLevel, Map metadata, + GatewayConfig gatewayConfig) { + + return newBuilder().setId(id).setName(name).setNumId(numId).setCredentials(credentials) + .setLastHeartbeatTime(lastHeartbeatTime).setLastEventTime(lastEventTime).setLastStateTime(lastStateTime) + .setLastConfigAckTime(lastConfigAckTime).setLastConfigSendTime(lastConfigSendTime).setBlocked(blocked) + .setLastErrorTime(lastErrorTime).setLastErrorStatus(lastErrorStatus).setConfig(config).setState(state) + .setLogLevel(logLevel).setMetadata(metadata).setGatewayConfig(gatewayConfig).build(); + } + + public static Device patch(String id, String name, LogLevel logLevel, boolean blocked) { + return newBuilder().setId(id).setName(name).setLogLevel(logLevel).setBlocked(blocked).build(); + } + + public static String format(String id, String name, String numId, List credentials, + String lastHeartbeatTime, String lastEventTime, String lastStateTime, String lastConfigAckTime, + String lastConfigSendTime, boolean blocked, String lastErrorTime, Status lastErrorStatus, + DeviceConfig config, DeviceState state, LogLevel logLevel, Map metadata, + GatewayConfig gatewayConfig) { + + return newBuilder().setId(id).setName(name).setNumId(numId).setCredentials(credentials) + .setLastHeartbeatTime(lastHeartbeatTime).setLastEventTime(lastEventTime).setLastStateTime(lastStateTime) + .setLastConfigAckTime(lastConfigAckTime).setLastConfigSendTime(lastConfigSendTime).setBlocked(blocked) + .setLastErrorTime(lastErrorTime).setLastErrorStatus(lastErrorStatus).setConfig(config).setState(state) + .setLogLevel(logLevel).setMetadata(metadata).setGatewayConfig(gatewayConfig).build().toString(); + } + + /** + * Builder for setting Device - id, name, credentials and logLevel + */ + public static class Builder { + private String id; + private String name; + private String numId; + private List credentials; + private String lastHeartbeatTime; + private String lastEventTime; + private String lastStateTime; + private String lastConfigAckTime; + private String lastConfigSendTime; + private boolean blocked; + private String lastErrorTime; + private Status lastErrorStatus; + private DeviceConfig config; + private DeviceState state; + private LogLevel logLevel; + private Map metadata; + private GatewayConfig gatewayConfig; + + protected Builder() { + + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public String getNumId() { + return numId; + } + + public List getCredentials() { + return credentials; + } + + public String getLastHeartbeatTime() { + return lastHeartbeatTime; + } + + public String getLastEventTime() { + return lastEventTime; + } + + public String getLastStateTime() { + return lastStateTime; + } + + public String getLastConfigAckTime() { + return lastConfigAckTime; + } + + public String getLastConfigSendTime() { + return lastConfigSendTime; + } + + public boolean isBlocked() { + return blocked; + } + + public String getLastErrorTime() { + return lastErrorTime; + } + + public Status getLastErrorStatus() { + return lastErrorStatus; + } + + public DeviceConfig getConfig() { + return config; + } + + public DeviceState getState() { + return state; + } + + public Map getMetadata() { + return metadata; + } + + public GatewayConfig getGatewayConfig() { + return gatewayConfig; + } + + public LogLevel getLogLevel() { + return logLevel; + } + + public static Builder newBuilder() { + return newBuilder(); + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setNumId(String numId) { + this.numId = numId; + return this; + } + + public Builder setCredentials(List credentials) { + this.credentials = credentials; + return this; + } + + public Builder setLastErrorStatus(Status lastErrorStatus) { + this.lastErrorStatus = lastErrorStatus; + return this; + } + + public Builder setConfig(DeviceConfig config) { + this.config = config; + return this; + } + + public Builder setLogLevel(LogLevel logLevel) { + this.logLevel = logLevel; + return this; + } + + public Builder setState(DeviceState state) { + this.state = state; + return this; + } + + public Builder setMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public Builder setGatewayConfig(GatewayConfig gatewayConfig) { + this.gatewayConfig = gatewayConfig; + return this; + } + + public Builder setBlocked(boolean blocked) { + this.blocked = blocked; + return this; + } + + public Builder setLastHeartbeatTime(String lastHeartbeatTime) { + this.lastHeartbeatTime = lastHeartbeatTime; + return this; + } + + public Builder setLastEventTime(String lastEventTime) { + this.lastEventTime = lastEventTime; + return this; + } + + public Builder setLastStateTime(String lastStateTime) { + this.lastStateTime = lastStateTime; + return this; + } + + public Builder setLastConfigAckTime(String lastConfigAckTime) { + this.lastConfigAckTime = lastConfigAckTime; + return this; + } + + public Builder setLastConfigSendTime(String lastConfigSendTime) { + this.lastConfigSendTime = lastConfigSendTime; + return this; + } + + public Builder setLastErrorTime(String lastErrorTime) { + this.lastErrorTime = lastErrorTime; + return this; + } + + private Builder(Device device) { + this.id = device.id; + this.name = device.name; + this.numId = device.numId; + this.credentials = device.credentials; + this.lastHeartbeatTime = device.lastHeartbeatTime; + this.lastEventTime = device.lastEventTime; + this.lastStateTime = device.lastStateTime; + this.lastConfigAckTime = device.lastConfigAckTime; + this.lastConfigSendTime = device.lastConfigSendTime; + this.blocked = device.blocked; + this.lastErrorTime = device.lastErrorTime; + this.lastErrorStatus = device.lastErrorStatus; + this.config = device.config; + this.state = device.state; + this.logLevel = device.logLevel; + this.metadata = device.metadata; + this.gatewayConfig = device.gatewayConfig; + } + + public Device build() { + return new Device(this); + } + } + + @Override + public String toString() { + String deviceStr = ""; + deviceStr = deviceStr.concat("id=" + this.id + ",name=" + this.name + ",numId=" + this.numId + ",credentials=" + + this.credentials + ",lastHeartbeatTime=" + this.lastHeartbeatTime + ",lastEventTime=" + + this.lastEventTime + ",lastStateTime=" + this.lastStateTime + ",lastConfigAckTime=" + + this.lastConfigAckTime + ",lastConfigSendTime=" + this.lastConfigSendTime + ",blocked=" + this.blocked + + ",lastErrorTime=" + this.lastErrorTime + ",lastErrorStatus=" + this.lastErrorStatus + ",config=" + + this.config + ",state=" + this.state + ",logLevel=" + this.logLevel + ",metadata=" + this.metadata + + ",gatewayConfig=" + this.gatewayConfig); + return deviceStr; + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + public String createDeviceJSONObject() { + String bodyStr = ""; + JSONObject deviceObj = new JSONObject(); + deviceObj.put("id", this.id); + deviceObj.put("name", this.name); + if (this.numId != null) { + deviceObj.put("numId", this.numId); + } + JSONArray jsonArray = new JSONArray(); + if (this.credentials != null && this.credentials.size() > 0) { + for (int i = 0; i < this.credentials.size(); i++) { + if (!this.credentials.get(i).isEmpty()) { + DeviceCredential credentialObj = this.credentials.get(i); + jsonArray.add(credentialObj.toJSONObject()); + } + } + } + deviceObj.put("credentials", jsonArray); + deviceObj.put("gatewayConfig", this.gatewayConfig.toJSONObject()); + deviceObj.put("logLevel", this.logLevel.name()); + + if (this.lastHeartbeatTime != null) { + deviceObj.put("lastHeartbeatTime", this.lastHeartbeatTime); + } + + if (this.lastEventTime != null) { + deviceObj.put("lastEventTime", this.lastEventTime); + } + + if (this.lastStateTime != null) { + deviceObj.put("lastStateTime", this.lastStateTime); + } + + if (this.lastConfigAckTime != null) { + deviceObj.put("lastConfigAckTime", this.lastConfigAckTime); + } + + if (this.lastConfigSendTime != null) { + deviceObj.put("lastConfigSendTime", this.lastConfigSendTime); + } + + deviceObj.put("blocked", this.blocked); + + if (this.lastErrorTime != null) + deviceObj.put("lastErrorTime", this.lastErrorTime); + + if (this.metadata != null && this.metadata.size() > 0) { + Set metaSet = this.metadata.keySet(); + Iterator itr = metaSet.iterator(); + JSONObject jsonObject = new JSONObject(); + while (itr.hasNext()) { + String key = (String) itr.next(); + String value = this.metadata.get(key).toString(); + jsonObject.put(key, value); + } + deviceObj.put("metadata", jsonObject); + } + + if (this.lastErrorStatus != null && this.lastErrorStatus.getCode() != 0) { + deviceObj.put("lastErrorStatus", this.lastErrorStatus.toJSONObject()); + } + + String lastEventTime = ""; + if (this.lastEventTime != null) { + lastEventTime = this.lastEventTime.toString(); + deviceObj.put("lastEventTime", lastEventTime); + } + + if (this.config != null) { + deviceObj.put("config", this.config.toJSONObject()); + } + + if (this.state != null) { + deviceObj.put("state", this.state.toJSONObject()); + } + + bodyStr = deviceObj.toString(); + return bodyStr; + } + + @SuppressWarnings("rawtypes") + public void loadFromString(String inputStr) { + try { + JSONParser parser = new JSONParser(); + JSONObject deviceObj = (JSONObject) parser.parse(inputStr); + + if (deviceObj != null && deviceObj.size() > 0) { + + Set deviceSet = deviceObj.keySet(); + Iterator itr = deviceSet.iterator(); + while (itr.hasNext()) { + String key = (String) itr.next(); + Object value = deviceObj.get(key); + + if (key.equals("id")) { + this.id = value.toString(); + } + if (key.equals("name")) { + this.name = value.toString(); + } + if (key.equals("numId")) { + this.numId = value.toString(); + } + if (key.equals("lastHeartbeatTime")) { + this.lastHeartbeatTime = value.toString(); + } + if (key.equals("lastEventTime")) { + this.lastEventTime = value.toString(); + } + if (key.equals("lastStateTime")) { + this.lastStateTime = value.toString(); + } + if (key.equals("lastConfigAckTime")) { + this.lastConfigAckTime = value.toString(); + } + if (key.equals("lastConfigSendTime")) { + this.lastConfigSendTime = value.toString(); + } + if (key.equals("blocked")) { + this.blocked = Boolean.valueOf(value.toString()); + } + if (key.equals("lastErrorTime")) { + this.lastErrorTime = value.toString(); + } + if (key.equals("lastErrorStatus")) { + JSONObject errorStatus = (JSONObject) value; + Status status = new Status(); + if (errorStatus.containsKey("code")) + status.setCode(errorStatus.get("code")); + if (errorStatus.containsKey("message")) + status.setMessage((String) errorStatus.get("message")); + this.lastErrorStatus = status; + } + + if (key.equals("config")) { + JSONObject configJsonObject = (JSONObject) value; + DeviceConfig deviceCfg = new DeviceConfig(); + if (configJsonObject.containsKey("version")) + deviceCfg.setVersion((String) configJsonObject.get("version")); + if (configJsonObject.containsKey("cloudUpdateTime")) + deviceCfg.setCloudUpdateTime((String) configJsonObject.get("cloudUpdateTime")); + if (configJsonObject.containsKey("deviceAckTime")) + deviceCfg.setDeviceAckTime((String) configJsonObject.get("deviceAckTime")); + if (configJsonObject.containsKey("binaryData")) + deviceCfg.setBinaryData((String) configJsonObject.get("binaryData")); + this.config = deviceCfg; + } + + if (key.equals("state")) { + JSONObject stateJsonObject = (JSONObject) value; + DeviceState deviceState = new DeviceState(); + if (stateJsonObject.containsKey("binaryData")) + deviceState.setBinaryData((String) stateJsonObject.get("binaryData")); + if (stateJsonObject.containsKey("updateTime")) + deviceState.setUpdateTime((String) stateJsonObject.get("updateTime")); + this.state = deviceState; + } + + if (key.equals("logLevel")) { + if (value != null) { + this.logLevel = LogLevel.valueOf(value.toString()); + } + } + + if (key.equals("metadata")) { + JSONObject metadataJsonObject = (JSONObject) value; + if (metadataJsonObject != null) { + Map metadataMap = new HashMap<>(); + Set metadataSet = metadataJsonObject.keySet(); + if (metadataSet.size() > 0) { + Iterator metadIterator = metadataSet.iterator(); + while (metadIterator.hasNext()) { + String metadataKey = (String) metadIterator.next(); + String metatdataValue = (String) metadataJsonObject.get(metadataKey); + metadataMap.put(metadataKey, metatdataValue); + } + } + + this.metadata = metadataMap; + } + } + if (key.equals("gatewayConfig")) { + JSONObject gatewayConfigJsonObject = (JSONObject) value; + if (gatewayConfigJsonObject != null) { + GatewayConfig gatewayConfig = new GatewayConfig(); + if (gatewayConfigJsonObject.containsKey("gatewayType")) + gatewayConfig.setGatewayType( + GatewayType.valueOf((String) gatewayConfigJsonObject.get("gatewayType"))); + if (gatewayConfigJsonObject.containsKey("gatewayAuthMethod")) + gatewayConfig.setGatewayAuthMethod(GatewayAuthMethod + .valueOf((String) gatewayConfigJsonObject.get("gatewayAuthMethod"))); + if (gatewayConfigJsonObject.containsKey("lastAccessedGatewayId")) + gatewayConfig.setLastAccessedGatewayId( + (String) gatewayConfigJsonObject.get("lastAccessedGatewayId")); + if (gatewayConfigJsonObject.containsKey("lastAccessedGatewayTime")) + gatewayConfig.setLastAccessedGatewayTime( + (String) gatewayConfigJsonObject.get("lastAccessedGatewayTime")); + + this.gatewayConfig = gatewayConfig; + } + } + } + } + + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + } + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceConfig.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceConfig.java new file mode 100644 index 00000000..0de5a855 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceConfig.java @@ -0,0 +1,227 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +import java.time.Instant; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import com.clearblade.cloud.iot.v1.utils.ByteString; +import com.clearblade.cloud.iot.v1.utils.Timestamp; +import com.clearblade.cloud.iot.v1.utils.Utils; + +public class DeviceConfig { + static Logger log = Logger.getLogger(DeviceConfig.class.getName()); + private String version; + private Object cloudUpdateTime; + private Object deviceAckTime; + private Object binaryData; + + public DeviceConfig() { + } + + private DeviceConfig(Builder builder) { + version = builder.version; + cloudUpdateTime = builder.cloudUpdateTime; + deviceAckTime = builder.deviceAckTime; + binaryData = builder.binaryData; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setCloudUpdateTime(String cloudUpdateTime) { + this.cloudUpdateTime = cloudUpdateTime; + } + + public void setDeviceAckTime(String deviceAckTime) { + this.deviceAckTime = deviceAckTime; + } + + public void setBinaryData(String binaryData) { + this.binaryData = binaryData; + } + + public String getVersion() { + return version; + } + + public Object getCloudUpdateTime() { + if (Utils.isBinary()) { + if (!Utils.isEmpty(cloudUpdateTime)) { + Instant timeStamp = Instant.parse(cloudUpdateTime.toString()); + return new Timestamp(timeStamp.getEpochSecond(), timeStamp.getNano()); + } else { + return new Timestamp(0, 0); + } + } else + return (cloudUpdateTime != null ? cloudUpdateTime.toString() : ""); + } + + public Object getDeviceAckTime() { + if (Utils.isBinary()) { + if (!Utils.isEmpty(deviceAckTime)) { + Instant timeStamp = Instant.parse(deviceAckTime.toString()); + return new Timestamp(timeStamp.getEpochSecond(), timeStamp.getNano()); + } else { + return new Timestamp(0, 0); + } + } else + return (deviceAckTime != null ? deviceAckTime.toString() : ""); + } + + public Object getBinaryData() { + if (Utils.isBinary()) + return ByteString.copyFromUtf8(!Utils.isEmpty(binaryData) ? binaryData.toString() : ""); + else + return (binaryData != null ? binaryData.toString() : ""); + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static class Builder { + private String version; + private Object cloudUpdateTime; + private Object deviceAckTime; + private Object binaryData; + + protected Builder() { + + } + + public String getVersion() { + return version; + } + + public Builder setVersion(String version) { + this.version = version; + return this; + } + + public Object getCloudUpdateTime() { + if (Utils.isBinary()) { + if (!Utils.isEmpty(cloudUpdateTime)) { + Instant timeStamp = Instant.parse(cloudUpdateTime.toString()); + return new Timestamp(timeStamp.getEpochSecond(), timeStamp.getNano()); + } else { + return new Timestamp(0, 0); + } + } else + return (cloudUpdateTime != null ? cloudUpdateTime.toString() : ""); + } + + public Builder setCloudUpdateTime(String cloudUpdateTime) { + this.cloudUpdateTime = cloudUpdateTime; + return this; + } + + public Object getDeviceAckTime() { + if (Utils.isBinary()) { + if (!Utils.isEmpty(deviceAckTime)) { + Instant timeStamp = Instant.parse(deviceAckTime.toString()); + return new Timestamp(timeStamp.getEpochSecond(), timeStamp.getNano()); + } else { + return new Timestamp(0, 0); + } + } else + return (deviceAckTime != null ? deviceAckTime.toString() : ""); + } + + public Builder setDeviceAckTime(String deviceAckTime) { + this.deviceAckTime = deviceAckTime; + return this; + } + + public Object getBinaryData() { + if (Utils.isBinary()) + return ByteString.copyFromUtf8(!Utils.isEmpty(binaryData) ? binaryData.toString() : ""); + else + return (binaryData != null ? binaryData.toString() : ""); + } + + public Builder setBinaryData(String binaryData) { + this.binaryData = binaryData; + return this; + } + + private Builder(DeviceConfig deviceConfig) { + this.version = deviceConfig.version; + this.cloudUpdateTime = deviceConfig.cloudUpdateTime; + this.deviceAckTime = deviceConfig.deviceAckTime; + this.binaryData = deviceConfig.binaryData; + } + + public DeviceConfig build() { + return new DeviceConfig(this); + } + } + + public void loadFromString(String jsonString) { + try { + JSONParser jsonParser = new JSONParser(); + JSONObject jsonObj = (JSONObject) jsonParser.parse(jsonString); + this.version = (String) jsonObj.get("version"); + this.cloudUpdateTime = (String) jsonObj.get("cloudUpdateTime"); + this.deviceAckTime = (String) jsonObj.get("deviceAckTime"); + this.binaryData = (String) jsonObj.get("binaryData"); + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + } + } + + @SuppressWarnings("unchecked") + public JSONObject toJSONObject() { + JSONObject jsonObject = new JSONObject(); + if (this.getVersion() != null) { + jsonObject.put("version", this.getVersion()); + } + if (this.cloudUpdateTime != null) { + jsonObject.put("cloudUpdateTime", this.cloudUpdateTime.toString()); + } + if (this.deviceAckTime != null) { + jsonObject.put("deviceAckTime", this.deviceAckTime.toString()); + } + if (this.binaryData != null) { + jsonObject.put("binaryData", this.binaryData.toString()); + } + return jsonObject; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceCredential.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceCredential.java new file mode 100644 index 00000000..7668ccb2 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceCredential.java @@ -0,0 +1,116 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +import com.clearblade.cloud.iot.v1.utils.Utils; +import org.json.simple.JSONObject; + +import com.clearblade.cloud.iot.v1.registrytypes.PublicKeyCredential; + +public class DeviceCredential { + + private String expirationTime; + ; + private PublicKeyCredential publicKey; + + public DeviceCredential() { + } + + private DeviceCredential(Builder builder) { + expirationTime = builder.expirationTime; + publicKey = builder.publicKey; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static class Builder { + private String expirationTime; + private PublicKeyCredential publicKey; + + protected Builder() { + + } + + public String getExpirationTime() { + return expirationTime; + } + + public Builder setExpirationTime(String expirationTime) { + this.expirationTime = expirationTime; + return this; + } + + public PublicKeyCredential getPublicKey() { + return publicKey; + } + + public Builder setPublicKey(PublicKeyCredential publicKey) { + this.publicKey = publicKey; + return this; + } + + private Builder(DeviceCredential deviceCredential) { + this.expirationTime = deviceCredential.expirationTime; + this.publicKey = deviceCredential.publicKey; + } + + public DeviceCredential build() { + return new DeviceCredential(this); + } + } + + public void setExpirationTime(String expirationTime) { + this.expirationTime = expirationTime; + } + + public void setPublicKey(PublicKeyCredential publicKey) { + this.publicKey = publicKey; + } + + public boolean isEmpty() { + return publicKey == null; + } + + public JSONObject toJSONObject() { + JSONObject jsonObject = new JSONObject(); + if (!Utils.isEmpty(this.expirationTime)) { + jsonObject.put("expirationTime", this.expirationTime); + } + jsonObject.put("publicKey", this.publicKey.toJSONObject()); + return jsonObject; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceName.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceName.java new file mode 100644 index 00000000..ee1f2c1b --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceName.java @@ -0,0 +1,166 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +import com.clearblade.cloud.iot.v1.utils.PathTemplate; + +import java.util.Map; + +public class DeviceName { + + private static final PathTemplate PROJECT_LOCATION_REGISTRY_DEVICE = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/registries/{registry}/devices/{device}"); + private final String project; + private final String location; + private final String registry; + private final String device; + + protected DeviceName() { + project = null; + location = null; + registry = null; + device = null; + } + + private DeviceName(Builder builder) { + project = builder.getProject(); + location = builder.getLocation(); + registry = builder.getRegistry(); + device = builder.getDevice(); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getRegistry() { + return registry; + } + + public String getDevice() { + return device; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static DeviceName of(String project, String location, String registry, String device) { + return newBuilder().setProject(project).setLocation(location).setRegistry(registry).setDevice(device).build(); + } + + public static String format(String project, String location, String registry, String device) { + return newBuilder().setProject(project).setLocation(location).setRegistry(registry).setDevice(device).build() + .toString(); + } + + public static DeviceName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } else { + Map matchMap = PROJECT_LOCATION_REGISTRY_DEVICE.validatedMatch(formattedString, "DeviceName.parse: formattedString not in valid format"); + return of((String) matchMap.get("project"), (String) matchMap.get("location"), (String) matchMap.get("registry"), (String) matchMap.get("device")); + } + } + + /** + * Builder for + * projects/{project}/locations/{location}/registries/{registry}/devices/{device}. + */ + public static class Builder { + private String project; + private String location; + private String registry; + private String device; + + protected Builder() { + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getRegistry() { + return registry; + } + + public String getDevice() { + return device; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setRegistry(String registry) { + this.registry = registry; + return this; + } + + public Builder setDevice(String device) { + this.device = device; + return this; + } + + private Builder(DeviceName deviceName) { + this.project = deviceName.project; + this.location = deviceName.location; + this.registry = deviceName.registry; + this.device = deviceName.device; + } + + public DeviceName build() { + return new DeviceName(this); + } + } + + @Override + public String toString() { + return PROJECT_LOCATION_REGISTRY_DEVICE.instantiate(new String[]{"project", this.project, "location", this.location, "registry", this.registry, "device", this.device}); + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceState.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceState.java new file mode 100644 index 00000000..f4beb8ff --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/DeviceState.java @@ -0,0 +1,154 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +import java.time.Instant; + +import org.json.simple.JSONObject; + +import com.clearblade.cloud.iot.v1.utils.ByteString; +import com.clearblade.cloud.iot.v1.utils.Timestamp; +import com.clearblade.cloud.iot.v1.utils.Utils; + +public class DeviceState { + private Object updateTime; + private Object binaryData; + + public DeviceState(Builder builder) { + updateTime = builder.updateTime; + binaryData = builder.getBinaryData(); + } + + public DeviceState() { + + } + + public Object getBinaryData() { + if (Utils.isBinary()) + return ByteString.copyFromUtf8(!Utils.isEmpty(binaryData) ? binaryData.toString() : ""); + else + return (binaryData != null ? binaryData.toString() : ""); + } + + public Object getUpdateTime() { + if (Utils.isBinary()) { + if (!Utils.isEmpty(updateTime)) { + Instant timeStamp = Instant.parse(updateTime.toString()); + return new Timestamp(timeStamp.getEpochSecond(), timeStamp.getNano()); + } else { + return new Timestamp(0, 0); + } + } else + return (updateTime != null ? updateTime.toString() : ""); + } + + public void setUpdateTime(Object updateTime) { + this.updateTime = updateTime; + } + + public void setBinaryData(Object binaryData) { + this.binaryData = binaryData; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static class Builder { + private Object binaryData; + private Object updateTime; + + protected Builder() { + } + + public Object getUpdateTime() { + if (Utils.isBinary()) { + if (!Utils.isEmpty(updateTime)) { + Instant timeStamp = Instant.parse(updateTime.toString()); + return new Timestamp(timeStamp.getEpochSecond(), timeStamp.getNano()); + } else { + return new Timestamp(0, 0); + } + } else + return (updateTime != null ? updateTime.toString() : ""); + } + + public Builder setUpdateTime(String updateTime) { + this.updateTime = updateTime.toString(); + return this; + } + + public Object getBinaryDataByte() { + return binaryData; + } + + public Object getBinaryData() { + if (Utils.isBinary()) + return ByteString.copyFromUtf8(!Utils.isEmpty(binaryData) ? binaryData.toString() : ""); + else + return (binaryData != null ? binaryData.toString() : ""); + } + + public Builder setBinaryData(String binaryData) { + this.binaryData = binaryData.toString(); + return this; + } + + private Builder(DeviceState deviceState) { + this.updateTime = deviceState.updateTime; + this.binaryData = deviceState.binaryData; + } + + public DeviceState build() { + return new DeviceState(this); + } + } + + @SuppressWarnings("unchecked") + public JSONObject toJSONObject() { + JSONObject jsonObject = new JSONObject(); + if (this.getUpdateTime() != null) { + jsonObject.put("updateTime", this.updateTime.toString()); + } else { + jsonObject.put("updateTime", ""); + } + if (this.getBinaryData() != null) { + jsonObject.put("binaryData", this.binaryData.toString()); + } else { + jsonObject.put("binaryData", ""); + } + return jsonObject; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/FieldMask.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/FieldMask.java new file mode 100644 index 00000000..d1bc99e8 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/FieldMask.java @@ -0,0 +1,85 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +public class FieldMask { + + private final String name; + + public FieldMask() { + name = ""; + } + + private FieldMask(Builder builder) { + name = builder.getFieldmask(); + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static class Builder { + private String name; + + protected Builder() { + + } + + public String getFieldmask() { + return name; + } + + public Builder setFieldmask(String fieldmask) { + this.name = fieldmask; + return this; + } + + private Builder(FieldMask fieldMask) { + this.name = fieldMask.name; + } + + public FieldMask build() { + return new FieldMask(this); + } + } + + @Override + public String toString() { + if (this.name != null) + return this.name; + else + return ""; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayAuthMethod.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayAuthMethod.java new file mode 100644 index 00000000..ad083f91 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayAuthMethod.java @@ -0,0 +1,92 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +public enum GatewayAuthMethod { + + GATEWAY_AUTH_METHOD_UNSPECIFIED(0), + ASSOCIATION_ONLY(1), + DEVICE_AUTH_TOKEN_ONLY(2), + ASSOCIATION_AND_DEVICE_AUTH_TOKEN(3), + UNRECOGNIZED(-1), + ; + + public static final int GATEWAY_AUTH_METHOD_UNSPECIFIED_VALUE = 0; + public static final int ASSOCIATION_ONLY_VALUE = 1; + public static final int DEVICE_AUTH_TOKEN_ONLY_VALUE = 2; + public static final int ASSOCIATION_AND_DEVICE_AUTH_TOKEN_VALUE = 3; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static GatewayAuthMethod valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static GatewayAuthMethod forNumber(int value) { + switch (value) { + case 0: + return GATEWAY_AUTH_METHOD_UNSPECIFIED; + case 1: + return ASSOCIATION_ONLY; + case 2: + return DEVICE_AUTH_TOKEN_ONLY; + case 3: + return ASSOCIATION_AND_DEVICE_AUTH_TOKEN; + default: + return null; + } + } + + public GatewayAuthMethod findValueByNumber(int number) { + return GatewayAuthMethod.forNumber(number); + } + + private final int value; + + private GatewayAuthMethod(int value) { + this.value = value; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayConfig.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayConfig.java new file mode 100644 index 00000000..29e27b70 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayConfig.java @@ -0,0 +1,157 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +import org.json.simple.JSONObject; + +public class GatewayConfig { + + private GatewayType gatewayType; + private GatewayAuthMethod gatewayAuthMethod; + private String lastAccessedGatewayId; + private String lastAccessedGatewayTime; + + private static final GatewayConfig DEFAULT_INSTANCE = new GatewayConfig(); + + public GatewayConfig() { + } + + public GatewayType getGatewayType() { + return gatewayType; + } + + public GatewayAuthMethod getGatewayAuthMethod() { + return gatewayAuthMethod; + } + + public String getLastAccessedGatewayId() { + return lastAccessedGatewayId; + } + + public String getLastAccessedGatewayTime() { + return lastAccessedGatewayTime; + } + + public void setGatewayType(GatewayType gatewayType) { + this.gatewayType = gatewayType; + } + + public void setGatewayAuthMethod(GatewayAuthMethod gatewayAuthMethod) { + this.gatewayAuthMethod = gatewayAuthMethod; + } + + public void setLastAccessedGatewayId(String lastAccessedGatewayId) { + this.lastAccessedGatewayId = lastAccessedGatewayId; + } + + public void setLastAccessedGatewayTime(String lastAccessedGatewayTime) { + this.lastAccessedGatewayTime = lastAccessedGatewayTime; + } + + private GatewayConfig(Builder builder) { + gatewayType = builder.gatewayType; + gatewayAuthMethod = builder.gatewayAuthMethod; + lastAccessedGatewayId = builder.lastAccessedGatewayId; + lastAccessedGatewayTime = builder.lastAccessedGatewayTime; + } + + public static Builder newBuilder() { + return new GatewayConfig.Builder(); + } + + public Builder toBuilder() { + return new GatewayConfig.Builder(); + } + + public static GatewayConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + public static class Builder { + private GatewayType gatewayType; + private GatewayAuthMethod gatewayAuthMethod; + private String lastAccessedGatewayId; + private String lastAccessedGatewayTime; + + protected Builder() { + } + + private Builder(GatewayConfig gatewayConfig) { + this.gatewayType = gatewayConfig.gatewayType; + this.gatewayAuthMethod = gatewayConfig.gatewayAuthMethod; + this.lastAccessedGatewayId = gatewayConfig.lastAccessedGatewayId; + this.lastAccessedGatewayTime = gatewayConfig.lastAccessedGatewayTime; + } + + public Builder setGatewayType(GatewayType gatewayType) { + this.gatewayType = gatewayType; + return this; + } + + public Builder setGatewayAuthMethod(GatewayAuthMethod gatewayAuthMethod) { + this.gatewayAuthMethod = gatewayAuthMethod; + return this; + } + + public Builder setLastAccessedGatewayId(String lastAccessedGatewayId) { + this.lastAccessedGatewayId = lastAccessedGatewayId; + return this; + } + + + public Builder setLastAccessedGatewayTime(String lastAccessedGatewayTime) { + this.lastAccessedGatewayTime = lastAccessedGatewayTime; + return this; + } + + public GatewayConfig build() { + return new GatewayConfig(this); + } + } + + public JSONObject toJSONObject() { + final JSONObject jsonObject = new JSONObject(); + if (this.getGatewayAuthMethod() != null) { + jsonObject.put("gatewayAuthMethod", this.getGatewayAuthMethod().name()); + } + if (this.getGatewayType() != null) { + jsonObject.put("gatewayType", this.getGatewayType().name()); + } + if (this.getLastAccessedGatewayId() != null) { + jsonObject.put("gatewayAuthMethod", this.getLastAccessedGatewayId()); + } + if (this.getLastAccessedGatewayTime() != null) { + jsonObject.put("lastAccessedGatewayTime", this.getLastAccessedGatewayTime()); + } + return jsonObject; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayListOptions.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayListOptions.java new file mode 100644 index 00000000..22f8cc5d --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayListOptions.java @@ -0,0 +1,114 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +public class GatewayListOptions { + + private GatewayType gatewayType; + private String associationsGatewayId; + private String associationsDeviceId; + + public GatewayListOptions() { + } + + public GatewayType getGatewayType() { + return gatewayType; + } + + public String getAssociationsGatewayId() { + return associationsGatewayId; + } + + public String getAssociationsDeviceId() { + return associationsDeviceId; + } + + public void setGatewayType(GatewayType gatewayType) { + this.gatewayType = gatewayType; + } + + public void setAssociationsGatewayId(String associationsGatewayId) { + this.associationsGatewayId = associationsGatewayId; + } + + public void setAssociationsDeviceId(String associationsDeviceId) { + this.associationsDeviceId = associationsDeviceId; + } + + private GatewayListOptions(Builder builder) { + gatewayType = builder.gatewayType; + associationsDeviceId = builder.associationsDeviceId; + associationsGatewayId = builder.associationsGatewayId; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static class Builder { + private GatewayType gatewayType; + private String associationsGatewayId; + private String associationsDeviceId; + + protected Builder() { + } + + private Builder(GatewayListOptions gatewayListOptions) { + this.gatewayType = gatewayListOptions.gatewayType; + this.associationsDeviceId = gatewayListOptions.associationsDeviceId; + this.associationsGatewayId = gatewayListOptions.associationsGatewayId; + } + + public Builder setGatewayType(GatewayType gatewayType) { + this.gatewayType = gatewayType; + return this; + } + + public Builder setAssociationsGatewayId(String associationsGatewayId) { + this.associationsGatewayId = associationsGatewayId; + return this; + } + + public Builder setAssociationsDeviceId(String associationsDeviceId) { + this.associationsDeviceId = associationsDeviceId; + return this; + } + + public GatewayListOptions build() { + return new GatewayListOptions(this); + } + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayType.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayType.java new file mode 100644 index 00000000..39305c75 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/GatewayType.java @@ -0,0 +1,88 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +public enum GatewayType { + + GATEWAY_TYPE_UNSPECIFIED(0), + GATEWAY(1), + NON_GATEWAY(2), + UNRECOGNIZED(-1), + ; + + public static final int GATEWAY_TYPE_UNSPECIFIED_VALUE = 0; + public static final int GATEWAY_VALUE = 1; + public static final int NON_GATEWAY_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static GatewayType valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static GatewayType forNumber(int value) { + switch (value) { + case 0: + return GATEWAY_TYPE_UNSPECIFIED; + case 1: + return GATEWAY; + case 2: + return NON_GATEWAY; + default: + return null; + } + } + + public GatewayType findValueByNumber(int number) { + return GatewayType.forNumber(number); + } + + private final int value; + + private GatewayType(int value) { + this.value = value; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/Status.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/Status.java new file mode 100644 index 00000000..60032068 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/devicetypes/Status.java @@ -0,0 +1,141 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.devicetypes; + +import java.util.List; + +import org.json.simple.JSONObject; + +public class Status { + private int code; + private String message; + private List details; + + public Status() { + } + + private Status(Builder builder) { + code = builder.code; + message = builder.message; + details = builder.details; + } + + public void setCode(Object code) { + if (code != null) + this.code = Integer.parseInt(code.toString()); + } + + public void setMessage(String message) { + this.message = message; + } + + public void setDetails(List details) { + this.details = details; + } + + public int getCode() { + return code; + } + + public String getMessage() { + return message; + } + + public List getDetails() { + return details; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static class Builder { + private int code; + private String message; + private List details; + + protected Builder() { + } + + public int getCode() { + return code; + } + + public Builder setCode(int code) { + this.code = code; + return this; + } + + public String getMessage() { + return message; + } + + public Builder setMessage(String message) { + this.message = message; + return this; + } + + public List getDetails() { + return details; + } + + public Builder setDetails(List details) { + this.details = details; + return this; + } + + private Builder(Status status) { + this.code = status.code; + this.message = status.message; + this.details = status.details; + } + + public Status build() { + return new Status(this); + } + } + + public JSONObject toJSONObject() { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("code", this.getCode()); + if (this.getMessage() != null) { + jsonObject.put("message", this.getMessage()); + } else { + jsonObject.put("message", ""); + } + return jsonObject; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/exception/ApplicationException.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/exception/ApplicationException.java new file mode 100644 index 00000000..3bd35c9e --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/exception/ApplicationException.java @@ -0,0 +1,57 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.exception; + +public class ApplicationException extends RuntimeException { + /** + * + */ + private static final long serialVersionUID = 1L; + + private static final String defaultMessage = "RuntimeException"; + + public ApplicationException() { + super(defaultMessage); + } + + public ApplicationException(String errorMessage) { + super(errorMessage); + } + + public ApplicationException(Throwable throwable) { + super(throwable); + } + + public ApplicationException(String message, Throwable throwable) { + // super(message, throwable); + super(message, throwable, true, true); + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/getdevice/GetDeviceRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/getdevice/GetDeviceRequest.java new file mode 100644 index 00000000..1048116d --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/getdevice/GetDeviceRequest.java @@ -0,0 +1,112 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.getdevice; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.devicetypes.FieldMask; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import java.net.URLEncoder; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class GetDeviceRequest { + + private final DeviceName name; + private final FieldMask fieldMask; + + private GetDeviceRequest(Builder builder) { + this.name = builder.name; + this.fieldMask = builder.fieldMask; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private DeviceName name; + private FieldMask fieldMask; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public FieldMask getFieldMask() { + return fieldMask; + } + + public Builder setFieldMask(FieldMask fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + public DeviceName getName() { + return name; + } + + public Builder setName(DeviceName name) { + this.name = name; + return this; + } + + // build method to deal with outer class + // to return outer instance + public GetDeviceRequest build() { + return new GetDeviceRequest(this); + } + } + + public DeviceName getName() { + return this.name; + } + + @Override + public String toString() { + String params = ""; + try { + params = "name=" + URLEncoder.encode(this.name.toString(),"UTF-8") ; + } catch (Exception e) { + throw new ApplicationException(e); + } + if (this.fieldMask.toString() != "") { + params += "&fieldMask=" + URLEncoder.encode(this.fieldMask.toString(), StandardCharsets.UTF_8); + } + return params; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/getdeviceregistry/GetDeviceRegistryRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/getdeviceregistry/GetDeviceRegistryRequest.java new file mode 100644 index 00000000..d8ecc042 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/getdeviceregistry/GetDeviceRegistryRequest.java @@ -0,0 +1,81 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.getdeviceregistry; + +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class GetDeviceRegistryRequest { + + private final String name; + + private GetDeviceRegistryRequest(Builder builder) { + this.name = builder.name; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String name; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setName(String name) { + this.name = name; + return this; + } + + // build method to deal with outer class + // to return outer instance + public GetDeviceRegistryRequest build() { + return new GetDeviceRegistryRequest(this); + } + } + + public RegistryName getName() { + return RegistryName.parse(this.name); + } + + @Override + public String toString() { + return "name=" + URLEncoder.encode(this.name, StandardCharsets.UTF_8); + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceconfigversions/ListDeviceConfigVersionsRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceconfigversions/ListDeviceConfigVersionsRequest.java new file mode 100644 index 00000000..1654e868 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceconfigversions/ListDeviceConfigVersionsRequest.java @@ -0,0 +1,117 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.listdeviceconfigversions; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; +import org.json.simple.JSONObject; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; + +public class ListDeviceConfigVersionsRequest { + private final String name; + private final String numVersions; + JSONObject requestParams; + + private ListDeviceConfigVersionsRequest(Builder builder) { + this.name = builder.name; + this.numVersions = builder.numVersions; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String name; + private String numVersions; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setNumVersions(int numVersions) { + this.numVersions = String.valueOf(numVersions); + return this; + } + + // build method to deal with outer class + // to return outer instance + public ListDeviceConfigVersionsRequest build() { + return new ListDeviceConfigVersionsRequest(this); + } + + } + + public JSONObject getRequestParams() { + return requestParams; + } + + public void setRequestParams(JSONObject requestParams) { + this.requestParams = requestParams; + } + + public DeviceName getName() { + return DeviceName.parse(this.name); + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + requestParams = new JSONObject(); + requestParams.put("name", this.name); + requestParams.put("numVersions", this.numVersions); + this.setRequestParams(requestParams); + return "name=" + this.name + ",numVersions=" + this.numVersions; + } + + public String getParamsForList() { + String params = ""; + try { + params = "name=" + URLEncoder.encode(this.name,"UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new ApplicationException(e); + } + params += "&numVersions=" + this.numVersions; + + return params; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceconfigversions/ListDeviceConfigVersionsResponse.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceconfigversions/ListDeviceConfigVersionsResponse.java new file mode 100644 index 00000000..0b439237 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceconfigversions/ListDeviceConfigVersionsResponse.java @@ -0,0 +1,113 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.listdeviceconfigversions; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; + +public class ListDeviceConfigVersionsResponse { + + static Logger log = Logger.getLogger(ListDeviceConfigVersionsResponse.class.getName()); + private List deviceConfigList = new ArrayList<>(); + + protected ListDeviceConfigVersionsResponse(Builder builder) { + this.deviceConfigList = builder.deviceConfigList; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private List deviceConfigList = new ArrayList<>(); + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setDeviceConfigVersionsListRequest(ListDeviceConfigVersionsRequest request) { + return this; + } + + public Builder buildResponse(String configList) { + try { + JSONObject jsonObj = new JSONObject(); + JSONParser jsonParser = new JSONParser(); + jsonObj = (JSONObject) (jsonParser.parse(configList)); + + JSONArray configArray = (JSONArray) jsonObj.get("deviceConfigs"); + @SuppressWarnings("rawtypes") + Iterator configIterator = configArray.iterator(); + while (configIterator.hasNext()) { + JSONObject configJson = (JSONObject) configIterator.next(); + DeviceConfig configObj = DeviceConfig.newBuilder() + .setBinaryData((String) configJson.get("binaryData")) + .setCloudUpdateTime((String) configJson.get("cloudUpdateTime")) + .setDeviceAckTime((String) configJson.get("deviceAckTime")) + .setVersion((String) configJson.get("version")) + .build(); + deviceConfigList.add(configObj); + } + + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + } + return this; + } + + // build method to deal with outer class + // to return outer instance + public ListDeviceConfigVersionsResponse build() { + return new ListDeviceConfigVersionsResponse(this); + } + } + + public List getDeviceConfigList() { + return deviceConfigList; + } + + public void setDeviceConfigList(List deviceConfigList) { + this.deviceConfigList = deviceConfigList; + } + +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceregistries/ListDeviceRegistriesRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceregistries/ListDeviceRegistriesRequest.java new file mode 100644 index 00000000..f8a24a34 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceregistries/ListDeviceRegistriesRequest.java @@ -0,0 +1,123 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.listdeviceregistries; + +import com.clearblade.cloud.iot.v1.deviceslist.DevicesListRequest; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Locale; + +public class ListDeviceRegistriesRequest { + + private String parent; + private int pageSize = -1; + private String pageToken; + private String fieldMask; + + private ListDeviceRegistriesRequest(Builder builder) { + + this.parent = builder.parent; + this.pageSize = builder.pageSize; + this.pageToken = builder.pageToken; + this.fieldMask = builder.fieldMask; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String parent; + private int pageSize; + private String pageToken; + private String fieldMask; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setParent(String parent) { + this.parent = parent; + return this; + } + + public Builder setPageSize(int pageSize) { + this.pageSize = pageSize; + return this; + } + + public Builder setPageToken(String pageToken) { + this.pageToken = pageToken; + return this; + } + + public Builder setFieldMask(String fieldMask) { + this.fieldMask = fieldMask; + return this; + } + + // build method to deal with outer class + // to return outer instance + public ListDeviceRegistriesRequest build() { + return new ListDeviceRegistriesRequest(this); + } + + } + + public LocationName getParent() { + return LocationName.parse(this.parent); + } + + @Override + public String toString() { + return this.parent.toString(); + } + + public String getParamsForList() { + String params = ""; + params = "parent=" + this.parent; + if (this.fieldMask != null) + params += "&fieldMask=" + URLEncoder.encode(this.fieldMask, StandardCharsets.UTF_8); + if (this.pageSize > 0) + params += "&pageSize=" + String.valueOf(this.pageSize); + if (this.pageToken != null) + params += "&pageToken=" + this.pageToken; + return params; + } + + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceregistries/ListDeviceRegistriesResponse.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceregistries/ListDeviceRegistriesResponse.java new file mode 100644 index 00000000..c4e3bdde --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/listdeviceregistries/ListDeviceRegistriesResponse.java @@ -0,0 +1,119 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.listdeviceregistries; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; + +public class ListDeviceRegistriesResponse { + static Logger log = Logger.getLogger(ListDeviceRegistriesResponse.class.getName()); + + private String nextPageToken; + private List deviceRegistriesList; + + protected ListDeviceRegistriesResponse(Builder builder) { + this.deviceRegistriesList = builder.deviceRegistriesList; + this.nextPageToken = builder.nextPageToken; + } + + public String getNextPageToken() { + return nextPageToken; + } + + public void setNextPageToken(String nextPageToken) { + this.nextPageToken = nextPageToken; + } + + public List getDeviceRegistriesList() { + return deviceRegistriesList; + } + + public void setDeviceRegistriesList(List deviceRegistriesList) { + this.deviceRegistriesList = deviceRegistriesList; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String nextPageToken; + private List deviceRegistriesList = new ArrayList<>(); + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder buildResponse(String jsonString) { + try { + JSONObject jsonObj = new JSONObject(); + JSONParser jsonParser = new JSONParser(); + jsonObj = (JSONObject) (jsonParser.parse(jsonString)); + + JSONArray deviceRegistriesArray = (JSONArray) jsonObj.get("deviceRegistries"); + @SuppressWarnings("rawtypes") + Iterator deviceRegistryIterate = deviceRegistriesArray.iterator(); + while (deviceRegistryIterate.hasNext()) { + JSONObject deviceRegistryJson = (JSONObject) deviceRegistryIterate.next(); + DeviceRegistry deviceRegistryObj = DeviceRegistry.newBuilder().build(); + deviceRegistryObj.loadFromString(deviceRegistryJson.toString()); + deviceRegistriesList.add(deviceRegistryObj); + } + + if (jsonObj.containsKey("nextPageToken")) + nextPageToken = jsonObj.get("nextPageToken").toString(); + + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + } + return this; + } + + // build method to deal with outer class + // to return outer instance + public ListDeviceRegistriesResponse build() { + return new ListDeviceRegistriesResponse(this); + } + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/modifycloudtodeviceconfig/ModifyCloudToDeviceConfigRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/modifycloudtodeviceconfig/ModifyCloudToDeviceConfigRequest.java new file mode 100644 index 00000000..73359f88 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/modifycloudtodeviceconfig/ModifyCloudToDeviceConfigRequest.java @@ -0,0 +1,138 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.modifycloudtodeviceconfig; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.Arrays; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; +import org.json.simple.JSONObject; + +import com.clearblade.cloud.iot.v1.utils.ByteString; + +public class ModifyCloudToDeviceConfigRequest { + + private String deviceName; + private String versionToUpdate; + private ByteString binaryData; + private byte[] binaryDataByte; + + private ModifyCloudToDeviceConfigRequest(Builder builder) { + this.deviceName = builder.deviceName; + this.versionToUpdate = builder.versionToUpdate; + this.binaryData = builder.binaryData; + this.binaryDataByte = builder.binaryDataByte; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String deviceName; + private String versionToUpdate; + private ByteString binaryData; + private byte[] binaryDataByte; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setName(String deviceName) { + this.deviceName = deviceName; + return this; + } + + public Builder setVersionToUpdate(String versionToUpdate) { + this.versionToUpdate = versionToUpdate; + return this; + } + + public Builder setBinaryData(ByteString binaryData) { + this.binaryData = binaryData; + return this; + } + + public Builder setBinaryData(byte[] binaryDataByte) { + this.binaryDataByte = binaryDataByte; + return this; + } + + // build method to deal with outer class + // to return outer instance + public ModifyCloudToDeviceConfigRequest build() { + return new ModifyCloudToDeviceConfigRequest(this); + } + } + + public DeviceName getDeviceName() { + return DeviceName.parse(this.deviceName); + } + + @Override + public String toString() { + return "name = " + this.deviceName + ", versionToUpdate = " + this.versionToUpdate; + } + + @SuppressWarnings("unchecked") + public String[] getBodyAndParams() { + String[] output = new String[2]; + String params = null; + try { + params = "name=" + URLEncoder.encode(this.deviceName,"UTF-8") + "&method=modifyCloudToDeviceConfig"; + } catch (UnsupportedEncodingException e) { + throw new ApplicationException(e); + } + String bData = "EMPTY"; + if (this.binaryData != null) { + bData = new String(this.binaryData.toByteArray()); + } else if (this.binaryDataByte != null) { + if (this.binaryDataByte.length == 0) { + bData = "EMPTY"; + } else { + bData = Arrays.toString(this.binaryDataByte); + } + } + JSONObject bodyParams = new JSONObject(); + bodyParams.put("binaryData", bData); + bodyParams.put("versionToUpdate", this.versionToUpdate); + + output[0] = params; + output[1] = bodyParams.toJSONString(); + return output; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/DeviceRegistry.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/DeviceRegistry.java new file mode 100644 index 00000000..62957e80 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/DeviceRegistry.java @@ -0,0 +1,364 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import com.clearblade.cloud.iot.v1.utils.LogLevel; + +//https://cloud.google.com/iot/docs/reference/cloudiot/rest/v1/projects.locations.registries#DeviceRegistry +public class DeviceRegistry { + static Logger log = Logger.getLogger(DeviceRegistry.class.getName()); + + private String id; + private String name; + private List eventNotificationConfigs; + private StateNotificationConfig stateNotificationConfig; + private MqttConfig mqttConfig; + private HttpConfig httpConfig; + private LogLevel logLevel; + private List credentials; + + public DeviceRegistry() { + id = ""; + name = ""; + eventNotificationConfigs = new ArrayList<>(); + stateNotificationConfig = null; + mqttConfig = null; + httpConfig = null; + logLevel = null; + credentials = new ArrayList<>(); + } + + private DeviceRegistry(Builder builder) { + id = builder.getId(); + name = builder.getName(); + eventNotificationConfigs = builder.getEventNotificationConfigs(); + stateNotificationConfig = builder.getStateNotificationConfig(); + mqttConfig = builder.getMqttConfig(); + httpConfig = builder.getHttpConfig(); + logLevel = builder.getLogLevel(); + credentials = builder.getCredentials(); + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static DeviceRegistry of(String id, String name, List eventNotificationConfigs, + StateNotificationConfig stateNotificationConfig, MqttConfig mqttConfig, HttpConfig httpConfig, + LogLevel logLevel, List credentials) { + return newBuilder().setId(id).setName(name).setEventNotificationConfigs(eventNotificationConfigs) + .setStateNotificationConfig(stateNotificationConfig).setMqttConfig(mqttConfig).setHttpConfig(httpConfig) + .setLogLevel(logLevel).setCredentials(credentials).build(); + } + + public static String format(String id, String name, List eventNotificationConfigs, + StateNotificationConfig stateNotificationConfig, MqttConfig mqttConfig, HttpConfig httpConfig, + LogLevel logLevel, List credentials) { + return newBuilder().setId(id).setName(name).setEventNotificationConfigs(eventNotificationConfigs) + .setStateNotificationConfig(stateNotificationConfig).setMqttConfig(mqttConfig).setHttpConfig(httpConfig) + .setLogLevel(logLevel).setCredentials(credentials).build() + .toString(); + } + + /** + * Builder for setting + * Registry - attributes + */ + public static class Builder { + private String id; + private String name; + private List eventNotificationConfigs; + private StateNotificationConfig stateNotificationConfig; + private MqttConfig mqttConfig; + private HttpConfig httpConfig; + private LogLevel logLevel; + private List credentials; + + protected Builder() { + + } + + public static Builder newBuilder() { + return newBuilder(); + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public List getEventNotificationConfigs() { + return eventNotificationConfigs; + } + + public StateNotificationConfig getStateNotificationConfig() { + return stateNotificationConfig; + } + + public MqttConfig getMqttConfig() { + return mqttConfig; + } + + public HttpConfig getHttpConfig() { + return httpConfig; + } + + public LogLevel getLogLevel() { + return logLevel; + } + + public List getCredentials() { + return credentials; + } + + public Builder setId(String id) { + this.id = id; + return this; + } + + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setEventNotificationConfigs(List eventNotificationConfigs) { + this.eventNotificationConfigs = eventNotificationConfigs; + return this; + } + + public Builder setStateNotificationConfig(StateNotificationConfig stateNotificationConfig) { + this.stateNotificationConfig = stateNotificationConfig; + return this; + } + + public Builder setMqttConfig(MqttConfig mqttConfig) { + this.mqttConfig = mqttConfig; + return this; + } + + public Builder setHttpConfig(HttpConfig httpConfig) { + this.httpConfig = httpConfig; + return this; + } + + public Builder setLogLevel(LogLevel logLevel) { + this.logLevel = logLevel; + return this; + } + + public Builder setCredentials(List credentials) { + this.credentials = credentials; + return this; + } + + private Builder(DeviceRegistry registry) { + this.id = registry.id; + this.name = registry.name; + this.eventNotificationConfigs = registry.eventNotificationConfigs; + this.stateNotificationConfig = registry.stateNotificationConfig; + this.mqttConfig = registry.mqttConfig; + this.httpConfig = registry.httpConfig; + this.logLevel = registry.logLevel; + this.credentials = registry.credentials; + } + + public DeviceRegistry build() { + return new DeviceRegistry(this); + } + } + + @Override + public String toString() { + return ("id=" + this.id + ",name=" + this.name + + ",eventNotificationConfigs=" + this.eventNotificationConfigs + + ",stateNotificationConfig=" + this.stateNotificationConfig + + "mqttConfig=" + this.mqttConfig.toBuilder().build() + + ",httpConfig=" + this.httpConfig + + ",logLevel=" + this.logLevel + + ",credentials=" + this.credentials); + } + + @SuppressWarnings("unchecked") + public String createDeviceJSONObject(String parentLocation) { + JSONObject output = new JSONObject(); + + if (id != null) + output.put("id", id); + if (name != null) { + if (!name.startsWith("projects")) + name = parentLocation + "/registries/" + name; + output.put("name", name); + } + if (logLevel != null) + output.put("logLevel", logLevel.name()); + if (httpConfig != null) { + output.put("httpConfig", this.httpConfig.getJsonObject()); + } else { + JSONObject json = new JSONObject(); + json.put("httpEnabledState", "HTTP_ENABLED"); + output.put("httpConfig", json); + } + if (mqttConfig != null) { + output.put("mqttConfig", this.mqttConfig.getJsonObject()); + } else { + JSONObject json = new JSONObject(); + json.put("mqttEnabledState", "MQTT_ENABLED"); + output.put("mqttConfig", json); + } + if (stateNotificationConfig != null) { + output.put("stateNotificationConfig", this.stateNotificationConfig.getJsonObject()); + } else { + JSONObject json = new JSONObject(); + json.put("pubsubTopicName", ""); + output.put("stateNotificationConfig", json); + } + + if (eventNotificationConfigs != null) { + JSONArray eventsArray = new JSONArray(); + for (int i = 0; i < eventNotificationConfigs.size(); i++) { + eventsArray.add(eventNotificationConfigs.get(i).getJsonObject()); + } + output.put("eventNotificationConfigs", eventsArray); + } + + if (credentials != null) { + JSONArray credentialArray = new JSONArray(); + for (int i = 0; i < credentials.size(); i++) { + credentialArray.add(credentials.get(i).getJsonObject()); + } + + output.put("credentials", credentialArray); + } + + return output.toJSONString(); + } + + @SuppressWarnings("rawtypes") + public void loadFromString(String inputStr) { + try { + JSONParser parser = new JSONParser(); + JSONObject deviceObj = (JSONObject) parser.parse(inputStr); + + if (deviceObj != null && deviceObj.size() > 0) { + + Set deviceSet = deviceObj.keySet(); + Iterator itr = deviceSet.iterator(); + while (itr.hasNext()) { + String key = (String) itr.next(); + Object value = deviceObj.get(key); + if (key.equals("id")) { + this.id = value.toString(); + } + if (key.equals("name")) { + this.name = value.toString(); + } + if (key.equals("eventNotificationConfigs")) { + JSONArray eventJsonArray = (JSONArray) value; + List eventNotificationCfgs = new ArrayList<>(); + Iterator eventIterator = eventJsonArray.iterator(); + while (eventIterator.hasNext()) { + JSONObject eventJson = (JSONObject) eventIterator.next(); + EventNotificationConfig eventObj = EventNotificationConfig.newBuilder() + .setSubfolderMatches((String) eventJson.get("subfolderMatches")) + .setPubsubTopicName((String) eventJson.get("pubsubTopicName")) + .build(); + eventNotificationCfgs.add(eventObj); + } + this.eventNotificationConfigs = eventNotificationCfgs; + } + if (key.equals("stateNotificationConfig")) { + JSONObject stateJsonObject = (JSONObject) value; + StateNotificationConfig stateNotificationCfg = new StateNotificationConfig(); + if (stateJsonObject.containsKey("pubsubTopicName")) + stateNotificationCfg.setPubsubTopicName((String) stateJsonObject.get("pubsubTopicName")); + this.stateNotificationConfig = stateNotificationCfg; + } + if (key.equals("mqttConfig")) { + JSONObject mqttJsonObject = (JSONObject) value; + MqttConfig mqttCfg = new MqttConfig(); + if (mqttJsonObject.containsKey("mqttEnabledState")) + mqttCfg.setMqttEnabledState( + MqttState.valueOf((String) mqttJsonObject.get("mqttEnabledState"))); + this.mqttConfig = mqttCfg; + } + if (key.equals("httpConfig")) { + JSONObject httpJsonObject = (JSONObject) value; + HttpConfig httpCfg = new HttpConfig(); + if (httpJsonObject.containsKey("httpEnabledState")) + httpCfg.setHttpEnabledState( + HttpState.valueOf((String) httpJsonObject.get("httpEnabledState"))); + this.httpConfig = httpCfg; + } + if (key.equals("logLevel")) { + if (value != null) { + this.logLevel = LogLevel.valueOf(value.toString()); + } + } + if (key.equals("credentials")) { + JSONArray credJsonArray = (JSONArray) value; + if (credJsonArray != null) { + List registryCredentialsArray = new ArrayList<>(); + Iterator credIterator = credJsonArray.iterator(); + while (credIterator.hasNext()) { + JSONObject credJson = (JSONObject) credIterator.next(); + RegistryCredential registryCredential = RegistryCredential.newBuilder().build(); + registryCredential.loadFromJson(credJson); + registryCredentialsArray.add(registryCredential); + } + credentials = registryCredentialsArray; + } + + } + } + } + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + } + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/EventNotificationConfig.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/EventNotificationConfig.java new file mode 100644 index 00000000..5710a021 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/EventNotificationConfig.java @@ -0,0 +1,129 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import org.json.simple.JSONObject; + +public class EventNotificationConfig { + + private String subfolderMatches; + private String pubsubTopicName; + + public EventNotificationConfig() { + subfolderMatches = ""; + pubsubTopicName = ""; + } + + private EventNotificationConfig(Builder builder) { + subfolderMatches = builder.getSubfolderMatches(); + pubsubTopicName = builder.getPubsubTopicName(); + } + + public String getSubfolderMatches() { + return subfolderMatches; + } + + public void setSubfolderMatches(String subfolderMatches) { + this.subfolderMatches = subfolderMatches; + } + + public String getPubsubTopicName() { + return pubsubTopicName; + } + + public void setPubsubTopicName(String pubsubTopicName) { + this.pubsubTopicName = pubsubTopicName; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Builder for setting + * EventNotificationConfig - subfolderMatches , pubsubTopicName + */ + public static class Builder { + private String subfolderMatches; + private String pubsubTopicName; + + protected Builder() { + + } + + private Builder(EventNotificationConfig eventNotificationConfig) { + this.subfolderMatches = eventNotificationConfig.subfolderMatches; + this.pubsubTopicName = eventNotificationConfig.pubsubTopicName; + } + + public EventNotificationConfig build() { + return new EventNotificationConfig(this); + } + + public String getSubfolderMatches() { + return subfolderMatches; + } + + public Builder setSubfolderMatches(String subfolderMatches) { + this.subfolderMatches = subfolderMatches; + return this; + } + + public String getPubsubTopicName() { + return pubsubTopicName; + } + + public Builder setPubsubTopicName(String pubsubTopicName) { + this.pubsubTopicName = pubsubTopicName; + return this; + } + + } + + @Override + public String toString() { + return "subfolderMatches= " + this.subfolderMatches + ",pubsubTopicName=" + this.pubsubTopicName; + } + + @SuppressWarnings("unchecked") + public JSONObject getJsonObject() { + JSONObject json = new JSONObject(); + json.put("pubsubTopicName", this.pubsubTopicName); + if (this.subfolderMatches != null) { + json.put("subfolderMatches", this.subfolderMatches); + } + return json; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/HttpConfig.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/HttpConfig.java new file mode 100644 index 00000000..3b954a23 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/HttpConfig.java @@ -0,0 +1,104 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import org.json.simple.JSONObject; + +public class HttpConfig { + + private HttpState httpEnabledState; + + public HttpConfig() { + httpEnabledState = HttpState.HTTP_ENABLED; + } + + private HttpConfig(Builder builder) { + this.httpEnabledState = builder.getHttpState(); + } + + public HttpState getHttpEnabledState() { + return httpEnabledState; + } + + public void setHttpEnabledState(HttpState httpEnabledState) { + this.httpEnabledState = httpEnabledState; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Builder for setting + * HttpConfig - httpConfig + */ + public static class Builder { + private HttpState httpState; + + protected Builder() { + + } + + private Builder(HttpConfig config) { + this.httpState = config.httpEnabledState; + } + + public HttpConfig build() { + return new HttpConfig(this); + } + + public HttpState getHttpState() { + return httpState; + } + + public Builder setHttpState(HttpState state) { + this.httpState = state; + return this; + } + + } + + @Override + public String toString() { + return "{'httpEnabledState':'" + this.httpEnabledState + "'}"; + } + + @SuppressWarnings("unchecked") + public JSONObject getJsonObject() { + JSONObject json = new JSONObject(); + json.put("httpEnabledState", this.httpEnabledState.toString()); + return json; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/HttpState.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/HttpState.java new file mode 100644 index 00000000..92dc5d51 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/HttpState.java @@ -0,0 +1,87 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +public enum HttpState { + HTTP_STATE_UNSPECIFIED(0), + HTTP_ENABLED(1), + HTTP_DISABLED(2), + UNRECOGNIZED(-1), + ; + + public static final int HTTP_STATE_UNSPECIFIED_VALUE = 0; + public static final int HTTP_ENABLED_VALUE = 1; + public static final int HTTP_DISABLED_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static HttpState valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static HttpState forNumber(int value) { + switch (value) { + case 0: + return HTTP_STATE_UNSPECIFIED; + case 1: + return HTTP_ENABLED; + case 2: + return HTTP_DISABLED; + default: + return null; + } + } + + public HttpState findValueByNumber(int number) { + return HttpState.forNumber(number); + } + + private final int value; + + private HttpState(int value) { + this.value = value; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/LocationName.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/LocationName.java new file mode 100644 index 00000000..e3d4530f --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/LocationName.java @@ -0,0 +1,136 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import com.clearblade.cloud.iot.v1.utils.PathTemplate; + +import java.util.Map; + +public class LocationName { + + private static final PathTemplate PROJECT_LOCATION = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}"); + + private final String project; + private final String location; + + protected LocationName() { + project = null; + location = null; + } + + private LocationName(Builder builder) { + project = builder.getProject(); + location = 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; + } else { + Map matchMap = PROJECT_LOCATION.validatedMatch(formattedString, "LocationName.parse: formattedString not in valid format"); + return of((String) matchMap.get("project"), (String) matchMap.get("location")); + } + } + + + /** + * Builder for + * projects/{project}/locations/{location}/registries/{registry}. + */ + public static class Builder { + private String project; + private String location; + + protected Builder() { + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + private Builder(LocationName locationName) { + this.project = locationName.project; + this.location = locationName.location; + } + + public LocationName build() { + return new LocationName(this); + } + } + + @Override + public String toString() { + return PROJECT_LOCATION.instantiate(new String[]{"project", this.project, "location", this.location}); + } + + public String getLocationFullName() { + return PROJECT_LOCATION.instantiate(new String[]{"project", this.project, "location", this.location}); + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/MqttConfig.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/MqttConfig.java new file mode 100644 index 00000000..7a5251f2 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/MqttConfig.java @@ -0,0 +1,104 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import org.json.simple.JSONObject; + +public class MqttConfig { + + private MqttState mqttEnabledState; + + public MqttConfig() { + mqttEnabledState = MqttState.MQTT_ENABLED; + } + + private MqttConfig(Builder builder) { + this.mqttEnabledState = builder.mqttEnabledState; + } + + public MqttState getMqttEnabledState() { + return mqttEnabledState; + } + + public void setMqttEnabledState(MqttState mqttEnabledState) { + this.mqttEnabledState = mqttEnabledState; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Builder for setting + * MqttState - mqttEnabledState + */ + public static class Builder { + private MqttState mqttEnabledState; + + protected Builder() { + + } + + private Builder(MqttConfig config) { + this.mqttEnabledState = config.mqttEnabledState; + } + + public MqttConfig build() { + return new MqttConfig(this); + } + + public MqttState getMqttEnabledState() { + return mqttEnabledState; + } + + public Builder setMqttEnabledState(MqttState mqttEnabledState) { + this.mqttEnabledState = mqttEnabledState; + return this; + } + + } + + @Override + public String toString() { + return "{'mqttEnabledState':'" + this.mqttEnabledState + "'}"; + } + + @SuppressWarnings("unchecked") + public JSONObject getJsonObject() { + JSONObject json = new JSONObject(); + json.put("mqttEnabledState", this.mqttEnabledState.toString()); + return json; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/MqttState.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/MqttState.java new file mode 100644 index 00000000..662c1686 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/MqttState.java @@ -0,0 +1,87 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +public enum MqttState { + MQTT_STATE_UNSPECIFIED(0), + MQTT_ENABLED(1), + MQTT_DISABLED(2), + UNRECOGNIZED(-1), + ; + + public static final int MQTT_STATE_UNSPECIFIED_VALUE = 0; + public static final int MQTT_ENABLED_VALUE = 1; + public static final int MQTT_DISABLED_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static MqttState valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static MqttState forNumber(int value) { + switch (value) { + case 0: + return MQTT_STATE_UNSPECIFIED; + case 1: + return MQTT_ENABLED; + case 2: + return MQTT_DISABLED; + default: + return null; + } + } + + public MqttState findValueByNumber(int number) { + return MqttState.forNumber(number); + } + + private final int value; + + private MqttState(int value) { + this.value = value; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCertificate.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCertificate.java new file mode 100644 index 00000000..f20c996d --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCertificate.java @@ -0,0 +1,68 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +public class PublicKeyCertificate { + + private PublicKeyCertificateFormat format; + private String certificate; + private X509CertificateDetails x509Details; + + public PublicKeyCertificateFormat getFormat() { + return format; + } + + public void setFormat(PublicKeyCertificateFormat format) { + this.format = format; + } + + public String getCertificate() { + return certificate; + } + + public void setCertificate(String certificate) { + this.certificate = certificate; + } + + public X509CertificateDetails getX509Details() { + return x509Details; + } + + public void setX509Details(X509CertificateDetails x509Details) { + this.x509Details = x509Details; + } + + @Override + public String toString() { + return "PublicKeyCertificateFormat=" + this.format.toString() + ",Certificate=" + certificate; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCertificateFormat.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCertificateFormat.java new file mode 100644 index 00000000..7481c049 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCertificateFormat.java @@ -0,0 +1,79 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +public enum PublicKeyCertificateFormat { + UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT(0), X509_CERTIFICATE_PEM(1), UNRECOGNIZED(-1),; + + public static final int UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT_VALUE = 0; + public static final int X509_CERTIFICATE_PEM_VALUE = 1; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException("Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static PublicKeyCertificateFormat valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static PublicKeyCertificateFormat forNumber(int value) { + switch (value) { + case 0: + return UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT; + case 1: + return X509_CERTIFICATE_PEM; + default: + return null; + } + } + + public PublicKeyCertificateFormat findValueByNumber(int number) { + return PublicKeyCertificateFormat.forNumber(number); + } + + private final int value; + + private PublicKeyCertificateFormat(int value) { + this.value = value; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCredential.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCredential.java new file mode 100644 index 00000000..473fa931 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyCredential.java @@ -0,0 +1,107 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import org.json.simple.JSONObject; + +public class PublicKeyCredential { + + private PublicKeyFormat format; + private String key; + + public PublicKeyCredential() { + } + + public void setFormat(PublicKeyFormat format) { + this.format = format; + } + + public void setKey(String key) { + this.key = key; + } + + private PublicKeyCredential(Builder builder) { + format = builder.format; + key = builder.key; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static class Builder { + private PublicKeyFormat format; + private String key; + + protected Builder() { + + } + + public PublicKeyFormat getFormat() { + return format; + } + + public Builder setFormat(PublicKeyFormat format) { + this.format = format; + return this; + } + + public String getKey() { + return key; + } + + public Builder setKey(String key) { + this.key = key; + return this; + } + + private Builder(PublicKeyCredential publicKeyCredential) { + this.format = publicKeyCredential.format; + this.key = publicKeyCredential.key; + } + + public PublicKeyCredential build() { + return new PublicKeyCredential(this); + } + } + + public JSONObject toJSONObject() { + JSONObject jsonObject = new JSONObject(); + jsonObject.put("format", this.format.name()); + jsonObject.put("key", this.key); + return jsonObject; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyFormat.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyFormat.java new file mode 100644 index 00000000..5665b40a --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/PublicKeyFormat.java @@ -0,0 +1,88 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +public enum PublicKeyFormat { + UNSPECIFIED_PUBLIC_KEY_FORMAT(0), RSA_PEM(3), RSA_X509_PEM(1), ES256_PEM(2), ES256_X509_PEM(4), UNRECOGNIZED(-1),; + + public static final int UNSPECIFIED_PUBLIC_KEY_FORMAT_VALUE = 0; + public static final int RSA_PEM_VALUE = 3; + public static final int RSA_X509_PEM_VALUE = 1; + public static final int ES256_PEM_VALUE = 2; + public static final int ES256_X509_PEM_VALUE = 4; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException("Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static PublicKeyFormat valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static PublicKeyFormat forNumber(int value) { + switch (value) { + case 0: + return UNSPECIFIED_PUBLIC_KEY_FORMAT; + case 3: + return RSA_PEM; + case 1: + return RSA_X509_PEM; + case 2: + return ES256_PEM; + case 4: + return ES256_X509_PEM; + default: + return null; + } + } + + public PublicKeyFormat findValueByNumber(int number) { + return PublicKeyFormat.forNumber(number); + } + + private final int value; + + private PublicKeyFormat(int value) { + this.value = value; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/RegistryCredential.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/RegistryCredential.java new file mode 100644 index 00000000..a15e8474 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/RegistryCredential.java @@ -0,0 +1,138 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import org.json.simple.JSONObject; + +public class RegistryCredential { + + private PublicKeyCertificate publicKeyCertificate; + + public RegistryCredential() { + publicKeyCertificate = null; + } + + private RegistryCredential(Builder builder) { + publicKeyCertificate = builder.getPublicKeyCertificate(); + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Builder for setting + * RegistryCredential + */ + public static class Builder { + private PublicKeyCertificate publicKeyCertificate; + + protected Builder() { + + } + + public PublicKeyCertificate getPublicKeyCertificate() { + return publicKeyCertificate; + } + + public Builder setPublicKeyCertificate(PublicKeyCertificate publicKeyCertificate) { + this.publicKeyCertificate = publicKeyCertificate; + return this; + } + + private Builder(RegistryCredential registryCredential) { + this.publicKeyCertificate = registryCredential.publicKeyCertificate; + } + + public RegistryCredential build() { + return new RegistryCredential(this); + } + } + + @Override + public String toString() { + return "PublicKeyCertificate=" + this.publicKeyCertificate.toString(); + } + + public void loadFromJson(JSONObject jsonObject) { + if (jsonObject.containsKey("publicKeyCertificate")) { + PublicKeyCertificate publicKeyCertificateObj = new PublicKeyCertificate(); + JSONObject publicKeyCertificateJson = (JSONObject) jsonObject.get("publicKeyCertificate"); + if (publicKeyCertificateJson.containsKey("format")) + publicKeyCertificateObj + .setFormat(PublicKeyCertificateFormat.valueOf((String) publicKeyCertificateJson.get("format"))); + if (publicKeyCertificateJson.containsKey("certificate")) + publicKeyCertificateObj + .setCertificate((String) publicKeyCertificateJson.get("certificate")); + if (publicKeyCertificateJson.containsKey("x509Details")) { + JSONObject x509DJsonObject = (JSONObject) publicKeyCertificateJson.get("x509Details"); + X509CertificateDetails x509CertificateDetails = new X509CertificateDetails(); + x509CertificateDetails.setIssuer((String) x509DJsonObject.get("issuer")); + x509CertificateDetails.setSubject((String) x509DJsonObject.get("subject")); + x509CertificateDetails.setStartTime((String) x509DJsonObject.get("startTime")); + x509CertificateDetails.setExpiryTime((String) x509DJsonObject.get("expiryTime")); + x509CertificateDetails.setSignatureAlgorithm((String) x509DJsonObject.get("signatureAlgorithm")); + x509CertificateDetails.setPublicKeyType((String) x509DJsonObject.get("publicKeyType")); + publicKeyCertificateObj.setX509Details(x509CertificateDetails); + } + publicKeyCertificate = publicKeyCertificateObj; + } + } + + @SuppressWarnings("unchecked") + public JSONObject getJsonObject() { + JSONObject json = new JSONObject(); + + JSONObject publicKeyCertificateJson = new JSONObject(); + if (publicKeyCertificate.getFormat() != null) + publicKeyCertificateJson.put("format", publicKeyCertificate.getFormat().name()); + if (publicKeyCertificate.getCertificate() != null) + publicKeyCertificateJson.put("certificate", publicKeyCertificate.getCertificate()); + if (publicKeyCertificate.getX509Details() != null) { + X509CertificateDetails x509CertificateDetails = publicKeyCertificate.getX509Details(); + JSONObject x509DJsonObject = new JSONObject(); + x509DJsonObject.put("issuer", x509CertificateDetails.getIssuer()); + x509DJsonObject.put("subject", x509CertificateDetails.getSubject()); + x509DJsonObject.put("startTime", x509CertificateDetails.getStartTime()); + x509DJsonObject.put("expiryTime", x509CertificateDetails.getExpiryTime()); + x509DJsonObject.put("signatureAlgorithm", x509CertificateDetails.getSignatureAlgorithm()); + x509DJsonObject.put("publicKeyType", x509CertificateDetails.getPublicKeyType()); + publicKeyCertificateJson.put("x509Details", x509DJsonObject); + + } + json.put("publicKeyCertificate", publicKeyCertificateJson); + return json; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/RegistryName.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/RegistryName.java new file mode 100644 index 00000000..7093368f --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/RegistryName.java @@ -0,0 +1,152 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import com.clearblade.cloud.iot.v1.utils.PathTemplate; + +import java.util.Map; + +public class RegistryName { + + private static final PathTemplate PROJECT_LOCATION_REGISTRY = PathTemplate.createWithoutUrlEncoding("projects/{project}/locations/{location}/registries/{registry}"); + private final String project; + private final String location; + private final String registry; + + protected RegistryName() { + project = null; + location = null; + registry = null; + } + + private RegistryName(Builder builder) { + project = builder.getProject(); + location = builder.getLocation(); + registry = builder.getRegistry(); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getRegistry() { + return registry; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static RegistryName of(String project, String location, String registry) { + return newBuilder().setProject(project).setLocation(location).setRegistry(registry).build(); + } + + public static String format(String project, String location, String registry) { + return newBuilder().setProject(project).setLocation(location).setRegistry(registry).build() + .toString(); + } + + /** + * Builder for + * projects/{project}/locations/{location}/registries/{registry}. + */ + public static class Builder { + private String project; + private String location; + private String registry; + + protected Builder() { + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getRegistry() { + return registry; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setRegistry(String registry) { + this.registry = registry; + return this; + } + + private Builder(RegistryName registryName) { + this.project = registryName.project; + this.location = registryName.location; + this.registry = registryName.registry; + } + + public RegistryName build() { + return new RegistryName(this); + } + } + + @Override + public String toString() { + return PROJECT_LOCATION_REGISTRY.instantiate(new String[]{"project", this.project, "location", this.location, "registry", this.registry}); + } + + public static RegistryName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } else { + Map matchMap = PROJECT_LOCATION_REGISTRY.validatedMatch(formattedString, "RegistryName.parse: formattedString not in valid format"); + return of((String) matchMap.get("project"), (String) matchMap.get("location"), (String) matchMap.get("registry")); + } + } + + public String getRegistryFullName() { + return PROJECT_LOCATION_REGISTRY.instantiate(new String[]{"project", this.project, "location", this.location, "registry", this.registry}); + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/StateNotificationConfig.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/StateNotificationConfig.java new file mode 100644 index 00000000..8532d0f3 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/StateNotificationConfig.java @@ -0,0 +1,104 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +import org.json.simple.JSONObject; + +public class StateNotificationConfig { + + private String pubsubTopicName; + + public StateNotificationConfig() { + pubsubTopicName = ""; + } + + private StateNotificationConfig(Builder builder) { + pubsubTopicName = builder.getPubsubTopicName(); + } + + public String getPubsubTopicName() { + return pubsubTopicName; + } + + public void setPubsubTopicName(String pubsubTopicName) { + this.pubsubTopicName = pubsubTopicName; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + /** + * Builder for setting + * StateNotificationConfig - pubsubTopicName + */ + public static class Builder { + private String pubsubTopicName; + + protected Builder() { + + } + + private Builder(StateNotificationConfig stateNotificationConfig) { + this.pubsubTopicName = stateNotificationConfig.pubsubTopicName; + } + + public StateNotificationConfig build() { + return new StateNotificationConfig(this); + } + + public String getPubsubTopicName() { + return pubsubTopicName; + } + + public Builder setPubsubTopicName(String pubsubTopicName) { + this.pubsubTopicName = pubsubTopicName; + return this; + } + + } + + @Override + public String toString() { + return "pubsubTopicName=" + this.pubsubTopicName; + } + + @SuppressWarnings("unchecked") + public JSONObject getJsonObject() { + JSONObject json = new JSONObject(); + json.put("pubsubTopicName", this.pubsubTopicName); + return json; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/X509CertificateDetails.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/X509CertificateDetails.java new file mode 100644 index 00000000..cb0594b6 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/registrytypes/X509CertificateDetails.java @@ -0,0 +1,97 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.registrytypes; + +public class X509CertificateDetails { + + private String issuer; + private String subject; + private String startTime; + private String expiryTime; + private String signatureAlgorithm; + private String publicKeyType; + + public String getIssuer() { + return issuer; + } + + public void setIssuer(String issuer) { + this.issuer = issuer; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getStartTime() { + return startTime; + } + + public void setStartTime(String startTime) { + this.startTime = startTime; + } + + public String getExpiryTime() { + return expiryTime; + } + + public void setExpiryTime(String expiryTime) { + this.expiryTime = expiryTime; + } + + public String getSignatureAlgorithm() { + return signatureAlgorithm; + } + + public void setSignatureAlgorithm(String signatureAlgorithm) { + this.signatureAlgorithm = signatureAlgorithm; + } + + public String getPublicKeyType() { + return publicKeyType; + } + + public void setPublicKeyType(String publicKeyType) { + this.publicKeyType = publicKeyType; + } + + @Override + public String toString() { + return "Issuer= " + this.issuer + ",Subject=" + this.subject + ",startTime=" + this.startTime + ",expiryTime=" + + this.expiryTime + ",signatureAlgorithm=" + this.signatureAlgorithm + ",publicKeyType=" + + this.publicKeyType; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/sendcommandtodevice/SendCommandToDeviceRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/sendcommandtodevice/SendCommandToDeviceRequest.java new file mode 100644 index 00000000..cafdb934 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/sendcommandtodevice/SendCommandToDeviceRequest.java @@ -0,0 +1,179 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.sendcommandtodevice; + +import java.net.URLEncoder; +import java.util.Arrays; + +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import org.json.simple.JSONObject; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.utils.ByteString; + +public class SendCommandToDeviceRequest { + + private final DeviceName name; + private final ByteString binaryData; + private final byte[] binaryDataByte; + private final String subfolder; + private final String deviceName; + public JSONObject requestParams; + public JSONObject bodyParams; + + private SendCommandToDeviceRequest(Builder builder) { + this.name = builder.name; + this.binaryData = builder.binaryData; + this.subfolder = builder.subfolder; + this.binaryDataByte = builder.binaryDataByte; + this.deviceName = builder.deviceName; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private DeviceName name; + private ByteString binaryData; + private String subfolder; + private byte[] binaryDataByte; + private String deviceName; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setName(DeviceName name) { + this.name = name; + return this; + } + + public Builder setBinaryData(ByteString binaryData) { + this.binaryData = binaryData; + return this; + } + + public Builder setBinaryDataByte(byte[] binaryDataByte) { + this.binaryDataByte = binaryDataByte; + return this; + } + + public Builder setSubfolder(String subfolder) { + this.subfolder = subfolder; + return this; + } + + public Builder setName(String deviceName) { + this.deviceName = deviceName; + return this; + } + + // build method to deal with outer class + // to return outer instance + public SendCommandToDeviceRequest build() { + return new SendCommandToDeviceRequest(this); + } + } + + public DeviceName getDeviceName() { + if (name != null) { + return name; + } else { + return DeviceName.parse(this.deviceName); + } + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + requestParams = new JSONObject(); + bodyParams = new JSONObject(); + + String dName = ""; + String bData = null; + + if (this.name != null) { + dName = this.name.getDevice(); + } else if (this.deviceName != null) { + dName = this.deviceName; + } + if (this.binaryData != null) { + bData = new String(this.binaryData.toByteArray()); + } else if (this.binaryDataByte != null) { + if (this.binaryDataByte.length == 0) { + bData = "EMPTY"; + } else { + bData = Arrays.toString(this.binaryDataByte); + } + } + + requestParams.put("name", dName); + bodyParams.put("binaryData", bData); + bodyParams.put("subfolder", subfolder); + + return "name = " + dName + ", binaryData = " + bData + ", subfolder = " + subfolder; + + } + + @SuppressWarnings("unchecked") + public String[] getBodyAndParams() { + String[] output = new String[2]; + String params = null; + try { + params = "name=" + URLEncoder.encode(this.deviceName,"UTF-8") + "&method=sendCommandToDevice"; + } catch (Exception e) { + throw new ApplicationException(e); + } + String bData = null; + if (this.binaryData != null) { + bData = new String(this.binaryData.toByteArray()); + } else if (this.binaryDataByte != null) { + if (this.binaryDataByte.length == 0) { + bData = "EMPTY"; + } else { + bData = Arrays.toString(this.binaryDataByte); + } + } + bodyParams = new JSONObject(); + bodyParams.put("binaryData", bData); + if (this.subfolder != null) { + bodyParams.put("subfolder", this.subfolder); + } + + output[0] = params; + output[1] = bodyParams.toJSONString(); + return output; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/sendcommandtodevice/SendCommandToDeviceResponse.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/sendcommandtodevice/SendCommandToDeviceResponse.java new file mode 100644 index 00000000..072b9e5c --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/sendcommandtodevice/SendCommandToDeviceResponse.java @@ -0,0 +1,98 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.sendcommandtodevice; + +import java.util.logging.Logger; + + +public class SendCommandToDeviceResponse { + + static Logger log = Logger.getLogger(SendCommandToDeviceResponse.class.getName()); + private final SendCommandToDeviceRequest request; + private int httpStatusCode; + private String httpStatusResponse; + + protected SendCommandToDeviceResponse(Builder builder) { + this.request = builder.request; + } + + public int getHttpStatusCode() { + return httpStatusCode; + } + + public void setHttpStatusCode(int httpStatusCode) { + this.httpStatusCode = httpStatusCode; + } + + public String getHttpStatusResponse() { + return httpStatusResponse; + } + + public void setHttpStatusResponse(String httpStatusResponse) { + this.httpStatusResponse = httpStatusResponse; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private SendCommandToDeviceRequest request; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setSendCommandToDeviceRequest(SendCommandToDeviceRequest request) { + this.request = request; + return this; + } + + // build method to deal with outer class + // to return outer instance + public SendCommandToDeviceResponse build() { + return new SendCommandToDeviceResponse(this); + } + } + + @Override + public String toString() { + return "Http Status Code :: " + this.getHttpStatusCode() + " Http Status Response :: " + + this.getHttpStatusResponse(); + } + + public SendCommandToDeviceRequest getRequest() { + return request; + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/unbinddevicefromgateway/UnbindDeviceFromGatewayRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/unbinddevicefromgateway/UnbindDeviceFromGatewayRequest.java new file mode 100644 index 00000000..c5906eac --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/unbinddevicefromgateway/UnbindDeviceFromGatewayRequest.java @@ -0,0 +1,135 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.unbinddevicefromgateway; + +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import org.json.simple.JSONObject; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class UnbindDeviceFromGatewayRequest { + private final String parent; + private final String gateway; + private final String device; + JSONObject requestParams; + JSONObject bodyParams; + + private UnbindDeviceFromGatewayRequest(Builder builder) { + this.parent = builder.parent; + this.gateway = builder.gateway; + this.device = builder.device; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String parent; + private String gateway; + private String device; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setParent(String parent) { + this.parent = parent; + return this; + } + + public Builder setGateway(String gateway) { + this.gateway = gateway; + return this; + } + + public Builder setDevice(String device) { + this.device = device; + return this; + } + + // build method to deal with outer class + // to return outer instance + public UnbindDeviceFromGatewayRequest build() { + return new UnbindDeviceFromGatewayRequest(this); + } + } + + public RegistryName getParent() { + return RegistryName.parse(this.parent); + } + + + public void setRequestParams(JSONObject requestParams) { + this.requestParams = requestParams; + } + + + public void setBodyParams(JSONObject bodyParams) { + this.bodyParams = bodyParams; + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + + requestParams = new JSONObject(); + bodyParams = new JSONObject(); + requestParams.put("method", "unbindDeviceFromGateway"); + requestParams.put("parent", this.parent); + + bodyParams.put("gatewayId", this.gateway); + bodyParams.put("deviceId", this.device); + + this.setRequestParams(requestParams); + this.setBodyParams(bodyParams); + + return "parent=" + this.parent + ",gateway=" + this.gateway + ", device= " + this.device; + } + + @SuppressWarnings("unchecked") + public String[] getBodyAndParams() { + String[] output = new String[2]; + String params = "parent=" + URLEncoder.encode(this.parent, StandardCharsets.UTF_8) + "&method=unbindDeviceFromGateway"; + bodyParams = new JSONObject(); + bodyParams.put("gatewayId", this.gateway); + bodyParams.put("deviceId", this.device); + + output[0] = params; + output[1] = bodyParams.toJSONString(); + return output; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/unbinddevicefromgateway/UnbindDeviceFromGatewayResponse.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/unbinddevicefromgateway/UnbindDeviceFromGatewayResponse.java new file mode 100644 index 00000000..9cf8436e --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/unbinddevicefromgateway/UnbindDeviceFromGatewayResponse.java @@ -0,0 +1,98 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.unbinddevicefromgateway; + +import java.util.logging.Logger; + +public class UnbindDeviceFromGatewayResponse { + + static Logger log = Logger.getLogger(UnbindDeviceFromGatewayResponse.class.getName()); + private final UnbindDeviceFromGatewayRequest request; + private int httpStatusCode; + private String httpStatusResponse; + + protected UnbindDeviceFromGatewayResponse(Builder builder) { + this.request = builder.request; + } + + public int getHttpStatusCode() { + return httpStatusCode; + } + + public void setHttpStatusCode(int httpStatusCode) { + this.httpStatusCode = httpStatusCode; + } + + public String getHttpStatusResponse() { + return httpStatusResponse; + } + + public void setHttpStatusResponse(String httpStatusResponse) { + this.httpStatusResponse = httpStatusResponse; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private UnbindDeviceFromGatewayRequest request; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setUnbindDeviceFromGatewayRequest(UnbindDeviceFromGatewayRequest request) { + this.request = request; + return this; + } + + // build method to deal with outer class + // to return outer instance + public UnbindDeviceFromGatewayResponse build() { + return new UnbindDeviceFromGatewayResponse(this); + } + } + + @Override + public String toString() { + return "Http Status Code :: " + this.getHttpStatusCode() + " Http Status Response :: " + + this.getHttpStatusResponse(); + } + + public UnbindDeviceFromGatewayRequest getRequest() { + return request; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/updatedevice/UpdateDeviceRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/updatedevice/UpdateDeviceRequest.java new file mode 100644 index 00000000..3ddae3a9 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/updatedevice/UpdateDeviceRequest.java @@ -0,0 +1,173 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.updatedevice; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Set; + +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; + +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceCredential; + +public class UpdateDeviceRequest { + private final String name; + private final Device device; + private final String updateMask; + JSONObject requestParams; + JSONObject bodyParams; + + private UpdateDeviceRequest(Builder builder) { + this.name = builder.name; + this.updateMask = builder.updateMask; + this.device = builder.device; + } + + public JSONObject getRequestParams() { + return requestParams; + } + + public void setRequestParams(JSONObject requestParams) { + this.requestParams = requestParams; + } + + public JSONObject getBodyParams() { + return bodyParams; + } + + public void setBodyParams(JSONObject bodyParams) { + this.bodyParams = bodyParams; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String name; + private Device device; + private String updateMask; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setDevice(Device device) { + this.device = device; + return this; + } + + public Builder setUpdateMask(String updateMask) { + this.updateMask = updateMask; + return this; + } + + // build method to deal with outer class + // to return outer instance + public UpdateDeviceRequest build() { + return new UpdateDeviceRequest(this); + } + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + requestParams.put("name", this.name); + requestParams.put("updateMask", this.updateMask); + + bodyParams.put("id", this.device.toBuilder().getId()); + bodyParams.put("name", this.device.toBuilder().getName()); + bodyParams.put("logLevel", this.device.toBuilder().getLogLevel()); + bodyParams.put("blocked", this.device.toBuilder().isBlocked()); + + return "name=" + this.name + ",updateMask=" + this.updateMask + ", logLevel= " + + this.device.toBuilder().getLogLevel(); + } + + public DeviceName getDeviceName() { + return DeviceName.parse(this.name); + } + + @SuppressWarnings("unchecked") + public String[] getBodyAndParams() throws UnsupportedEncodingException { + String[] output = new String[2]; + + String params = "name=" + URLEncoder.encode(this.name,"UTF-8") + "&updateMask=" + this.updateMask; + bodyParams = new JSONObject(); + + bodyParams.put("id", this.device.toBuilder().getId()); + bodyParams.put("name", this.device.toBuilder().getName()); + if (this.device.toBuilder().getLogLevel() != null) { + bodyParams.put("logLevel", this.device.toBuilder().getLogLevel().toString()); + } + bodyParams.put("blocked", this.device.toBuilder().isBlocked()); + if (this.device.toBuilder().getCredentials() != null && this.device.toBuilder().getCredentials().size() > 0) { + JSONArray jsonArray = new JSONArray(); + for (int i = 0; i < this.device.toBuilder().getCredentials().size(); i++) { + if (!this.device.toBuilder().getCredentials().get(i).isEmpty()) { + DeviceCredential credentialObj = this.device.toBuilder().getCredentials().get(i); + jsonArray.add(credentialObj.toJSONObject()); + } + } + bodyParams.put("credentials", jsonArray); + } + if (this.device.toBuilder().getMetadata() != null && this.device.toBuilder().getMetadata().size() > 0) { + Set metaSet = this.device.toBuilder().getMetadata().keySet(); + Iterator itr = metaSet.iterator(); + JSONObject jsonObject = new JSONObject(); + while (itr.hasNext()) { + String key = (String) itr.next(); + String value = this.device.toBuilder().getMetadata().get(key).toString(); + jsonObject.put(key, value); + } + bodyParams.put("metadata", jsonObject); + } + + output[0] = params; + output[1] = bodyParams.toString(); + return output; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/updatedeviceregistry/UpdateDeviceRegistryRequest.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/updatedeviceregistry/UpdateDeviceRegistryRequest.java new file mode 100644 index 00000000..7eaca767 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/updatedeviceregistry/UpdateDeviceRegistryRequest.java @@ -0,0 +1,121 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.updatedeviceregistry; + +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import org.json.simple.JSONObject; + +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; + +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; + +public class UpdateDeviceRegistryRequest { + + private final String name; + private final String updateMask; + private final DeviceRegistry deviceRegistry; + JSONObject requestParams; + JSONObject bodyParams; + + private UpdateDeviceRegistryRequest(Builder builder) { + this.name = builder.name; + this.updateMask = builder.updateMask; + this.deviceRegistry = builder.deviceRegistry; + } + + // Static class Builder + public static class Builder { + + /// instance fields + private String name; + private String updateMask; + private DeviceRegistry deviceRegistry; + + public static Builder newBuilder() { + return new Builder(); + } + + private Builder() { + } + + // Setter methods + public Builder setName(String name) { + this.name = name; + return this; + } + + public Builder setDeviceRegistry(DeviceRegistry deviceRegistry) { + this.deviceRegistry = deviceRegistry; + return this; + } + + public Builder setUpdateMask(String updateMask) { + this.updateMask = updateMask; + return this; + } + + // build method to deal with outer class + // to return outer instance + public UpdateDeviceRegistryRequest build() { + return new UpdateDeviceRegistryRequest(this); + } + } + + public RegistryName getParent() { + return RegistryName.parse(this.name); + } + + @SuppressWarnings("unchecked") + @Override + public String toString() { + requestParams.put("name", this.name); + requestParams.put("updateMask", this.updateMask); + + bodyParams.put("id", this.deviceRegistry.toBuilder().getId()); + bodyParams.put("name", this.deviceRegistry.toBuilder().getName()); + bodyParams.put("logLevel", this.deviceRegistry.toBuilder().getLogLevel()); + + return "name=" + this.name + ",updateMask=" + this.updateMask + ", logLevel= " + + this.deviceRegistry.toBuilder().getLogLevel(); + } + + public String[] getBodyAndParams() { + String[] output = new String[2]; + + String params = "name=" + URLEncoder.encode(this.name, StandardCharsets.UTF_8)+ "&updateMask=" + this.updateMask; + + output[0] = params; + output[1] = this.deviceRegistry.createDeviceJSONObject(""); + return output; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AuthParams.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AuthParams.java new file mode 100644 index 00000000..afa6f335 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AuthParams.java @@ -0,0 +1,205 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.utils; + +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.net.ProxySelector; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpRequest.BodyPublisher; +import java.net.http.HttpRequest.BodyPublishers; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.util.HashMap; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; + +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import org.json.simple.parser.ParseException; +import org.junit.platform.commons.util.StringUtils; + +public class AuthParams { + static Logger log = Logger.getLogger(AuthParams.class.getName()); + + private static HashMap cachedResponse = new HashMap<>(); + + private String adminSystemKey = null; + private String project = null; + private String baseURL = null; + private String adminToken = null; + private String userSystemKey = null; + private String userToken = null; + private String apiBaseURL = null; + + public String getAdminSystemKey() { + return adminSystemKey; + } + + public String getProject() { + return project; + } + + public String getBaseURL() { + return baseURL; + } + + public String getAdminToken() { + return adminToken; + } + + public String getUserSystemKey() { + return userSystemKey; + } + + public String getUserToken() { + return userToken; + } + + public String getApiBaseURL() { + return apiBaseURL; + } + + public void setAdminCredentials() throws ApplicationException, IOException { + try { + String pathToAuthFile = System.getenv(Constants.AUTH_ACCESS); + if (pathToAuthFile != null) { + JSONParser jsonParser = new JSONParser(); + FileReader authReader = new FileReader(pathToAuthFile); + // Read JSON file + Object obj = jsonParser.parse(authReader); + JSONObject authJSONObject = (JSONObject) obj; + if (authJSONObject != null) { + adminSystemKey = (authJSONObject.get(Constants.ADMIN_SYSTEM_KEY)).toString(); + adminToken = (authJSONObject.get(Constants.ADMIN_TOKEN)).toString(); + baseURL = (authJSONObject.get(Constants.BASE_URL)).toString(); + project = (authJSONObject.get(Constants.PROJECT_NAME)).toString(); + } + } else { + log.log(Level.SEVERE, "CLEARBLADE_CONFIGURATION Enviornment variable not set"); + throw new ApplicationException("CLEARBLADE_CONFIGURATION Enviornment variable not set"); + } + + } catch (FileNotFoundException fe) { + log.log(Level.SEVERE, "ClearBlade Configuration File not found"); + throw new FileNotFoundException("ClearBlade Configuration File not found"); + + } catch (IOException fe) { + log.log(Level.SEVERE, "Access Denied - ClearBlade Configuration File cannot be read"); + throw new IOException("Access Denied - ClearBlade Configuration File cannot be read"); + + } catch (Exception e) { + log.log(Level.SEVERE, e.getMessage()); + throw new ApplicationException(e.getMessage()); + } + } + + @SuppressWarnings("unchecked") + public void setRegistryCredentials(String project, String registry, String location) throws ApplicationException { + + if (cachedResponse.containsKey(location + "-" + registry)) { + String responseMessage = cachedResponse.get(location + "-" + registry); + JSONParser responseParser = new JSONParser(); + JSONObject responseJSONObject; + Object responseObj = null; + try { + responseObj = responseParser.parse(responseMessage); + } catch (ParseException e) { + throw new ApplicationException(e); + } + if (responseObj != null) { + responseJSONObject = (JSONObject) responseObj; + userSystemKey = responseJSONObject.get(Constants.USER_SYSTEM_KEY).toString(); + userToken = responseJSONObject.get(Constants.USER_TOKEN).toString(); + apiBaseURL = responseJSONObject.get(Constants.API_BASE_URL).toString(); + } + return; + } else if(StringUtils.isNotBlank(System.getenv(Constants.REGISTRY_URL)) && StringUtils.isNotBlank(System.getenv(Constants.REGISTRY_SYSKEY)) && StringUtils.isNotBlank(System.getenv(Constants.REGISTRY_TOKEN))) { + apiBaseURL = System.getenv(Constants.REGISTRY_URL); + userSystemKey = System.getenv(Constants.REGISTRY_SYSKEY); + userToken = System.getenv(Constants.REGISTRY_TOKEN); + return; + } + try { + setAdminCredentials(); + String finalURL = baseURL.concat(Constants.GET_SYSTEM_CREDENTIALS_EXTENSION) + .concat(adminSystemKey) + .concat("/getRegistryCredentials"); + + JSONObject js = new JSONObject(); + js.put("region", location); + js.put("registry", registry); + js.put("project", project); + BodyPublisher jsonPayload = BodyPublishers.ofString(js.toString()); + + HttpRequest request = HttpRequest.newBuilder() + .uri(URI.create(finalURL)) + .method(Constants.HTTP_REQUEST_METHOD_TYPE_POST, jsonPayload) + .headers(Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE, + Constants.HTTP_REQUEST_PROPERTY_TOKEN_KEY, adminToken, + Constants.HTTP_REQUEST_PROPERTY_ACCEPT_KEY, Constants.HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE) + .build(); + + HttpResponse response = HttpClient.newBuilder() + .proxy(ProxySelector.getDefault()) + .build() + .send(request, BodyHandlers.ofString()); + + int responseCode = response.statusCode(); + String responseMessage = response.body(); + JSONParser responseParser = new JSONParser(); + JSONObject responseJSONObject; + if (responseCode == 200) { + if (responseMessage != null && responseMessage.length() > 0) { + Object responseObj = responseParser.parse(responseMessage); + if (responseObj != null) { + responseJSONObject = (JSONObject) responseObj; + userSystemKey = responseJSONObject.get(Constants.USER_SYSTEM_KEY).toString(); + userToken = responseJSONObject.get(Constants.USER_TOKEN).toString(); + apiBaseURL = responseJSONObject.get(Constants.API_BASE_URL).toString(); + cachedResponse.put(location + "-" + registry, responseMessage); + } + } + } else { + log.log(Level.INFO, () -> "Response code " + responseCode + " received with message::" + responseMessage); + throw new ApplicationException(responseMessage); + } + } catch (Exception ec) { + log.log(Level.SEVERE, ec.getMessage()); + throw new ApplicationException(ec.getMessage()); + } + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AutoValue.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AutoValue.java new file mode 100644 index 00000000..8a5f1910 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AutoValue.java @@ -0,0 +1,18 @@ +package com.clearblade.cloud.iot.v1.utils; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.CLASS) +@Target({ElementType.TYPE}) +public @interface AutoValue { + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.TYPE, ElementType.METHOD}) + public @interface CopyAnnotations { + Class[] exclude() default {}; + } + + @Retention(RetentionPolicy.CLASS) + @Target({ElementType.TYPE}) + public @interface Builder { + } +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AutoValue_PathTemplate_Segment.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AutoValue_PathTemplate_Segment.java new file mode 100644 index 00000000..47a14a6b --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/AutoValue_PathTemplate_Segment.java @@ -0,0 +1,63 @@ +package com.clearblade.cloud.iot.v1.utils; + +final class AutoValue_PathTemplate_Segment extends PathTemplate.Segment { + private final PathTemplate.SegmentKind kind; + private final String value; + private final String complexSeparator; + + AutoValue_PathTemplate_Segment(PathTemplate.SegmentKind kind, String value, String complexSeparator) { + if (kind == null) { + throw new NullPointerException("Null kind"); + } else { + this.kind = kind; + if (value == null) { + throw new NullPointerException("Null value"); + } else { + this.value = value; + if (complexSeparator == null) { + throw new NullPointerException("Null complexSeparator"); + } else { + this.complexSeparator = complexSeparator; + } + } + } + } + + PathTemplate.SegmentKind kind() { + return this.kind; + } + + String value() { + return this.value; + } + + String complexSeparator() { + return this.complexSeparator; + } + + public String toString() { + return "Segment{kind=" + this.kind + ", value=" + this.value + ", complexSeparator=" + this.complexSeparator + "}"; + } + + public boolean equals(Object o) { + if (o == this) { + return true; + } else if (!(o instanceof PathTemplate.Segment)) { + return false; + } else { + PathTemplate.Segment that = (PathTemplate.Segment)o; + return this.kind.equals(that.kind()) && this.value.equals(that.value()) && this.complexSeparator.equals(that.complexSeparator()); + } + } + + public int hashCode() { + int h$ = 1; + h$ *= 1000003; + h$ ^= this.kind.hashCode(); + h$ *= 1000003; + h$ ^= this.value.hashCode(); + h$ *= 1000003; + h$ ^= this.complexSeparator.hashCode(); + return h$; + } +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ByteString.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ByteString.java new file mode 100644 index 00000000..1a538c0b --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ByteString.java @@ -0,0 +1,333 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.utils; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FilterOutputStream; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import java.util.List; + + +public class ByteString { + + private final byte[] bytes; + + private ByteString(final byte[] bytes) { + this.bytes = bytes; + } + + public ByteString(String str) { + this.bytes = str.getBytes(); + } + + /** + * Gets the byte at the given index. + * + * @throws ArrayIndexOutOfBoundsException {@code index} is < 0 or >= size + */ + public byte byteAt(final int index) { + return bytes[index]; + } + + /** + * Gets the number of bytes. + */ + public int size() { + return bytes.length; + } + + /** + * Returns {@code true} if the size is {@code 0}, {@code false} otherwise. + */ + public boolean isEmpty() { + return bytes.length == 0; + } + + // ================================================================= + // byte[] -> ByteString + /** + * Empty ByteString. + */ + public static final ByteString EMPTY = new ByteString(new byte[0]); + + /** + * Copies the given bytes into a {@code ByteString}. + */ + public static ByteString copyFrom(final byte[] bytes, final int offset, final int size) { + final byte[] copy = new byte[size]; + System.arraycopy(bytes, offset, copy, 0, size); + return new ByteString(copy); + } + + /** + * Copies the given bytes into a {@code ByteString}. + */ + public static ByteString copyFrom(final byte[] bytes) { + return copyFrom(bytes, 0, bytes.length); + } + + /** + * Copies {@code size} bytes from a {@code java.nio.ByteBuffer} into a + * {@code ByteString}. + */ + public static ByteString copyFrom(final ByteBuffer bytes, final int size) { + final byte[] copy = new byte[size]; + bytes.get(copy); + return new ByteString(copy); + } + + /** + * Copies the remaining bytes from a {@code java.nio.ByteBuffer} into a + * {@code ByteString}. + */ + public static ByteString copyFrom(final ByteBuffer bytes) { + return copyFrom(bytes, bytes.remaining()); + } + + /** + * Encodes {@code text} into a sequence of bytes using the named charset and + * returns the result as a {@code ByteString}. + */ + public static ByteString copyFrom(final String text, final String charsetName) throws UnsupportedEncodingException { + return new ByteString(text.getBytes(charsetName)); + } + + /** + * Encodes {@code text} into a sequence of UTF-8 bytes and returns the result as + * a {@code ByteString}. + */ + public static ByteString copyFromUtf8(final String text) { + try { + return new ByteString(text.getBytes("UTF-8")); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("UTF-8 not supported?", e); + } + } + + /** + * Concatenates all byte strings in the list and returns the result. + * + *

+ * The returned {@code ByteString} is not necessarily a unique object. If the + * list is empty, the returned object is the singleton empty {@code ByteString}. + * If the list has only one element, that {@code ByteString} will be returned + * without copying. + */ + public static ByteString copyFrom(List list) { + if (list.size() == 0) { + return EMPTY; + } else if (list.size() == 1) { + return list.get(0); + } + int size = 0; + for (ByteString str : list) { + size += str.size(); + } + byte[] bytes = new byte[size]; + int pos = 0; + for (ByteString str : list) { + System.arraycopy(str.bytes, 0, bytes, pos, str.size()); + pos += str.size(); + } + return new ByteString(bytes); + } + + // ================================================================= + // ByteString -> byte[] + /** + * Copies bytes into a buffer at the given offset. + * + * @param target buffer to copy into + * @param offset in the target buffer + */ + public void copyTo(final byte[] target, final int offset) { + System.arraycopy(bytes, 0, target, offset, bytes.length); + } + + /** + * Copies bytes into a buffer. + * + * @param target buffer to copy into + * @param sourceOffset offset within these bytes + * @param targetOffset offset within the target buffer + * @param size number of bytes to copy + */ + public void copyTo(final byte[] target, final int sourceOffset, final int targetOffset, final int size) { + System.arraycopy(bytes, sourceOffset, target, targetOffset, size); + } + + /** + * Copies bytes to a {@code byte[]}. + */ + public byte[] toByteArray() { + final int size = bytes.length; + final byte[] copy = new byte[size]; + System.arraycopy(bytes, 0, copy, 0, size); + return copy; + } + + /** + * Constructs a new read-only {@code java.nio.ByteBuffer} with the same backing + * byte array. + */ + public ByteBuffer asReadOnlyByteBuffer() { + final ByteBuffer byteBuffer = ByteBuffer.wrap(bytes); + return byteBuffer.asReadOnlyBuffer(); + } + + /** + * Constructs a new {@code String} by decoding the bytes using the specified + * charset. + */ + public String toString(final String charsetName) throws UnsupportedEncodingException { + return new String(bytes, charsetName); + } + + /** + * Constructs a new {@code String} by decoding the bytes as UTF-8. + */ + public String toStringUtf8() { + try { + return new String(bytes, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("UTF-8 not supported?", e); + } + } + + // ================================================================= + // equals() and hashCode() + @Override + public boolean equals(final Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ByteString)) { + return false; + } + final ByteString other = (ByteString) o; + final int size = bytes.length; + if (size != other.bytes.length) { + return false; + } + final byte[] thisBytes = bytes; + final byte[] otherBytes = other.bytes; + for (int i = 0; i < size; i++) { + if (thisBytes[i] != otherBytes[i]) { + return false; + } + } + return true; + } + + private volatile int hash = 0; + + @Override + public int hashCode() { + int h = hash; + if (h == 0) { + final byte[] thisBytes = bytes; + final int size = bytes.length; + h = size; + for (int i = 0; i < size; i++) { + h = h * 31 + thisBytes[i]; + } + if (h == 0) { + h = 1; + } + hash = h; + } + return h; + } + + // ================================================================= + // Input stream + /** + * Creates an {@code InputStream} which can be used to read the bytes. + */ + public InputStream newInput() { + return new ByteArrayInputStream(bytes); + } + + /** + * Creates a {@link CodedInputStream} which can be used to read the bytes. Using + * this is more efficient than creating a {@link CodedInputStream} wrapping the + * result of {@link #newInput()}. + */ + // ================================================================= + // Output stream + /** + * Creates a new {@link Output} with the given initial capacity. + */ + public static Output newOutput(final int initialCapacity) { + return new Output(new ByteArrayOutputStream(initialCapacity)); + } + + /** + * Creates a new {@link Output}. + */ + public static Output newOutput() { + return newOutput(32); + } + + /** + * Outputs to a {@code ByteString} instance. Call {@link #toByteString()} to + * create the {@code ByteString} instance. + */ + public static final class Output extends FilterOutputStream { + private final ByteArrayOutputStream bout; + + /** + * Constructs a new output with the given initial capacity. + */ + private Output(final ByteArrayOutputStream bout) { + super(bout); + this.bout = bout; + } + + /** + * Creates a {@code ByteString} instance from this {@code Output}. + */ + public ByteString toByteString() { + final byte[] byteArray = bout.toByteArray(); + return new ByteString(byteArray); + } + } + + @Override + public String toString() { + // TODO Auto-generated method stub + return toStringUtf8(); + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ConfigParameters.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ConfigParameters.java new file mode 100644 index 00000000..fd83d22b --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ConfigParameters.java @@ -0,0 +1,165 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.utils; + +import java.util.logging.Logger; + +public class ConfigParameters { + static Logger log = Logger.getLogger(ConfigParameters.class.getName()); + + private static ConfigParameters single_instance = null; + + private String project; + private String region; + private String registry; + private String getSystemCredentialsExtension; + private String webhook; + private String cloudiotURLExtension; + private String devicesURLExtension; + private String devicesStatesURLExtension; + private String cloudiotdevicesURLExtension; + private String cloudiotConfigURLExtension; + private String endpointPort; + + public static ConfigParameters getInstance() { + if (single_instance == null) + single_instance = new ConfigParameters(); + + return single_instance; + } + + public ConfigParameters() { + setValues(); + } + + /** + * Method used to set values in Constants setter method + */ + public void setValues() { + this.setWebhook(Constants.WEBHOOK); + this.setCloudiotURLExtension(Constants.CLOUDIOT_URL_EXTENSION); + this.setDevicesURLExtension(Constants.DEVICES_URL_EXTENSION); + this.setCloudiotdevicesURLExtension(Constants.CLOUDIOT_DEVICES_URL_EXTENSION); + this.setDevicesStatesURLExtension(Constants.DEVICES_STATES_URL_EXTENSION); + this.setCloudiotConfigURLExtension(Constants.CLOUDIOT_DEVICE_CONFIG_URL_EXTENSION); + this.setGetSystemCredentialsExtension(Constants.GET_SYSTEM_CREDENTIALS_EXTENSION); + this.setEndpointPort(Constants.ENDPOINTPORT); + } + + public String getCloudiotURLExtension() { + return cloudiotURLExtension; + } + + public void setCloudiotURLExtension(String cloudiotURLExtension) { + this.cloudiotURLExtension = cloudiotURLExtension; + } + + public String getDevicesURLExtension() { + return devicesURLExtension; + } + + public void setDevicesURLExtension(String devicesURLExtension) { + this.devicesURLExtension = devicesURLExtension; + } + + public String getDevicesStatesURLExtension() { + return devicesStatesURLExtension; + } + + public void setDevicesStatesURLExtension(String devicesStatesURLExtension) { + this.devicesStatesURLExtension = devicesStatesURLExtension; + } + + public String getCloudiotdevicesURLExtension() { + return cloudiotdevicesURLExtension; + } + + public void setCloudiotdevicesURLExtension(String cloudiotdevicesURLExtension) { + this.cloudiotdevicesURLExtension = cloudiotdevicesURLExtension; + } + + public String getProject() { + return project; + } + + public void setProject(String project) { + this.project = project; + } + + public String getRegion() { + return region; + } + + public void setRegion(String region) { + this.region = region; + } + + public String getRegistry() { + return registry; + } + + public void setRegistry(String registry) { + this.registry = registry; + } + + public String getGetSystemCredentialsExtension() { + return getSystemCredentialsExtension; + } + + public void setGetSystemCredentialsExtension(String getSystemCredentialsExtension) { + this.getSystemCredentialsExtension = getSystemCredentialsExtension; + } + + public String getEndpointPort() { + return endpointPort; + } + + public void setEndpointPort(String endpointPort) { + this.endpointPort = endpointPort; + } + + public String getWebhook() { + return webhook; + } + + public void setWebhook(String webhook) { + this.webhook = webhook; + } + + public String getCloudiotConfigURLExtension() { + return cloudiotConfigURLExtension; + } + + public void setCloudiotConfigURLExtension(String cloudiotConfigURLExtension) { + this.cloudiotConfigURLExtension = cloudiotConfigURLExtension; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Constants.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Constants.java new file mode 100644 index 00000000..95999cb1 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Constants.java @@ -0,0 +1,77 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.utils; + +public class Constants { + + private Constants() { + } + + // keys used in project + public static final String AUTH_ACCESS = "CLEARBLADE_CONFIGURATION"; + public static final String AUTH_REGISTRY = "CLEARBLADE_REGISTRY"; + public static final String AUTH_REGION = "CLEARBLADE_REGION"; + public static final String BINARYDATA = "BINARYDATA_AND_TIME_GOOGLE_FORMAT"; + + public static final String REGISTRY_URL = "REGISTRY_URL"; + public static final String REGISTRY_SYSKEY = "REGISTRY_SYSKEY"; + public static final String REGISTRY_TOKEN = "REGISTRY_TOKEN"; + public static final String ADMIN_SYSTEM_KEY = "systemKey"; + public static final String ADMIN_TOKEN = "token"; + public static final String BASE_URL = "url"; + public static final String PROJECT_NAME = "project"; + public static final String USER_SYSTEM_KEY = "systemKey"; + public static final String USER_TOKEN = "serviceAccountToken"; + public static final String API_BASE_URL = "url"; + + + // Constants used for setting up http connection - for common use + public static final String HTTPS_URL_PREFIX = "https://"; + public static final String HTTP_REQUEST_METHOD_TYPE_POST = "POST"; + public static final String HTTP_REQUEST_METHOD_TYPE_DELETE = "DELETE"; + public static final String HTTP_REQUEST_METHOD_TYPE_GET = "GET"; + public static final String HTTP_REQUEST_METHOD_TYPE_PATCH = "PATCH"; + public static final String HTTP_REQUEST_PROPERTY_TOKEN_KEY = "ClearBlade-UserToken"; + public static final String HTTP_REQUEST_PROPERTY_CONTENT_TYPE_KEY = "Content-Type"; + public static final String HTTP_REQUEST_PROPERTY_ACCEPT_KEY = "Accept"; + public static final String HTTP_REQUEST_PROPERTY_CONTENT_TYPE_ACCEPT_VALUE = "application/json"; + + // Constant values used in project + public static final String UTF8 = "utf-8"; + public static final String ENDPOINTPORT = ":443"; + public static final String WEBHOOK = "/api/v/4/webhook/execute/"; + public static final String DEVICES_URL_EXTENSION = "/cloudiot_devices"; + public static final String CLOUDIOT_URL_EXTENSION = "/cloudiot"; + public static final String DEVICES_STATES_URL_EXTENSION = "/cloudiot_devices_states"; + public static final String CLOUDIOT_DEVICES_URL_EXTENSION = "/cloudiotdevice_devices"; + public static final String CLOUDIOT_DEVICE_CONFIG_URL_EXTENSION = "/cloudiot_devices_configVersions"; + public static final String GET_SYSTEM_CREDENTIALS_EXTENSION = "/api/v/1/code/"; +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/LogLevel.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/LogLevel.java new file mode 100644 index 00000000..1d60350a --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/LogLevel.java @@ -0,0 +1,88 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.clearblade.cloud.iot.v1.utils; + +public enum LogLevel { + LOG_LEVEL_UNSPECIFIED(0), NONE(10), ERROR(20), INFO(30), DEBUG(40), UNRECOGNIZED(-1),; + + public static final int LOG_LEVEL_UNSPECIFIED_VALUE = 0; + public static final int NONE_VALUE = 10; + public static final int ERROR_VALUE = 20; + public static final int INFO_VALUE = 30; + public static final int DEBUG_VALUE = 40; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException("Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static LogLevel valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static LogLevel forNumber(int value) { + switch (value) { + case 0: + return LOG_LEVEL_UNSPECIFIED; + case 10: + return NONE; + case 20: + return ERROR; + case 30: + return INFO; + case 40: + return DEBUG; + default: + return null; + } + } + + public LogLevel findValueByNumber(int number) { + return LogLevel.forNumber(number); + } + + private final int value; + + private LogLevel(int value) { + this.value = value; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/PathTemplate.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/PathTemplate.java new file mode 100644 index 00000000..46c44442 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/PathTemplate.java @@ -0,0 +1,863 @@ +package com.clearblade.cloud.iot.v1.utils; + +import com.google.common.base.Splitter; +import com.google.common.collect.*; + +import javax.annotation.Nullable; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class PathTemplate { + public static final String HOSTNAME_VAR = "$hostname"; + private static final Pattern CUSTOM_VERB_PATTERN = Pattern.compile(":([^/*}{=]+)$"); + private static final Pattern HOSTNAME_PATTERN = Pattern.compile("^(\\w+:)?//"); + private static final Splitter SLASH_SPLITTER = Splitter.on('/').trimResults(); + private static final Pattern COMPLEX_DELIMITER_PATTERN = Pattern.compile("[_\\-\\.~]"); + private static final Pattern MULTIPLE_COMPLEX_DELIMITER_PATTERN = Pattern.compile("\\}[_\\-\\.~]{2,}\\{"); + private static final Pattern MISSING_COMPLEX_DELIMITER_PATTERN = Pattern.compile("\\}\\{"); + private static final Pattern INVALID_COMPLEX_DELIMITER_PATTERN = Pattern.compile("\\}[^_\\-\\.~]\\{"); + private static final Pattern END_SEGMENT_COMPLEX_DELIMITER_PATTERN = Pattern.compile("\\}[_\\-\\.~]{1}"); + private final ImmutableList segments; + private final ImmutableMap bindings; + private final boolean urlEncoding; + + public static PathTemplate create(String template) { + return create(template, true); + } + + public static PathTemplate createWithoutUrlEncoding(String template) { + return create(template, false); + } + + private static PathTemplate create(String template, boolean urlEncoding) { + return new PathTemplate(parseTemplate(template), urlEncoding); + } + + private PathTemplate(Iterable segments, boolean urlEncoding) { + this.segments = ImmutableList.copyOf(segments); + if (this.segments.isEmpty()) { + throw new ValidationException("template cannot be empty.", new Object[0]); + } else { + Map bindings = Maps.newLinkedHashMap(); + UnmodifiableIterator var4 = this.segments.iterator(); + + while(var4.hasNext()) { + Segment seg = (Segment)var4.next(); + if (seg.kind() == PathTemplate.SegmentKind.BINDING) { + if (bindings.containsKey(seg.value())) { + throw new ValidationException("Duplicate binding '%s'", new Object[]{seg.value()}); + } + + bindings.put(seg.value(), seg); + } + } + + this.bindings = ImmutableMap.copyOf(bindings); + this.urlEncoding = urlEncoding; + } + } + + public Set vars() { + return this.bindings.keySet(); + } + + public PathTemplate parentTemplate() { + int i = this.segments.size(); + --i; + Segment seg = (Segment)this.segments.get(i); + if (seg.kind() == PathTemplate.SegmentKind.END_BINDING) { + while(i > 0) { + --i; + if (((Segment)this.segments.get(i)).kind() == PathTemplate.SegmentKind.BINDING) { + break; + } + } + } + + if (i == 0) { + throw new ValidationException("template does not have a parent", new Object[0]); + } else { + return new PathTemplate(this.segments.subList(0, i), this.urlEncoding); + } + } + + public PathTemplate withoutVars() { + StringBuilder result = new StringBuilder(); + ListIterator iterator = this.segments.listIterator(); + boolean start = true; + + while(iterator.hasNext()) { + Segment seg = (Segment)iterator.next(); + switch (seg.kind()) { + case END_BINDING: + case BINDING: + break; + default: + if (!start) { + result.append(seg.separator()); + } else { + start = false; + } + + result.append(seg.value()); + } + } + + return create(result.toString(), this.urlEncoding); + } + + public PathTemplate subTemplate(String varName) { + List sub = Lists.newArrayList(); + boolean inBinding = false; + UnmodifiableIterator var4 = this.segments.iterator(); + + while(true) { + while(var4.hasNext()) { + Segment seg = (Segment)var4.next(); + if (seg.kind() == PathTemplate.SegmentKind.BINDING && seg.value().equals(varName)) { + inBinding = true; + } else if (inBinding) { + if (seg.kind() == PathTemplate.SegmentKind.END_BINDING) { + return create(toSyntax(sub, true), this.urlEncoding); + } + + sub.add(seg); + } + } + + throw new ValidationException(String.format("Variable '%s' is undefined in template '%s'", varName, this.toRawString()), new Object[0]); + } + } + + public boolean endsWithLiteral() { + return ((Segment)this.segments.get(this.segments.size() - 1)).kind() == PathTemplate.SegmentKind.LITERAL; + } + + public boolean endsWithCustomVerb() { + return ((Segment)this.segments.get(this.segments.size() - 1)).kind() == PathTemplate.SegmentKind.CUSTOM_VERB; + } + + public TemplatedResourceName parse(String path) { + return TemplatedResourceName.create(this, path); + } + + @Nullable + public String singleVar() { + return this.bindings.size() == 1 ? (String)((Map.Entry)this.bindings.entrySet().iterator().next()).getKey() : null; + } + + public void validate(String path, String exceptionMessagePrefix) { + if (!this.matches(path)) { + throw new ValidationException(String.format("%s: Parameter \"%s\" must be in the form \"%s\"", exceptionMessagePrefix, path, this.toString()), new Object[0]); + } + } + + public Map validatedMatch(String path, String exceptionMessagePrefix) { + Map matchMap = this.match(path); + if (matchMap == null) { + throw new ValidationException(String.format("%s: Parameter \"%s\" must be in the form \"%s\"", exceptionMessagePrefix, path, this.toString()), new Object[0]); + } else { + return matchMap; + } + } + + public boolean matches(String path) { + return this.match(path) != null; + } + + @Nullable + public Map match(String path) { + return this.match(path, false); + } + + @Nullable + public Map matchFromFullName(String path) { + return this.match(path, true); + } + + private Map match(String path, boolean forceHostName) { + Segment last = (Segment)this.segments.get(this.segments.size() - 1); + Matcher matcher; + if (last.kind() == PathTemplate.SegmentKind.CUSTOM_VERB) { + matcher = CUSTOM_VERB_PATTERN.matcher(path); + if (!matcher.find() || !this.decodeUrl(matcher.group(1)).equals(last.value())) { + return null; + } + + path = path.substring(0, matcher.start(0)); + } + + matcher = HOSTNAME_PATTERN.matcher(path); + boolean withHostName = matcher.find(); + if (withHostName) { + path = matcher.replaceFirst(""); + } + + List input = SLASH_SPLITTER.splitToList(path); + int inPos = 0; + Map values = Maps.newLinkedHashMap(); + if (withHostName || forceHostName) { + if (input.isEmpty()) { + return null; + } + + String hostName = (String)input.get(inPos++); + if (withHostName) { + hostName = matcher.group(0) + hostName; + } + + values.put("$hostname", hostName); + } + + if (withHostName) { + inPos = this.alignInputToAlignableSegment(input, inPos, (Segment)this.segments.get(0)); + } + + if (!this.match(input, inPos, this.segments, 0, values)) { + return null; + } else { + return ImmutableMap.copyOf(values); + } + } + + private int alignInputToAlignableSegment(List input, int inPos, Segment segment) { + switch (segment.kind()) { + case BINDING: + inPos = this.alignInputPositionToLiteral(input, inPos, segment.value() + "s"); + return inPos + 1; + case LITERAL: + return this.alignInputPositionToLiteral(input, inPos, segment.value()); + default: + return inPos; + } + } + + private int alignInputPositionToLiteral(List input, int inPos, String literalSegmentValue) { + while(inPos < input.size()) { + if (literalSegmentValue.equals(input.get(inPos))) { + return inPos; + } + + ++inPos; + } + + return inPos; + } + + private boolean match(List input, int inPos, List segments, int segPos, Map values) { + String currentVar = null; + List modifiableInput = new ArrayList(input); + + while(true) { + while(segPos < segments.size()) { + Segment seg = (Segment)segments.get(segPos++); + int complexSeparatorIndex; + switch (seg.kind()) { + case CUSTOM_VERB: + default: + break; + case END_BINDING: + currentVar = null; + break; + case BINDING: + currentVar = seg.value(); + break; + case LITERAL: + case WILDCARD: + if (inPos >= modifiableInput.size()) { + return false; + } + + String next = this.decodeUrl((String)modifiableInput.get(inPos++)); + if (seg.kind() == PathTemplate.SegmentKind.LITERAL && !seg.value().equals(next)) { + return false; + } + + if (seg.kind() == PathTemplate.SegmentKind.WILDCARD && !seg.complexSeparator().isEmpty()) { + complexSeparatorIndex = next.indexOf(seg.complexSeparator()); + if (complexSeparatorIndex < 0) { + return false; + } + + modifiableInput.add(inPos, next.substring(complexSeparatorIndex + 1)); + next = next.substring(0, complexSeparatorIndex); + modifiableInput.set(inPos - 1, next); + } + + if (currentVar != null) { + values.put(currentVar, concatCaptures((String)values.get(currentVar), next)); + } + break; + case PATH_WILDCARD: + complexSeparatorIndex = 0; + int available = segPos; + + while(available < segments.size()) { + switch (((Segment)segments.get(available)).kind()) { + default: + ++complexSeparatorIndex; + case CUSTOM_VERB: + case END_BINDING: + case BINDING: + ++available; + } + } + + available = modifiableInput.size() - inPos - complexSeparatorIndex; + if (available == 0 && !values.containsKey(currentVar)) { + values.put(currentVar, ""); + } + + while(available-- > 0) { + values.put(currentVar, concatCaptures((String)values.get(currentVar), this.decodeUrl((String)modifiableInput.get(inPos++)))); + } + } + } + + return inPos == modifiableInput.size(); + } + } + + private static String concatCaptures(@Nullable String cur, String next) { + return cur == null ? next : cur + "/" + next; + } + + public String instantiate(Map values) { + return this.instantiate(values, false); + } + + public String instantiate(String... keysAndValues) { + ImmutableMap.Builder builder = ImmutableMap.builder(); + + for(int i = 0; i < keysAndValues.length; i += 2) { + builder.put(keysAndValues[i], keysAndValues[i + 1]); + } + + return this.instantiate((Map)builder.build()); + } + + public String instantiatePartial(Map values) { + return this.instantiate(values, true); + } + + private String instantiate(Map values, boolean allowPartial) { + StringBuilder result = new StringBuilder(); + if (values.containsKey("$hostname")) { + result.append((String)values.get("$hostname")); + result.append('/'); + } + + boolean continueLast = true; + boolean skip = false; + ListIterator iterator = this.segments.listIterator(); + String prevSeparator = ""; + + while(true) { + while(true) { + while(iterator.hasNext()) { + Segment seg = (Segment)iterator.next(); + String var; + if (!skip && !continueLast) { + var = !prevSeparator.isEmpty() && iterator.hasNext() ? prevSeparator : seg.separator(); + result.append(var); + prevSeparator = seg.complexSeparator().isEmpty() ? seg.separator() : seg.complexSeparator(); + } + + continueLast = false; + switch (seg.kind()) { + case END_BINDING: + if (!skip) { + result.append('}'); + } + + skip = false; + break; + case BINDING: + var = seg.value(); + String value = (String)values.get(seg.value()); + if (value == null) { + if (!allowPartial) { + throw new ValidationException(String.format("Unbound variable '%s'. Bindings: %s", var, values), new Object[0]); + } + + if (var.startsWith("$")) { + result.append(((Segment)iterator.next()).value()); + iterator.next(); + } else { + result.append('{'); + result.append(seg.value()); + result.append('='); + continueLast = true; + } + break; + } + + Segment next = (Segment)iterator.next(); + Segment nextNext = (Segment)iterator.next(); + boolean pathEscape = next.kind() == PathTemplate.SegmentKind.PATH_WILDCARD || nextNext.kind() != PathTemplate.SegmentKind.END_BINDING; + restore(iterator, iterator.nextIndex() - 2); + if (!pathEscape) { + result.append(this.encodeUrl(value)); + } else { + boolean first = true; + Iterator var15 = SLASH_SPLITTER.split(value).iterator(); + + while(var15.hasNext()) { + String subSeg = (String)var15.next(); + if (!first) { + result.append('/'); + } + + first = false; + result.append(this.encodeUrl(subSeg)); + } + } + + skip = true; + break; + default: + if (!skip) { + result.append(seg.value()); + } + } + } + + return result.toString(); + } + } + } + + public String encode(String... values) { + ImmutableMap.Builder builder = ImmutableMap.builder(); + int i = 0; + String[] var4 = values; + int var5 = values.length; + + for(int var6 = 0; var6 < var5; ++var6) { + String value = var4[var6]; + builder.put("$" + i++, value); + } + + return this.instantiate((Map)builder.build()); + } + + public List decode(String path) { + Map match = this.match(path); + if (match == null) { + throw new IllegalArgumentException(String.format("template '%s' does not match '%s'", this, path)); + } else { + List result = Lists.newArrayList(); + Iterator var4 = match.entrySet().iterator(); + + while(var4.hasNext()) { + Map.Entry entry = (Map.Entry)var4.next(); + String key = (String)entry.getKey(); + if (!key.startsWith("$")) { + throw new IllegalArgumentException("template must not contain named bindings"); + } + + int i = Integer.parseInt(key.substring(1)); + + while(result.size() <= i) { + result.add(""); + } + + result.set(i, entry.getValue()); + } + + return ImmutableList.copyOf(result); + } + } + + private static ImmutableList parseTemplate(String template) { + if (template.startsWith("/")) { + template = template.substring(1); + } + + Matcher matcher = CUSTOM_VERB_PATTERN.matcher(template); + String customVerb = null; + if (matcher.find()) { + customVerb = matcher.group(1); + template = template.substring(0, matcher.start(0)); + } + + ImmutableList.Builder builder = ImmutableList.builder(); + String varName = null; + int freeWildcardCounter = 0; + int pathWildCardBound = 0; + Iterator var7 = Splitter.on('/').trimResults().split(template).iterator(); + + while(true) { + while(var7.hasNext()) { + String seg = (String)var7.next(); + if (!seg.equals("_deleted-topic_")) { + boolean isLastSegment = template.indexOf(seg) + seg.length() == template.length(); + boolean isCollectionWildcard = !isLastSegment && (seg.equals("-") || seg.equals("-}")); + if (!isCollectionWildcard && isSegmentBeginOrEndInvalid(seg)) { + throw new ValidationException("parse error: invalid begin or end character in '%s'", new Object[]{seg}); + } + + if (MULTIPLE_COMPLEX_DELIMITER_PATTERN.matcher(seg).find() || MISSING_COMPLEX_DELIMITER_PATTERN.matcher(seg).find()) { + throw new ValidationException("parse error: missing or 2+ consecutive delimiter characters in '%s'", new Object[]{seg}); + } + + boolean bindingStarts = seg.startsWith("{"); + boolean implicitWildcard = false; + boolean complexDelimiterFound = false; + if (bindingStarts) { + if (varName != null) { + throw new ValidationException("parse error: nested binding in '%s'", new Object[]{template}); + } + + seg = seg.substring(1); + if (INVALID_COMPLEX_DELIMITER_PATTERN.matcher(seg).find()) { + throw new ValidationException("parse error: invalid complex resource ID delimiter character in '%s'", new Object[]{seg}); + } + + Matcher complexPatternDelimiterMatcher = END_SEGMENT_COMPLEX_DELIMITER_PATTERN.matcher(seg); + complexDelimiterFound = !isCollectionWildcard && complexPatternDelimiterMatcher.find(); + if (complexDelimiterFound) { + builder.addAll(parseComplexResourceId(seg)); + } else { + int i = seg.indexOf(61); + if (i <= 0) { + if (!seg.endsWith("}")) { + throw new ValidationException("parse error: invalid binding syntax in '%s'", new Object[]{template}); + } + + implicitWildcard = true; + varName = seg.substring(0, seg.length() - 1).trim(); + seg = seg.substring(seg.length() - 1).trim(); + } else if (seg.indexOf(45) <= 0 && isCollectionWildcard) { + implicitWildcard = true; + } else { + varName = seg.substring(0, i).trim(); + seg = seg.substring(i + 1).trim(); + } + + builder.add(PathTemplate.Segment.create(PathTemplate.SegmentKind.BINDING, varName)); + } + } + + if (!complexDelimiterFound) { + boolean bindingEnds = seg.endsWith("}"); + if (bindingEnds) { + seg = seg.substring(0, seg.length() - 1).trim(); + } + + switch (seg) { + case "**": + case "*": + if ("**".equals(seg)) { + ++pathWildCardBound; + } + + Segment wildcard = seg.length() == 2 ? PathTemplate.Segment.PATH_WILDCARD : PathTemplate.Segment.WILDCARD; + if (varName == null) { + builder.add(PathTemplate.Segment.create(PathTemplate.SegmentKind.BINDING, "$" + freeWildcardCounter)); + ++freeWildcardCounter; + builder.add(wildcard); + builder.add(PathTemplate.Segment.END_BINDING); + } else { + builder.add(wildcard); + } + break; + case "": + if (!bindingEnds) { + throw new ValidationException("parse error: empty segment not allowed in '%s'", new Object[]{template}); + } + break; + case "-": + builder.add(PathTemplate.Segment.WILDCARD); + implicitWildcard = false; + break; + default: + builder.add(PathTemplate.Segment.create(PathTemplate.SegmentKind.LITERAL, seg)); + } + + if (bindingEnds && !complexDelimiterFound) { + varName = null; + if (implicitWildcard) { + builder.add(PathTemplate.Segment.WILDCARD); + } + + builder.add(PathTemplate.Segment.END_BINDING); + } + + if (pathWildCardBound > 1) { + throw new ValidationException("parse error: pattern must not contain more than one path wildcard ('**') in '%s'", new Object[]{template}); + } + } + } else { + builder.add(PathTemplate.Segment.create(PathTemplate.SegmentKind.LITERAL, seg)); + } + } + + if (customVerb != null) { + builder.add(PathTemplate.Segment.create(PathTemplate.SegmentKind.CUSTOM_VERB, customVerb)); + } + + return builder.build(); + } + } + + private static boolean isSegmentBeginOrEndInvalid(String seg) { + if (seg.length() == 1 && COMPLEX_DELIMITER_PATTERN.matcher(seg).find()) { + return true; + } else { + return COMPLEX_DELIMITER_PATTERN.matcher(seg.substring(0, 1)).find() && seg.charAt(1) == '{' || COMPLEX_DELIMITER_PATTERN.matcher(seg.substring(seg.length() - 1)).find() && seg.charAt(seg.length() - 2) == '}'; + } + } + + private static List parseComplexResourceId(String seg) { + List segments = new ArrayList(); + List separatorIndices = new ArrayList(); + Matcher complexPatternDelimiterMatcher = END_SEGMENT_COMPLEX_DELIMITER_PATTERN.matcher(seg); + + int delimiterIndex; + for(boolean delimiterFound = complexPatternDelimiterMatcher.find(); delimiterFound; delimiterFound = complexPatternDelimiterMatcher.find(delimiterIndex + 1)) { + delimiterIndex = complexPatternDelimiterMatcher.start(); + if (seg.substring(delimiterIndex).startsWith("}")) { + ++delimiterIndex; + } + + String currDelimiter = seg.substring(delimiterIndex, delimiterIndex + 1); + if (!COMPLEX_DELIMITER_PATTERN.matcher(currDelimiter).find()) { + throw new ValidationException("parse error: invalid complex ID delimiter '%s' in '%s'", new Object[]{currDelimiter, seg}); + } + + separatorIndices.add(currDelimiter); + } + + separatorIndices.add(""); + String subVarName = null; + Iterable complexSubsegments = Splitter.onPattern("\\}[_\\-\\.~]").trimResults().split(seg); + boolean complexSegImplicitWildcard = false; + int currIteratorIndex = 0; + + for(Iterator var9 = complexSubsegments.iterator(); var9.hasNext(); ++currIteratorIndex) { + String complexSeg = (String)var9.next(); + boolean subsegmentBindingStarts = complexSeg.startsWith("{"); + if (subsegmentBindingStarts) { + if (subVarName != null) { + throw new ValidationException("parse error: nested binding in '%s'", new Object[]{complexSeg}); + } + + complexSeg = complexSeg.substring(1); + } + + subVarName = complexSeg.trim(); + boolean subBindingEnds = complexSeg.endsWith("}"); + int i = complexSeg.indexOf(61); + if (i <= 0) { + if (subBindingEnds) { + complexSegImplicitWildcard = true; + subVarName = complexSeg.substring(0, complexSeg.length() - 1).trim(); + complexSeg = complexSeg.substring(complexSeg.length() - 1).trim(); + } + } else { + subVarName = complexSeg.substring(0, i).trim(); + complexSeg = complexSeg.substring(i + 1).trim(); + if (complexSeg.equals("**")) { + throw new ValidationException("parse error: wildcard path not allowed in complex ID resource '%s'", new Object[]{subVarName}); + } + } + + String complexDelimiter = currIteratorIndex < separatorIndices.size() ? (String)separatorIndices.get(currIteratorIndex) : ""; + segments.add(PathTemplate.Segment.create(PathTemplate.SegmentKind.BINDING, subVarName, complexDelimiter)); + segments.add(PathTemplate.Segment.wildcardCreate(complexDelimiter)); + segments.add(PathTemplate.Segment.END_BINDING); + subVarName = null; + } + + return segments; + } + + private String encodeUrl(String text) { + if (this.urlEncoding) { + try { + return URLEncoder.encode(text, "UTF-8"); + } catch (UnsupportedEncodingException var3) { + throw new ValidationException("UTF-8 encoding is not supported on this platform", new Object[0]); + } + } else { + String INVALID_CHAR = "/"; + if (text.contains("/")) { + throw new ValidationException("Invalid character \"/\" in path section \"" + text + "\".", new Object[0]); + } else { + return text; + } + } + } + + private String decodeUrl(String url) { + if (this.urlEncoding) { + try { + return URLDecoder.decode(url, "UTF-8"); + } catch (UnsupportedEncodingException var3) { + throw new ValidationException("UTF-8 encoding is not supported on this platform", new Object[0]); + } + } else { + return url; + } + } + + private static boolean peek(ListIterator segments, SegmentKind... kinds) { + int start = segments.nextIndex(); + boolean success = false; + SegmentKind[] var4 = kinds; + int var5 = kinds.length; + + for(int var6 = 0; var6 < var5; ++var6) { + SegmentKind kind = var4[var6]; + if (!segments.hasNext() || ((Segment)segments.next()).kind() != kind) { + success = false; + break; + } + } + + if (success) { + return true; + } else { + restore(segments, start); + return false; + } + } + + private static void restore(ListIterator segments, int index) { + while(segments.nextIndex() > index) { + segments.previous(); + } + + } + + public String toString() { + return toSyntax(this.segments, true); + } + + public String toRawString() { + return toSyntax(this.segments, false); + } + + private static String toSyntax(List segments, boolean pretty) { + StringBuilder result = new StringBuilder(); + boolean continueLast = true; + ListIterator iterator = segments.listIterator(); + + while(true) { + while(true) { + while(iterator.hasNext()) { + Segment seg = (Segment)iterator.next(); + if (!continueLast) { + result.append(seg.separator()); + } + + continueLast = false; + switch (seg.kind()) { + case END_BINDING: + result.append('}'); + break; + case BINDING: + if (pretty && seg.value().startsWith("$")) { + seg = (Segment)iterator.next(); + result.append(seg.value()); + iterator.next(); + } else { + result.append('{'); + result.append(seg.value()); + if (pretty && peek(iterator, PathTemplate.SegmentKind.WILDCARD, PathTemplate.SegmentKind.END_BINDING)) { + result.append('}'); + } else { + result.append('='); + continueLast = true; + } + } + break; + default: + result.append(seg.value()); + } + } + + return result.toString(); + } + } + } + + public boolean equals(Object obj) { + if (!(obj instanceof PathTemplate)) { + return false; + } else { + PathTemplate other = (PathTemplate)obj; + return Objects.equals(this.segments, other.segments); + } + } + + public int hashCode() { + return this.segments.hashCode(); + } + + @AutoValue + abstract static class Segment { + private static final Segment WILDCARD; + private static final Segment PATH_WILDCARD; + private static final Segment END_BINDING; + + Segment() { + } + + private static Segment create(SegmentKind kind, String value) { + return new AutoValue_PathTemplate_Segment(kind, value, ""); + } + + private static Segment create(SegmentKind kind, String value, String complexSeparator) { + return new AutoValue_PathTemplate_Segment(kind, value, complexSeparator); + } + + private static Segment wildcardCreate(String complexSeparator) { + return new AutoValue_PathTemplate_Segment(PathTemplate.SegmentKind.WILDCARD, "*", !complexSeparator.isEmpty() && PathTemplate.COMPLEX_DELIMITER_PATTERN.matcher(complexSeparator).find() ? complexSeparator : ""); + } + + abstract SegmentKind kind(); + + abstract String value(); + + abstract String complexSeparator(); + + boolean isAnyWildcard() { + return this.kind() == PathTemplate.SegmentKind.WILDCARD || this.kind() == PathTemplate.SegmentKind.PATH_WILDCARD; + } + + String separator() { + switch (this.kind()) { + case CUSTOM_VERB: + return ":"; + case END_BINDING: + return ""; + default: + return "/"; + } + } + + static { + WILDCARD = create(PathTemplate.SegmentKind.WILDCARD, "*"); + PATH_WILDCARD = create(PathTemplate.SegmentKind.PATH_WILDCARD, "**"); + END_BINDING = create(PathTemplate.SegmentKind.END_BINDING, ""); + } + } + + static enum SegmentKind { + LITERAL, + CUSTOM_VERB, + WILDCARD, + PATH_WILDCARD, + BINDING, + END_BINDING; + + private SegmentKind() { + } + } +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/TemplatedResourceName.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/TemplatedResourceName.java new file mode 100644 index 00000000..ebb593c5 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/TemplatedResourceName.java @@ -0,0 +1,170 @@ +package com.clearblade.cloud.iot.v1.utils; + +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Sets; + +import javax.annotation.Nullable; +import java.util.Collection; +import java.util.Map; +import java.util.Objects; +import java.util.Set; + +public class TemplatedResourceName implements Map { + private static volatile Resolver resourceNameResolver = new Resolver() { + public T resolve(Class resourceType, TemplatedResourceName name, String version) { + throw new IllegalStateException("No resource name resolver is registered in ResourceName class."); + } + }; + private final PathTemplate template; + private final ImmutableMap values; + private final String endpoint; + private volatile String stringRepr; + + public static void registerResourceNameResolver(Resolver resolver) { + resourceNameResolver = resolver; + } + + public static TemplatedResourceName create(PathTemplate template, String path) { + Map values = template.match(path); + if (values == null) { + throw new ValidationException("path '%s' does not match template '%s'", new Object[]{path, template}); + } else { + return new TemplatedResourceName(template, values, (String)null); + } + } + + public static TemplatedResourceName create(PathTemplate template, Map values) { + if (!values.keySet().containsAll(template.vars())) { + Set unbound = Sets.newLinkedHashSet(template.vars()); + unbound.removeAll(values.keySet()); + throw new ValidationException("unbound variables: %s", new Object[]{unbound}); + } else { + return new TemplatedResourceName(template, values, (String)null); + } + } + + @Nullable + public static TemplatedResourceName createFromFullName(PathTemplate template, String path) { + Map values = template.matchFromFullName(path); + return values == null ? null : new TemplatedResourceName(template, values, (String)null); + } + + private TemplatedResourceName(PathTemplate template, Map values, String endpoint) { + this.template = template; + this.values = ImmutableMap.copyOf(values); + this.endpoint = endpoint; + } + + public String toString() { + if (this.stringRepr == null) { + this.stringRepr = this.template.instantiate(this.values); + } + + return this.stringRepr; + } + + public boolean equals(Object obj) { + if (!(obj instanceof TemplatedResourceName)) { + return false; + } else { + TemplatedResourceName other = (TemplatedResourceName)obj; + return Objects.equals(this.template, other.template) && Objects.equals(this.endpoint, other.endpoint) && Objects.equals(this.values, other.values); + } + } + + public int hashCode() { + return Objects.hash(new Object[]{this.template, this.endpoint, this.values}); + } + + public PathTemplate template() { + return this.template; + } + + public boolean hasEndpoint() { + return this.endpoint != null; + } + + @Nullable + public String endpoint() { + return this.endpoint; + } + + public TemplatedResourceName withEndpoint(String endpoint) { + return new TemplatedResourceName(this.template, this.values, (String) Preconditions.checkNotNull(endpoint)); + } + + public TemplatedResourceName parentName() { + PathTemplate parentTemplate = this.template.parentTemplate(); + return new TemplatedResourceName(parentTemplate, this.values, this.endpoint); + } + + public boolean startsWith(TemplatedResourceName parentName) { + return this.toString().startsWith(parentName.toString()); + } + + public T resolve(Class resourceType, @Nullable String version) { + Preconditions.checkArgument(this.hasEndpoint(), "Resource name must have an endpoint."); + return resourceNameResolver.resolve(resourceType, this, version); + } + + public int size() { + return this.values.size(); + } + + public boolean isEmpty() { + return this.values.isEmpty(); + } + + public boolean containsKey(Object key) { + return this.values.containsKey(key); + } + + public boolean containsValue(Object value) { + return this.values.containsValue(value); + } + + public String get(Object key) { + return (String)this.values.get(key); + } + + /** @deprecated */ + @Deprecated + public String put(String key, String value) { + return (String)this.values.put(key, value); + } + + /** @deprecated */ + @Deprecated + public String remove(Object key) { + return (String)this.values.remove(key); + } + + /** @deprecated */ + @Deprecated + public void putAll(Map m) { + this.values.putAll(m); + } + + /** @deprecated */ + @Deprecated + public void clear() { + this.values.clear(); + } + + public Set keySet() { + return this.values.keySet(); + } + + public Collection values() { + return this.values.values(); + } + + public Set> entrySet() { + return this.values.entrySet(); + } + + public interface Resolver { + T resolve(Class var1, TemplatedResourceName var2, @Nullable String var3); + } +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Timestamp.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Timestamp.java new file mode 100644 index 00000000..49f22157 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Timestamp.java @@ -0,0 +1,115 @@ +package com.clearblade.cloud.iot.v1.utils; + +import com.clearblade.cloud.iot.v1.devicetypes.GatewayAuthMethod; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayConfig; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayType; + +import java.sql.Time; + +public class Timestamp implements TimestampOrBuilder { + + public static final int SECONDS_FIELD_NUMBER = 1; + private long seconds_; + public static final int NANOS_FIELD_NUMBER = 2; + private int nanos_; + private byte memoizedIsInitialized; + private static final Timestamp DEFAULT_INSTANCE; + + private Timestamp() { + this.seconds_ = 0L; + this.nanos_ = 0; + this.memoizedIsInitialized = -1; + } + + public Timestamp(long seconds, int nanos) { + this.seconds_ = seconds; + this.nanos_ = nanos; + this.memoizedIsInitialized = -1; + } + + public Timestamp(Builder builder) { + this.seconds_ = builder.seconds_; + this.nanos_ = builder.nanos_; + this.memoizedIsInitialized = builder.memoizedIsInitialized; + } + + public static Builder newBuilder() { + return new Timestamp.Builder(); + } + + public Builder toBuilder() { + return new Timestamp.Builder(); + } + + + public static class Builder { + private long seconds_; + private int nanos_; + private byte memoizedIsInitialized; + + protected Builder() { + } + + private Builder(Timestamp timestamp) { + this.seconds_ = timestamp.seconds_; + this.nanos_ = timestamp.nanos_; + this.memoizedIsInitialized = timestamp.memoizedIsInitialized; + } + + public Builder setSeconds(long seconds_) { + this.seconds_ = seconds_; + return this; + } + + public Builder setNanos(int nanos_) { + this.nanos_ = nanos_; + return this; + } + + public Builder setMemoizedIsInitialized(byte memoizedIsInitialized) { + this.memoizedIsInitialized = memoizedIsInitialized; + return this; + } + + public Timestamp build() { + return new Timestamp(this); + } + } + + public long getSeconds() { + return this.seconds_; + } + + public int getNanos() { + return this.nanos_; + } + + public final boolean isInitialized() { + final byte isInitialized = this.memoizedIsInitialized; + if (isInitialized == 1) { + return true; + } + if (isInitialized == 0) { + return false; + } + this.memoizedIsInitialized = 1; + return true; + } + + public static Timestamp getDefaultInstance() { + return Timestamp.DEFAULT_INSTANCE; + } + + public Timestamp getDefaultInstanceForType() { + return Timestamp.DEFAULT_INSTANCE; + } + + static { + DEFAULT_INSTANCE = new Timestamp(); + } + + @Override + public String toString() { + return "seconds: " + getSeconds() + " nanos: " + getNanos(); + } +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/TimestampOrBuilder.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/TimestampOrBuilder.java new file mode 100644 index 00000000..7a5e8159 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/TimestampOrBuilder.java @@ -0,0 +1,7 @@ +package com.clearblade.cloud.iot.v1.utils; + +public interface TimestampOrBuilder { + long getSeconds(); + + int getNanos(); +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Utils.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Utils.java new file mode 100644 index 00000000..839b2be8 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/Utils.java @@ -0,0 +1,30 @@ +package com.clearblade.cloud.iot.v1.utils; + +public class Utils { + + /** + * Check if env variable set as Binary Data enabled. + * + * @return + */ + public static boolean isBinary() { + String isBinary = System.getenv(Constants.BINARYDATA); + if (isBinary != null && isBinary.equalsIgnoreCase("true")) { + return true; + } else + return false; + } + + public static boolean isEmpty(Object text) { + int strLength; + if (text == null) + return true; + if (text == null || (strLength = text.toString().length()) == 0) + return true; + for (int i = 0; i < strLength; i++) + if (!Character.isWhitespace(text.toString().charAt(i))) + return false; + return false; + } + +} diff --git a/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ValidationException.java b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ValidationException.java new file mode 100644 index 00000000..4d4f77b2 --- /dev/null +++ b/clearblade-cloud-iot/src/com/clearblade/cloud/iot/v1/utils/ValidationException.java @@ -0,0 +1,58 @@ +package com.clearblade.cloud.iot.v1.utils; + +import java.util.Iterator; +import java.util.Stack; + +public class ValidationException extends IllegalArgumentException { + private static ThreadLocal>> contextLocal = new ThreadLocal(); + + public static void pushCurrentThreadValidationContext(Supplier supplier) { + Stack> stack = (Stack)contextLocal.get(); + if (stack == null) { + stack = new Stack(); + contextLocal.set(stack); + } + + stack.push(supplier); + } + + public static void pushCurrentThreadValidationContext(final String context) { + pushCurrentThreadValidationContext(new Supplier() { + public String get() { + return context; + } + }); + } + + public static void popCurrentThreadValidationContext() { + Stack stack = (Stack)contextLocal.get(); + if (stack != null) { + stack.pop(); + } + + } + + public ValidationException(String format, Object... args) { + super(message((Stack)contextLocal.get(), format, args)); + } + + private static String message(Stack> context, String format, Object... args) { + if (context != null && !context.isEmpty()) { + StringBuilder result = new StringBuilder(); + Iterator var4 = context.iterator(); + + while(var4.hasNext()) { + Supplier supplier = (Supplier)var4.next(); + result.append((String)supplier.get() + ": "); + } + + return result.toString() + String.format(format, args); + } else { + return String.format(format, args); + } + } + + public interface Supplier { + T get(); + } +} \ No newline at end of file diff --git a/clearblade-cloud-iot/src/test/DeviceManagerClientTest.java b/clearblade-cloud-iot/src/test/DeviceManagerClientTest.java new file mode 100644 index 00000000..fd993d09 --- /dev/null +++ b/clearblade-cloud-iot/src/test/DeviceManagerClientTest.java @@ -0,0 +1,317 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package test; +import java.util.ArrayList; +import java.util.HashMap; + +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +import com.clearblade.cloud.iot.v1.DeviceManagerClient; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayRequest; +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayResponse; +import com.clearblade.cloud.iot.v1.createdevice.CreateDeviceRequest; +import com.clearblade.cloud.iot.v1.createdeviceregistry.CreateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.deletedevice.DeleteDeviceRequest; +import com.clearblade.cloud.iot.v1.deletedeviceregistry.DeleteDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceName; +import com.clearblade.cloud.iot.v1.devicetypes.FieldMask; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayConfig; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayType; +import com.clearblade.cloud.iot.v1.devicetypes.Status; +import com.clearblade.cloud.iot.v1.getdevice.GetDeviceRequest; +import com.clearblade.cloud.iot.v1.getdeviceregistry.GetDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.LocationName; +import com.clearblade.cloud.iot.v1.registrytypes.RegistryName; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceRequest; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceResponse; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayRequest; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayResponse; +import com.clearblade.cloud.iot.v1.updatedevice.UpdateDeviceRequest; +import com.clearblade.cloud.iot.v1.updatedeviceregistry.UpdateDeviceRegistryRequest; +import com.clearblade.cloud.iot.v1.utils.ByteString; +import com.clearblade.cloud.iot.v1.utils.LogLevel; +import test.ExpectedResponseTest; + +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +public class DeviceManagerClientTest { + + private static DeviceManagerClient client; + private static ExpectedResponseTest testResponse; + private final String project = System.getenv("PROJECT_ID"); + private final String location = System.getenv("REGION"); + private final String registryId = System.getenv("REGISTRY"); + private final String failedRegistryId = System.getenv("FAILED_REGISTRY"); + private final String deviceId = System.getenv("DEVICE"); + private final String gatewayId = System.getenv("GATEWAY_ID"); + private final String numDeviceId = System.getenv("NUM_DEVICE_ID"); + private final String numGatewayId = System.getenv("NUM_GATEWAY_ID"); + + @BeforeAll + public static void setUp() { + client = new DeviceManagerClient(); + testResponse = new ExpectedResponseTest(); + } + + @Test + @Order(1) + public void testCreateRegistrySuccess() { + DeviceRegistry expectedResponse = testResponse.getResponseTest2(registryId); + CreateDeviceRegistryRequest request = CreateDeviceRegistryRequest.Builder.newBuilder() + .setParent(LocationName.of(project, location).toString()) + .setDeviceRegistry( + DeviceRegistry.newBuilder().setId(registryId).setLogLevel(LogLevel.DEBUG).build()) + .build(); + DeviceRegistry actualResponse = client.createDeviceRegistry(request); + testResponse.assertEquals(expectedResponse, actualResponse); + } + + @Test + @Order(2) + public void testGetRegistrySuccess() { + DeviceRegistry expectedResponse = testResponse.getResponseTest3(registryId); + GetDeviceRegistryRequest request = GetDeviceRegistryRequest.Builder.newBuilder() + .setName(RegistryName.of(project, location, registryId).getRegistryFullName()) + .build(); + DeviceRegistry actualResponse = client.getDeviceRegistry(request); + testResponse.assertEquals(expectedResponse, actualResponse); + + } + + @Test + @Order(3) + public void testGetRegistryFail() { + GetDeviceRegistryRequest request = GetDeviceRegistryRequest.Builder.newBuilder() + .setName(RegistryName.of(project, location, failedRegistryId).getRegistryFullName()) + .build(); + DeviceRegistry actualResponse = null; + try { + actualResponse = client.getDeviceRegistry(request); + } catch (Exception e) { + testResponse.assertException(e); + testResponse.assertContains(e.getMessage(), "No systems found matching that combination of project, region and registry:"); + } + testResponse.assertEqualsNull(actualResponse); + } + + @Test + @Order(4) + public void testUpdateDeviceRegistrySuccess() { + RegistryName name = RegistryName.of(project, location, registryId); + DeviceRegistry expectedResponse = testResponse.getResponseTest5(registryId); + UpdateDeviceRegistryRequest request = UpdateDeviceRegistryRequest.Builder.newBuilder() + .setDeviceRegistry(DeviceRegistry.newBuilder().setId(registryId) + .setName(name.getRegistryFullName()) + .setLogLevel(LogLevel.ERROR) + .build()) + .setName(name.getRegistryFullName()).setUpdateMask("logLevel").build(); + + DeviceRegistry actualResponse = client.updateDeviceRegistry(request); + testResponse.assertEquals(expectedResponse, actualResponse); + } + + @Test + @Order(5) + public void testCreateDeviceSuccess() { + RegistryName parent = RegistryName.of(project, location, registryId); + Device expectedResponse = testResponse.getResponseTest7(deviceId, numDeviceId); + GatewayConfig gatewayCfg = GatewayConfig.newBuilder().setGatewayType(GatewayType.NON_GATEWAY).build(); + Device device = Device.newBuilder() + .setId(deviceId) + .setName(deviceId) + .setNumId(numDeviceId) + .setBlocked(false) + .setGatewayConfig(gatewayCfg) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + CreateDeviceRequest request = CreateDeviceRequest.Builder.newBuilder().setParent(parent.toString()).setDevice(device) + .build(); + Device actualResponse = client.createDevice(request); + testResponse.assertEqual(expectedResponse, actualResponse); + + } + + @Test + @Order(6) + public void testCreateDeviceAsAGatewaySuccess() { + RegistryName parent = RegistryName.of(project, location, registryId); + Device expectedResponse = testResponse.getResponseTest8(gatewayId, numGatewayId); + GatewayConfig gatewayCfg = GatewayConfig.newBuilder().setGatewayType(GatewayType.GATEWAY).build(); + Device device = Device.newBuilder() + .setId(gatewayId) + .setName(gatewayId) + .setNumId(numGatewayId) + .setBlocked(false) + .setGatewayConfig(gatewayCfg) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + CreateDeviceRequest request = CreateDeviceRequest.Builder.newBuilder().setParent(parent.toString()).setDevice(device) + .build(); + Device actualResponse = client.createDevice(request); + testResponse.assertEqual(expectedResponse, actualResponse); + + } + + @Test + @Order(7) + public void testGetDeviceFail() { + DeviceName name = DeviceName.of(project, location, registryId, "test_device02"); + GetDeviceRequest request = GetDeviceRequest.Builder.newBuilder().setName(name) + .setFieldMask(FieldMask.newBuilder().build()).build(); + Device actualResponse = null; + try { + actualResponse = client.getDevice(request); + } catch (Exception e) { + testResponse.assertException(e); + testResponse.assertContains(e.getMessage(), "doesn't exist"); + } + testResponse.assertEqualsNull(actualResponse); + } + + @Test + @Order(8) + public void testGetDeviceSuccess() { + DeviceName name = DeviceName.of(project, location, registryId, deviceId); + Device expectedResponse = testResponse.getResponseTest10(deviceId, numDeviceId); + GetDeviceRequest request = GetDeviceRequest.Builder.newBuilder().setName(name) + .setFieldMask(FieldMask.newBuilder().build()).build(); + Device actualResponse = client.getDevice(request); + testResponse.assertEqual(expectedResponse, actualResponse); + } + + @Test + @Order(9) + public void testGetDeviceAsAGatewaySuccess() { + DeviceName name = DeviceName.of(project, location, registryId, gatewayId); + Device expectedResponse = testResponse.getResponseTest11(gatewayId, numGatewayId); + GetDeviceRequest request = GetDeviceRequest.Builder.newBuilder().setName(name) + .setFieldMask(FieldMask.newBuilder().build()).build(); + Device actualResponse = client.getDevice(request); + testResponse.assertEqual(expectedResponse, actualResponse); + } + + @Test + @Order(10) + public void testUpdateDevice() { + Device expectedResponse = testResponse.getResponseTest12(deviceId); + Device device = Device.patch(deviceId, deviceId, LogLevel.ERROR, true); + DeviceName deviceName = DeviceName.of(project, location, registryId, deviceId); + String updateMask = "logLevel"; + UpdateDeviceRequest request = UpdateDeviceRequest.Builder.newBuilder().setName(deviceName.toString()).setDevice(device) + .setUpdateMask(updateMask).build(); + Device actualResponse = client.updateDevice(request); + testResponse.assertEqual(expectedResponse, actualResponse); + + } + + @Test + @Order(11) + public void testBindDeviceToGateway() { + BindDeviceToGatewayResponse expectedResponse = testResponse.getResponseTest13(); + BindDeviceToGatewayRequest request = BindDeviceToGatewayRequest.Builder.newBuilder() + .setParent(RegistryName.of(project, location, registryId).toString()) + .setGateway(gatewayId).setDevice(deviceId).build(); + BindDeviceToGatewayResponse actualResponse = client.bindDeviceToGateway(request); + testResponse.assertEqualResponse(expectedResponse, actualResponse); + + } + + @Test + @Order(12) + public void testUnbindDeviceFromGateway() { + UnbindDeviceFromGatewayResponse expectedResponse = testResponse.getResponseTest14(); + UnbindDeviceFromGatewayRequest request = UnbindDeviceFromGatewayRequest.Builder.newBuilder() + .setParent(RegistryName.of(project, location, registryId).toString()) + .setGateway(gatewayId).setDevice(deviceId).build(); + UnbindDeviceFromGatewayResponse actualResponse = client.unbindDeviceFromGateway(request); + testResponse.assertEqualsResponse(expectedResponse, actualResponse); + } + + @Test + @Order(13) + public void testSendCommandToDevice() { + String byteData = "c2VuZEZ1bm55TWVzc2FnZVRvRGV2aWNl"; + SendCommandToDeviceRequest request = SendCommandToDeviceRequest.Builder.newBuilder() + .setName(DeviceName + .of(project, location, registryId, deviceId) + .toString()) + .setBinaryData(new ByteString(byteData)).build(); + SendCommandToDeviceResponse actualResponse = null; + try { + actualResponse = client.sendCommandToDevice(request); + } catch (Exception e) { + testResponse.assertException(e); + testResponse.assertContains(e.getMessage(), " is not connected."); + } + testResponse.assertEqualsNull(actualResponse); + } + + @Test + @Order(14) + public void testDeleteDevice() { + DeviceName deviceName = DeviceName.of(project, location, registryId, deviceId); + DeleteDeviceRequest request = DeleteDeviceRequest.Builder.newBuilder().setName(deviceName).build(); + client.deleteDevice(request); + } + + @Test + @Order(15) + public void testDeleteDeviceAsAGateway() { + DeviceName deviceName = DeviceName.of(project, location, registryId, gatewayId); + DeleteDeviceRequest request = DeleteDeviceRequest.Builder.newBuilder().setName(deviceName).build(); + client.deleteDevice(request); + } + + @Test + @Order(16) + public void testDeleteDeviceRegistry() { + DeleteDeviceRegistryRequest request = DeleteDeviceRegistryRequest.Builder.newBuilder() + .setName(RegistryName.of(project, location, registryId) + .getRegistryFullName()) + .build(); + client.deleteDeviceRegistry(request); + + } + +} diff --git a/clearblade-cloud-iot/src/test/ExpectedResponseTest.java b/clearblade-cloud-iot/src/test/ExpectedResponseTest.java new file mode 100644 index 00000000..70d36a2a --- /dev/null +++ b/clearblade-cloud-iot/src/test/ExpectedResponseTest.java @@ -0,0 +1,398 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package test; +import java.util.ArrayList; +import java.util.HashMap; + +import com.clearblade.cloud.iot.v1.binddevicetogateway.BindDeviceToGatewayResponse; +import com.clearblade.cloud.iot.v1.devicetypes.Device; +import com.clearblade.cloud.iot.v1.devicetypes.DeviceConfig; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayConfig; +import com.clearblade.cloud.iot.v1.devicetypes.GatewayType; +import com.clearblade.cloud.iot.v1.devicetypes.Status; +import com.clearblade.cloud.iot.v1.exception.ApplicationException; +import com.clearblade.cloud.iot.v1.registrytypes.DeviceRegistry; +import com.clearblade.cloud.iot.v1.registrytypes.HttpConfig; +import com.clearblade.cloud.iot.v1.registrytypes.HttpState; +import com.clearblade.cloud.iot.v1.registrytypes.MqttConfig; +import com.clearblade.cloud.iot.v1.registrytypes.MqttState; +import com.clearblade.cloud.iot.v1.registrytypes.StateNotificationConfig; +import com.clearblade.cloud.iot.v1.sendcommandtodevice.SendCommandToDeviceResponse; +import com.clearblade.cloud.iot.v1.unbinddevicefromgateway.UnbindDeviceFromGatewayResponse; +import com.clearblade.cloud.iot.v1.utils.LogLevel; +import org.junit.Assert; +import org.junit.jupiter.api.Assertions; + +import static org.junit.matchers.JUnitMatchers.containsString; + +public class ExpectedResponseTest { + + public boolean assertEquals(DeviceRegistry obj1, DeviceRegistry obj2) { + boolean flag = true; + if (!obj1.toBuilder().getId().equals(obj2.toBuilder().getId()) + || obj1.toBuilder().getHttpConfig().equals(obj2.toBuilder().getHttpConfig()) + || obj1.toBuilder().getMqttConfig().equals(obj2.toBuilder().getMqttConfig()) + || obj1.toBuilder().getLogLevel().equals(obj2.toBuilder().getLogLevel()) + || obj1.toBuilder().getStateNotificationConfig().equals(obj2.toBuilder().getStateNotificationConfig())) + flag = false; + return flag; + } + + public boolean assertNotEquals(DeviceRegistry obj1, DeviceRegistry obj2) { + boolean flag = true; + if (obj2 == null) + return flag; + else if (obj1.toBuilder().getId().equals(obj2.toBuilder().getId()) + || obj1.toBuilder().getHttpConfig().equals(obj2.toBuilder().getHttpConfig()) + || obj1.toBuilder().getMqttConfig().equals(obj2.toBuilder().getMqttConfig()) + || obj1.toBuilder().getLogLevel().equals(obj2.toBuilder().getLogLevel()) + || obj1.toBuilder().getStateNotificationConfig().equals(obj2.toBuilder().getStateNotificationConfig())) + flag = false; + return flag; + } + + public boolean assertEqual(Device obj1, Device obj2) { + boolean flag = true; + if (obj2 == null) + return flag; + else if (!obj1.toBuilder().getId().equals(obj2.toBuilder().getId()) + || obj1.toBuilder().getLogLevel().equals(obj2.toBuilder().getLogLevel()) + || obj1.toBuilder().getCredentials().equals(obj2.toBuilder().getCredentials())) + flag = false; + return flag; + } + + public void assertException(Throwable e) { + Assertions.assertInstanceOf(ApplicationException.class, e); + } + + public void assertContains(String actual, String expected) { + Assert.assertThat(actual, containsString(expected)); + } + + public void assertEqualsNull(Object obj) { + Assertions.assertNull(obj); + } + + public boolean assertNotEqual(Device obj1, Device obj2) { + boolean flag = true; + if (obj2 == null) + return flag; + else if (obj1.toBuilder().getId().equals(obj2.toBuilder().getId()) + || obj1.toBuilder().getName().equals(obj2.toBuilder().getName()) + || obj1.toBuilder().getNumId().equals(obj2.toBuilder().getNumId()) + || obj1.toBuilder().getGatewayConfig().equals(obj2.toBuilder().getGatewayConfig()) + || obj1.toBuilder().getLogLevel().equals(obj2.toBuilder().getLogLevel()) + || obj1.toBuilder().getCredentials().equals(obj2.toBuilder().getCredentials())) + flag = false; + return flag; + } + + public boolean assertEqualResponse(BindDeviceToGatewayResponse obj1, BindDeviceToGatewayResponse obj2) { + boolean flag = true; + if (obj1.getHttpStatusCode() != obj2.getHttpStatusCode() || !(obj1.getHttpStatusResponse().equals(obj2.getHttpStatusResponse()))) + flag = false; + return flag; + } + + public boolean assertEqualsResponse(UnbindDeviceFromGatewayResponse obj1, UnbindDeviceFromGatewayResponse obj2) { + boolean flag = true; + if (obj1.getHttpStatusCode() != obj2.getHttpStatusCode() || !(obj1.getHttpStatusResponse().equals(obj2.getHttpStatusResponse()))) + flag = false; + return flag; + } + + public boolean assertEqualsResponses(SendCommandToDeviceResponse obj1, SendCommandToDeviceResponse obj2) { + boolean flag = true; + if (obj1.getHttpStatusCode() != obj2.getHttpStatusCode() || !(obj1.getHttpStatusResponse().equals(obj2.getHttpStatusResponse()))) + flag = false; + return flag; + } + + public DeviceRegistry getResponseTest1(String registryId) { + + HttpConfig httpConfig = new HttpConfig(); + httpConfig.setHttpEnabledState(HttpState.HTTP_ENABLED); + + MqttConfig mqttConfig = new MqttConfig(); + mqttConfig.setMqttEnabledState(MqttState.MQTT_ENABLED); + + StateNotificationConfig stateConfig = new StateNotificationConfig(); + stateConfig.setPubsubTopicName(""); + + return DeviceRegistry.newBuilder() + .setId(registryId) + .setHttpConfig(httpConfig) + .setMqttConfig(mqttConfig) + .setLogLevel(LogLevel.DEBUG) + .setStateNotificationConfig(stateConfig) + .build(); + } + + public DeviceRegistry getResponseTest2(String registryId) { + + HttpConfig httpConfig = new HttpConfig(); + httpConfig.setHttpEnabledState(HttpState.HTTP_ENABLED); + + MqttConfig mqttConfig = new MqttConfig(); + mqttConfig.setMqttEnabledState(MqttState.MQTT_ENABLED); + + StateNotificationConfig stateConfig = new StateNotificationConfig(); + stateConfig.setPubsubTopicName(""); + + return DeviceRegistry.newBuilder() + .setId(registryId) + .setCredentials(new ArrayList<>()) + .setHttpConfig(httpConfig) + .setMqttConfig(mqttConfig) + .setLogLevel(LogLevel.DEBUG) + .setEventNotificationConfigs(new ArrayList<>()) + .setStateNotificationConfig(stateConfig) + .build(); + } + + + public DeviceRegistry getResponseTest3(String registryId) { + + HttpConfig httpConfig = new HttpConfig(); + httpConfig.setHttpEnabledState(HttpState.HTTP_ENABLED); + + MqttConfig mqttConfig = new MqttConfig(); + mqttConfig.setMqttEnabledState(MqttState.MQTT_ENABLED); + + StateNotificationConfig stateConfig = new StateNotificationConfig(); + stateConfig.setPubsubTopicName(""); + + return DeviceRegistry.newBuilder() + .setId(registryId) + .setHttpConfig(httpConfig) + .setMqttConfig(mqttConfig) + .setLogLevel(LogLevel.DEBUG) + .setStateNotificationConfig(stateConfig) + .build(); + } + + public DeviceRegistry getResponseTest4(String registryId) { + + HttpConfig httpConfig = new HttpConfig(); + httpConfig.setHttpEnabledState(HttpState.HTTP_ENABLED); + + MqttConfig mqttConfig = new MqttConfig(); + mqttConfig.setMqttEnabledState(MqttState.MQTT_ENABLED); + + StateNotificationConfig stateConfig = new StateNotificationConfig(); + stateConfig.setPubsubTopicName(""); + + return DeviceRegistry.newBuilder() + .setId(registryId) + .setHttpConfig(httpConfig) + .setMqttConfig(mqttConfig) + .setLogLevel(LogLevel.DEBUG) + .setStateNotificationConfig(stateConfig) + .build(); + } + + + public DeviceRegistry getResponseTest5(String registryId) { + + HttpConfig httpConfig = new HttpConfig(); + httpConfig.setHttpEnabledState(HttpState.HTTP_ENABLED); + + MqttConfig mqttConfig = new MqttConfig(); + mqttConfig.setMqttEnabledState(MqttState.MQTT_ENABLED); + + StateNotificationConfig stateConfig = new StateNotificationConfig(); + stateConfig.setPubsubTopicName(""); + + return DeviceRegistry.newBuilder() + .setId(registryId) + .setHttpConfig(httpConfig) + .setMqttConfig(mqttConfig) + .setLogLevel(LogLevel.ERROR) + .setStateNotificationConfig(stateConfig) + .build(); + } + + + public Device getResponseTest6(String deviceId, String numId) { + + GatewayConfig gatewayConfig = new GatewayConfig(); + gatewayConfig.setGatewayType(GatewayType.NON_GATEWAY); + + return Device.newBuilder() + .setId(deviceId) + .setName(deviceId) + .setNumId(numId) + .setBlocked(false) + .setGatewayConfig(gatewayConfig) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + + } + + public Device getResponseTest7(String deviceId, String numId) { + + GatewayConfig gatewayConfig = new GatewayConfig(); + gatewayConfig.setGatewayType(GatewayType.NON_GATEWAY); + + return Device.newBuilder() + .setId(deviceId) + .setName(deviceId) + .setNumId(numId) + .setBlocked(false) + .setGatewayConfig(gatewayConfig) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + + } + + public Device getResponseTest8(String deviceId, String numId) { + + GatewayConfig gatewayConfig = new GatewayConfig(); + gatewayConfig.setGatewayType(GatewayType.GATEWAY); + + return Device.newBuilder() + .setId(deviceId) + .setName(deviceId) + .setNumId(numId) + .setBlocked(false) + .setGatewayConfig(gatewayConfig) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + + } + + public Device getResponseTest9(String deviceId, String numId) { + + GatewayConfig gatewayConfig = new GatewayConfig(); + gatewayConfig.setGatewayType(GatewayType.NON_GATEWAY); + + return Device.newBuilder() + .setId(deviceId) + .setName(deviceId) + .setNumId(numId) + .setBlocked(false) + .setGatewayConfig(gatewayConfig) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + + } + + public Device getResponseTest10(String deviceId, String numId) { + + GatewayConfig gatewayConfig = new GatewayConfig(); + gatewayConfig.setGatewayType(GatewayType.NON_GATEWAY); + + return Device.newBuilder() + .setId(deviceId) + .setName(deviceId) + .setNumId(numId) + .setBlocked(false) + .setGatewayConfig(gatewayConfig) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + + } + + public Device getResponseTest11(String deviceId, String numId) { + + GatewayConfig gatewayConfig = new GatewayConfig(); + gatewayConfig.setGatewayType(GatewayType.GATEWAY); + + return Device.newBuilder() + .setId(deviceId) + .setName(deviceId) + .setNumId(numId) + .setBlocked(false) + .setGatewayConfig(gatewayConfig) + .setLogLevel(LogLevel.DEBUG) + .setCredentials(new ArrayList<>()) + .setLastErrorStatus(new Status()) + .setConfig(new DeviceConfig()) + .setMetadata(new HashMap<>()) + .build(); + + } + + public Device getResponseTest12(String deviceId) { + GatewayConfig gatewayConfig = new GatewayConfig(); + gatewayConfig.setGatewayType(GatewayType.NON_GATEWAY); + return Device.newBuilder() + .setId(deviceId) + .setName(deviceId) + .setBlocked(false) + .setLogLevel(LogLevel.ERROR) + .build(); + } + + public BindDeviceToGatewayResponse getResponseTest13() { + + BindDeviceToGatewayResponse response = BindDeviceToGatewayResponse.Builder.newBuilder().build(); + response.setHttpStatusCode(200); + response.setHttpStatusResponse("OK"); + return response; + } + + public UnbindDeviceFromGatewayResponse getResponseTest14() { + + UnbindDeviceFromGatewayResponse response = UnbindDeviceFromGatewayResponse.Builder.newBuilder().build(); + response.setHttpStatusCode(200); + response.setHttpStatusResponse("OK"); + return response; + } + + public SendCommandToDeviceResponse getResponseTest15() { + + SendCommandToDeviceResponse response = SendCommandToDeviceResponse.Builder.newBuilder().build(); + response.setHttpStatusCode(200); + response.setHttpStatusResponse("OK"); + return response; + } +} diff --git a/clearblade-cloud-iot/src/test/com/clearblade/cloud/iot/v1/test/package-info.java b/clearblade-cloud-iot/src/test/com/clearblade/cloud/iot/v1/test/package-info.java new file mode 100644 index 00000000..d9cea184 --- /dev/null +++ b/clearblade-cloud-iot/src/test/com/clearblade/cloud/iot/v1/test/package-info.java @@ -0,0 +1,31 @@ +/* + * Copyright 2023 ClearBlade 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 + * + * 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. + * + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package test.com.clearblade.cloud.iot.v1.test; \ No newline at end of file diff --git a/codecov.yaml b/codecov.yaml deleted file mode 100644 index 5724ea94..00000000 --- a/codecov.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -codecov: - ci: - - source.cloud.google.com diff --git a/google-cloud-iot-bom/pom.xml b/google-cloud-iot-bom/pom.xml deleted file mode 100644 index 4f03ef43..00000000 --- a/google-cloud-iot-bom/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-iot-bom - 2.3.5 - pom - - com.google.cloud - google-cloud-shared-config - 1.5.3 - - - Google Cloud iot BOM - https://github.com/googleapis/java-iot - - BOM for Google Cloud IoT Core - - - - Google LLC - - - - - chingor13 - Jeff Ching - chingor@google.com - Google LLC - - Developer - - - - - - scm:git:https://github.com/googleapis/java-iot.git - scm:git:git@github.com:googleapis/java-iot.git - https://github.com/googleapis/java-iot - - - - - The Apache Software License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - - - - - - - com.google.cloud - google-cloud-iot - 2.3.5 - - - com.google.api.grpc - grpc-google-cloud-iot-v1 - 2.3.5 - - - com.google.api.grpc - proto-google-cloud-iot-v1 - 2.3.5 - - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - true - - - - - diff --git a/google-cloud-iot/pom.xml b/google-cloud-iot/pom.xml deleted file mode 100644 index 8b3d128c..00000000 --- a/google-cloud-iot/pom.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-iot - 2.3.5 - jar - Google Cloud IoT Core - https://github.com/googleapis/java-iot - Java idiomatic client for Google Cloud IoT Core - - com.google.cloud - google-cloud-iot-parent - 2.3.5 - - - google-cloud-iot - - - - 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-iam-v1 - - - - com.google.api.grpc - proto-google-cloud-iot-v1 - - - com.google.guava - guava - - - com.google.api - gax - - - com.google.api - gax-grpc - - - com.google.api - gax-httpjson - - - org.threeten - threetenbp - - - - - junit - junit - test - - - com.google.cloud - google-cloud-core - test - - - - com.google.api.grpc - grpc-google-cloud-iot-v1 - test - - - - com.google.api - gax - testlib - test - - - com.google.api - gax-grpc - testlib - test - - - com.google.api - gax-httpjson - testlib - test - - - - - - java9 - - [9,) - - - - javax.annotation - javax.annotation-api - - - - - - - - - org.codehaus.mojo - flatten-maven-plugin - - - - diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java deleted file mode 100644 index 839d3392..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java +++ /dev/null @@ -1,2934 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1; - -import com.google.api.core.ApiFuture; -import com.google.api.core.ApiFutures; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.paging.AbstractFixedSizeCollection; -import com.google.api.gax.paging.AbstractPage; -import com.google.api.gax.paging.AbstractPagedListResponse; -import com.google.api.gax.rpc.PageContext; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.api.resourcenames.ResourceName; -import com.google.cloud.iot.v1.stub.DeviceManagerStub; -import com.google.cloud.iot.v1.stub.DeviceManagerStubSettings; -import com.google.common.util.concurrent.MoreExecutors; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.ByteString; -import com.google.protobuf.Empty; -import com.google.protobuf.FieldMask; -import java.io.IOException; -import java.util.List; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Service Description: Internet of Things (IoT) service. Securely connect and manage IoT devices. - * - *

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

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
- *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- *   DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build();
- *   DeviceRegistry response = deviceManagerClient.createDeviceRegistry(parent, deviceRegistry);
- * }
- * }
- * - *

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

To customize credentials: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * DeviceManagerSettings deviceManagerSettings =
- *     DeviceManagerSettings.newBuilder()
- *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
- *         .build();
- * DeviceManagerClient deviceManagerClient = DeviceManagerClient.create(deviceManagerSettings);
- * }
- * - *

To customize the endpoint: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * DeviceManagerSettings deviceManagerSettings =
- *     DeviceManagerSettings.newBuilder().setEndpoint(myEndpoint).build();
- * DeviceManagerClient deviceManagerClient = DeviceManagerClient.create(deviceManagerSettings);
- * }
- * - *

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

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * DeviceManagerSettings deviceManagerSettings =
- *     DeviceManagerSettings.newBuilder()
- *         .setTransportChannelProvider(
- *             DeviceManagerSettings.defaultHttpJsonTransportProviderBuilder().build())
- *         .build();
- * DeviceManagerClient deviceManagerClient = DeviceManagerClient.create(deviceManagerSettings);
- * }
- * - *

Please refer to the GitHub repository's samples for more quickstart code snippets. - */ -@Generated("by gapic-generator-java") -public class DeviceManagerClient implements BackgroundResource { - private final DeviceManagerSettings settings; - private final DeviceManagerStub stub; - - /** Constructs an instance of DeviceManagerClient with default settings. */ - public static final DeviceManagerClient create() throws IOException { - return create(DeviceManagerSettings.newBuilder().build()); - } - - /** - * Constructs an instance of DeviceManagerClient, 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 DeviceManagerClient create(DeviceManagerSettings settings) - throws IOException { - return new DeviceManagerClient(settings); - } - - /** - * Constructs an instance of DeviceManagerClient, using the given stub for making calls. This is - * for advanced usage - prefer using create(DeviceManagerSettings). - */ - public static final DeviceManagerClient create(DeviceManagerStub stub) { - return new DeviceManagerClient(stub); - } - - /** - * Constructs an instance of DeviceManagerClient, 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 DeviceManagerClient(DeviceManagerSettings settings) throws IOException { - this.settings = settings; - this.stub = ((DeviceManagerStubSettings) settings.getStubSettings()).createStub(); - } - - protected DeviceManagerClient(DeviceManagerStub stub) { - this.settings = null; - this.stub = stub; - } - - public final DeviceManagerSettings getSettings() { - return settings; - } - - public DeviceManagerStub getStub() { - return stub; - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a device registry that contains devices. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build();
-   *   DeviceRegistry response = deviceManagerClient.createDeviceRegistry(parent, deviceRegistry);
-   * }
-   * }
- * - * @param parent Required. The project and cloud region where this device registry must be - * created. For example, `projects/example-project/locations/us-central1`. - * @param deviceRegistry Required. The device registry. The field `name` must be empty. The server - * will generate that field from the device registry `id` provided and the `parent` field. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final DeviceRegistry createDeviceRegistry( - LocationName parent, DeviceRegistry deviceRegistry) { - CreateDeviceRegistryRequest request = - CreateDeviceRegistryRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .setDeviceRegistry(deviceRegistry) - .build(); - return createDeviceRegistry(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a device registry that contains devices. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
-   *   DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build();
-   *   DeviceRegistry response = deviceManagerClient.createDeviceRegistry(parent, deviceRegistry);
-   * }
-   * }
- * - * @param parent Required. The project and cloud region where this device registry must be - * created. For example, `projects/example-project/locations/us-central1`. - * @param deviceRegistry Required. The device registry. The field `name` must be empty. The server - * will generate that field from the device registry `id` provided and the `parent` field. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final DeviceRegistry createDeviceRegistry(String parent, DeviceRegistry deviceRegistry) { - CreateDeviceRegistryRequest request = - CreateDeviceRegistryRequest.newBuilder() - .setParent(parent) - .setDeviceRegistry(deviceRegistry) - .build(); - return createDeviceRegistry(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a device registry that contains devices. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   CreateDeviceRegistryRequest request =
-   *       CreateDeviceRegistryRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setDeviceRegistry(DeviceRegistry.newBuilder().build())
-   *           .build();
-   *   DeviceRegistry response = deviceManagerClient.createDeviceRegistry(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 DeviceRegistry createDeviceRegistry(CreateDeviceRegistryRequest request) { - return createDeviceRegistryCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a device registry that contains devices. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   CreateDeviceRegistryRequest request =
-   *       CreateDeviceRegistryRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setDeviceRegistry(DeviceRegistry.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.createDeviceRegistryCallable().futureCall(request);
-   *   // Do something.
-   *   DeviceRegistry response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - createDeviceRegistryCallable() { - return stub.createDeviceRegistryCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]");
-   *   DeviceRegistry response = deviceManagerClient.getDeviceRegistry(name);
-   * }
-   * }
- * - * @param name Required. The name of the device registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final DeviceRegistry getDeviceRegistry(RegistryName name) { - GetDeviceRegistryRequest request = - GetDeviceRegistryRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .build(); - return getDeviceRegistry(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString();
-   *   DeviceRegistry response = deviceManagerClient.getDeviceRegistry(name);
-   * }
-   * }
- * - * @param name Required. The name of the device registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final DeviceRegistry getDeviceRegistry(String name) { - GetDeviceRegistryRequest request = GetDeviceRegistryRequest.newBuilder().setName(name).build(); - return getDeviceRegistry(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   GetDeviceRegistryRequest request =
-   *       GetDeviceRegistryRequest.newBuilder()
-   *           .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .build();
-   *   DeviceRegistry response = deviceManagerClient.getDeviceRegistry(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 DeviceRegistry getDeviceRegistry(GetDeviceRegistryRequest request) { - return getDeviceRegistryCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   GetDeviceRegistryRequest request =
-   *       GetDeviceRegistryRequest.newBuilder()
-   *           .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.getDeviceRegistryCallable().futureCall(request);
-   *   // Do something.
-   *   DeviceRegistry response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable getDeviceRegistryCallable() { - return stub.getDeviceRegistryCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Updates a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   DeviceRegistry response =
-   *       deviceManagerClient.updateDeviceRegistry(deviceRegistry, updateMask);
-   * }
-   * }
- * - * @param deviceRegistry Required. The new values for the device registry. The `id` field must be - * empty, and the `name` field must indicate the path of the resource. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param updateMask Required. Only updates the `device_registry` fields indicated by this mask. - * The field mask must not be empty, and it must not contain fields that are immutable or only - * set by the server. Mutable top-level fields: `event_notification_config`, `http_config`, - * `mqtt_config`, and `state_notification_config`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final DeviceRegistry updateDeviceRegistry( - DeviceRegistry deviceRegistry, FieldMask updateMask) { - UpdateDeviceRegistryRequest request = - UpdateDeviceRegistryRequest.newBuilder() - .setDeviceRegistry(deviceRegistry) - .setUpdateMask(updateMask) - .build(); - return updateDeviceRegistry(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Updates a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   UpdateDeviceRegistryRequest request =
-   *       UpdateDeviceRegistryRequest.newBuilder()
-   *           .setDeviceRegistry(DeviceRegistry.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   DeviceRegistry response = deviceManagerClient.updateDeviceRegistry(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 DeviceRegistry updateDeviceRegistry(UpdateDeviceRegistryRequest request) { - return updateDeviceRegistryCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Updates a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   UpdateDeviceRegistryRequest request =
-   *       UpdateDeviceRegistryRequest.newBuilder()
-   *           .setDeviceRegistry(DeviceRegistry.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.updateDeviceRegistryCallable().futureCall(request);
-   *   // Do something.
-   *   DeviceRegistry response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - updateDeviceRegistryCallable() { - return stub.updateDeviceRegistryCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]");
-   *   deviceManagerClient.deleteDeviceRegistry(name);
-   * }
-   * }
- * - * @param name Required. The name of the device registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteDeviceRegistry(RegistryName name) { - DeleteDeviceRegistryRequest request = - DeleteDeviceRegistryRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .build(); - deleteDeviceRegistry(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString();
-   *   deviceManagerClient.deleteDeviceRegistry(name);
-   * }
-   * }
- * - * @param name Required. The name of the device registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteDeviceRegistry(String name) { - DeleteDeviceRegistryRequest request = - DeleteDeviceRegistryRequest.newBuilder().setName(name).build(); - deleteDeviceRegistry(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeleteDeviceRegistryRequest request =
-   *       DeleteDeviceRegistryRequest.newBuilder()
-   *           .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .build();
-   *   deviceManagerClient.deleteDeviceRegistry(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteDeviceRegistry(DeleteDeviceRegistryRequest request) { - deleteDeviceRegistryCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a device registry configuration. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeleteDeviceRegistryRequest request =
-   *       DeleteDeviceRegistryRequest.newBuilder()
-   *           .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.deleteDeviceRegistryCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
-   * }
-   * }
- */ - public final UnaryCallable deleteDeviceRegistryCallable() { - return stub.deleteDeviceRegistryCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists device registries. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
-   *   for (DeviceRegistry element : deviceManagerClient.listDeviceRegistries(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- * - * @param parent Required. The project and cloud region path. For example, - * `projects/example-project/locations/us-central1`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListDeviceRegistriesPagedResponse listDeviceRegistries(LocationName parent) { - ListDeviceRegistriesRequest request = - ListDeviceRegistriesRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .build(); - return listDeviceRegistries(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists device registries. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
-   *   for (DeviceRegistry element : deviceManagerClient.listDeviceRegistries(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- * - * @param parent Required. The project and cloud region path. For example, - * `projects/example-project/locations/us-central1`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListDeviceRegistriesPagedResponse listDeviceRegistries(String parent) { - ListDeviceRegistriesRequest request = - ListDeviceRegistriesRequest.newBuilder().setParent(parent).build(); - return listDeviceRegistries(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists device registries. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDeviceRegistriesRequest request =
-   *       ListDeviceRegistriesRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (DeviceRegistry element :
-   *       deviceManagerClient.listDeviceRegistries(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 ListDeviceRegistriesPagedResponse listDeviceRegistries( - ListDeviceRegistriesRequest request) { - return listDeviceRegistriesPagedCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists device registries. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDeviceRegistriesRequest request =
-   *       ListDeviceRegistriesRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.listDeviceRegistriesPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (DeviceRegistry element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable - listDeviceRegistriesPagedCallable() { - return stub.listDeviceRegistriesPagedCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists device registries. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDeviceRegistriesRequest request =
-   *       ListDeviceRegistriesRequest.newBuilder()
-   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListDeviceRegistriesResponse response =
-   *         deviceManagerClient.listDeviceRegistriesCallable().call(request);
-   *     for (DeviceRegistry element : response.getDeviceRegistriesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable - listDeviceRegistriesCallable() { - return stub.listDeviceRegistriesCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a device in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]");
-   *   Device device = Device.newBuilder().build();
-   *   Device response = deviceManagerClient.createDevice(parent, device);
-   * }
-   * }
- * - * @param parent Required. The name of the device registry where this device should be created. - * For example, `projects/example-project/locations/us-central1/registries/my-registry`. - * @param device Required. The device registration details. The field `name` must be empty. The - * server generates `name` from the device registry `id` and the `parent` field. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Device createDevice(RegistryName parent, Device device) { - CreateDeviceRequest request = - CreateDeviceRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .setDevice(device) - .build(); - return createDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a device in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString();
-   *   Device device = Device.newBuilder().build();
-   *   Device response = deviceManagerClient.createDevice(parent, device);
-   * }
-   * }
- * - * @param parent Required. The name of the device registry where this device should be created. - * For example, `projects/example-project/locations/us-central1/registries/my-registry`. - * @param device Required. The device registration details. The field `name` must be empty. The - * server generates `name` from the device registry `id` and the `parent` field. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Device createDevice(String parent, Device device) { - CreateDeviceRequest request = - CreateDeviceRequest.newBuilder().setParent(parent).setDevice(device).build(); - return createDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a device in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   CreateDeviceRequest request =
-   *       CreateDeviceRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setDevice(Device.newBuilder().build())
-   *           .build();
-   *   Device response = deviceManagerClient.createDevice(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 Device createDevice(CreateDeviceRequest request) { - return createDeviceCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Creates a device in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   CreateDeviceRequest request =
-   *       CreateDeviceRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setDevice(Device.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = deviceManagerClient.createDeviceCallable().futureCall(request);
-   *   // Do something.
-   *   Device response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable createDeviceCallable() { - return stub.createDeviceCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets details about a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]");
-   *   Device response = deviceManagerClient.getDevice(name);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Device getDevice(DeviceName name) { - GetDeviceRequest request = - GetDeviceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return getDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets details about a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   Device response = deviceManagerClient.getDevice(name);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Device getDevice(String name) { - GetDeviceRequest request = GetDeviceRequest.newBuilder().setName(name).build(); - return getDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets details about a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   GetDeviceRequest request =
-   *       GetDeviceRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setFieldMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   Device response = deviceManagerClient.getDevice(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 Device getDevice(GetDeviceRequest request) { - return getDeviceCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets details about a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   GetDeviceRequest request =
-   *       GetDeviceRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setFieldMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = deviceManagerClient.getDeviceCallable().futureCall(request);
-   *   // Do something.
-   *   Device response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable getDeviceCallable() { - return stub.getDeviceCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Updates a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   Device device = Device.newBuilder().build();
-   *   FieldMask updateMask = FieldMask.newBuilder().build();
-   *   Device response = deviceManagerClient.updateDevice(device, updateMask);
-   * }
-   * }
- * - * @param device Required. The new values for the device. The `id` and `num_id` fields must be - * empty, and the field `name` must specify the name path. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param updateMask Required. Only updates the `device` fields indicated by this mask. The field - * mask must not be empty, and it must not contain fields that are immutable or only set by - * the server. Mutable top-level fields: `credentials`, `blocked`, and `metadata` - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Device updateDevice(Device device, FieldMask updateMask) { - UpdateDeviceRequest request = - UpdateDeviceRequest.newBuilder().setDevice(device).setUpdateMask(updateMask).build(); - return updateDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Updates a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   UpdateDeviceRequest request =
-   *       UpdateDeviceRequest.newBuilder()
-   *           .setDevice(Device.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   Device response = deviceManagerClient.updateDevice(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 Device updateDevice(UpdateDeviceRequest request) { - return updateDeviceCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Updates a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   UpdateDeviceRequest request =
-   *       UpdateDeviceRequest.newBuilder()
-   *           .setDevice(Device.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = deviceManagerClient.updateDeviceCallable().futureCall(request);
-   *   // Do something.
-   *   Device response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable updateDeviceCallable() { - return stub.updateDeviceCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]");
-   *   deviceManagerClient.deleteDevice(name);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteDevice(DeviceName name) { - DeleteDeviceRequest request = - DeleteDeviceRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - deleteDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   deviceManagerClient.deleteDevice(name);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteDevice(String name) { - DeleteDeviceRequest request = DeleteDeviceRequest.newBuilder().setName(name).build(); - deleteDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeleteDeviceRequest request =
-   *       DeleteDeviceRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .build();
-   *   deviceManagerClient.deleteDevice(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final void deleteDevice(DeleteDeviceRequest request) { - deleteDeviceCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes a device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeleteDeviceRequest request =
-   *       DeleteDeviceRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .build();
-   *   ApiFuture future = deviceManagerClient.deleteDeviceCallable().futureCall(request);
-   *   // Do something.
-   *   future.get();
-   * }
-   * }
- */ - public final UnaryCallable deleteDeviceCallable() { - return stub.deleteDeviceCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * List devices in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]");
-   *   for (Device element : deviceManagerClient.listDevices(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- * - * @param parent Required. The device registry path. Required. For example, - * `projects/my-project/locations/us-central1/registries/my-registry`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListDevicesPagedResponse listDevices(RegistryName parent) { - ListDevicesRequest request = - ListDevicesRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .build(); - return listDevices(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * List devices in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString();
-   *   for (Device element : deviceManagerClient.listDevices(parent).iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- * - * @param parent Required. The device registry path. Required. For example, - * `projects/my-project/locations/us-central1/registries/my-registry`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListDevicesPagedResponse listDevices(String parent) { - ListDevicesRequest request = ListDevicesRequest.newBuilder().setParent(parent).build(); - return listDevices(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * List devices in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDevicesRequest request =
-   *       ListDevicesRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .addAllDeviceNumIds(new ArrayList())
-   *           .addAllDeviceIds(new ArrayList())
-   *           .setFieldMask(FieldMask.newBuilder().build())
-   *           .setGatewayListOptions(GatewayListOptions.newBuilder().build())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   for (Device element : deviceManagerClient.listDevices(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 ListDevicesPagedResponse listDevices(ListDevicesRequest request) { - return listDevicesPagedCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * List devices in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDevicesRequest request =
-   *       ListDevicesRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .addAllDeviceNumIds(new ArrayList())
-   *           .addAllDeviceIds(new ArrayList())
-   *           .setFieldMask(FieldMask.newBuilder().build())
-   *           .setGatewayListOptions(GatewayListOptions.newBuilder().build())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   ApiFuture future = deviceManagerClient.listDevicesPagedCallable().futureCall(request);
-   *   // Do something.
-   *   for (Device element : future.get().iterateAll()) {
-   *     // doThingsWith(element);
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable - listDevicesPagedCallable() { - return stub.listDevicesPagedCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * List devices in a device registry. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDevicesRequest request =
-   *       ListDevicesRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .addAllDeviceNumIds(new ArrayList())
-   *           .addAllDeviceIds(new ArrayList())
-   *           .setFieldMask(FieldMask.newBuilder().build())
-   *           .setGatewayListOptions(GatewayListOptions.newBuilder().build())
-   *           .setPageSize(883849137)
-   *           .setPageToken("pageToken873572522")
-   *           .build();
-   *   while (true) {
-   *     ListDevicesResponse response = deviceManagerClient.listDevicesCallable().call(request);
-   *     for (Device element : response.getDevicesList()) {
-   *       // doThingsWith(element);
-   *     }
-   *     String nextPageToken = response.getNextPageToken();
-   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
-   *       request = request.toBuilder().setPageToken(nextPageToken).build();
-   *     } else {
-   *       break;
-   *     }
-   *   }
-   * }
-   * }
- */ - public final UnaryCallable listDevicesCallable() { - return stub.listDevicesCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core - * servers. Returns the modified configuration version and its metadata. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]");
-   *   ByteString binaryData = ByteString.EMPTY;
-   *   DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(name, binaryData);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param binaryData Required. The configuration data for the device. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final DeviceConfig modifyCloudToDeviceConfig(DeviceName name, ByteString binaryData) { - ModifyCloudToDeviceConfigRequest request = - ModifyCloudToDeviceConfigRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setBinaryData(binaryData) - .build(); - return modifyCloudToDeviceConfig(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core - * servers. Returns the modified configuration version and its metadata. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   ByteString binaryData = ByteString.EMPTY;
-   *   DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(name, binaryData);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param binaryData Required. The configuration data for the device. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final DeviceConfig modifyCloudToDeviceConfig(String name, ByteString binaryData) { - ModifyCloudToDeviceConfigRequest request = - ModifyCloudToDeviceConfigRequest.newBuilder() - .setName(name) - .setBinaryData(binaryData) - .build(); - return modifyCloudToDeviceConfig(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core - * servers. Returns the modified configuration version and its metadata. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ModifyCloudToDeviceConfigRequest request =
-   *       ModifyCloudToDeviceConfigRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setVersionToUpdate(462348390)
-   *           .setBinaryData(ByteString.EMPTY)
-   *           .build();
-   *   DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(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 DeviceConfig modifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest request) { - return modifyCloudToDeviceConfigCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Modifies the configuration for the device, which is eventually sent from the Cloud IoT Core - * servers. Returns the modified configuration version and its metadata. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ModifyCloudToDeviceConfigRequest request =
-   *       ModifyCloudToDeviceConfigRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setVersionToUpdate(462348390)
-   *           .setBinaryData(ByteString.EMPTY)
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.modifyCloudToDeviceConfigCallable().futureCall(request);
-   *   // Do something.
-   *   DeviceConfig response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - modifyCloudToDeviceConfigCallable() { - return stub.modifyCloudToDeviceConfigCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists the last few versions of the device configuration in descending order (i.e.: newest - * first). - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]");
-   *   ListDeviceConfigVersionsResponse response =
-   *       deviceManagerClient.listDeviceConfigVersions(name);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListDeviceConfigVersionsResponse listDeviceConfigVersions(DeviceName name) { - ListDeviceConfigVersionsRequest request = - ListDeviceConfigVersionsRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .build(); - return listDeviceConfigVersions(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists the last few versions of the device configuration in descending order (i.e.: newest - * first). - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   ListDeviceConfigVersionsResponse response =
-   *       deviceManagerClient.listDeviceConfigVersions(name);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListDeviceConfigVersionsResponse listDeviceConfigVersions(String name) { - ListDeviceConfigVersionsRequest request = - ListDeviceConfigVersionsRequest.newBuilder().setName(name).build(); - return listDeviceConfigVersions(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists the last few versions of the device configuration in descending order (i.e.: newest - * first). - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDeviceConfigVersionsRequest request =
-   *       ListDeviceConfigVersionsRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setNumVersions(-315385036)
-   *           .build();
-   *   ListDeviceConfigVersionsResponse response =
-   *       deviceManagerClient.listDeviceConfigVersions(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 ListDeviceConfigVersionsResponse listDeviceConfigVersions( - ListDeviceConfigVersionsRequest request) { - return listDeviceConfigVersionsCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists the last few versions of the device configuration in descending order (i.e.: newest - * first). - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDeviceConfigVersionsRequest request =
-   *       ListDeviceConfigVersionsRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setNumVersions(-315385036)
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.listDeviceConfigVersionsCallable().futureCall(request);
-   *   // Do something.
-   *   ListDeviceConfigVersionsResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - listDeviceConfigVersionsCallable() { - return stub.listDeviceConfigVersionsCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists the last few versions of the device state in descending order (i.e.: newest first). - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]");
-   *   ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(name);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListDeviceStatesResponse listDeviceStates(DeviceName name) { - ListDeviceStatesRequest request = - ListDeviceStatesRequest.newBuilder().setName(name == null ? null : name.toString()).build(); - return listDeviceStates(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists the last few versions of the device state in descending order (i.e.: newest first). - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(name);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final ListDeviceStatesResponse listDeviceStates(String name) { - ListDeviceStatesRequest request = ListDeviceStatesRequest.newBuilder().setName(name).build(); - return listDeviceStates(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists the last few versions of the device state in descending order (i.e.: newest first). - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDeviceStatesRequest request =
-   *       ListDeviceStatesRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setNumStates(1643330779)
-   *           .build();
-   *   ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(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 ListDeviceStatesResponse listDeviceStates(ListDeviceStatesRequest request) { - return listDeviceStatesCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Lists the last few versions of the device state in descending order (i.e.: newest first). - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ListDeviceStatesRequest request =
-   *       ListDeviceStatesRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setNumStates(1643330779)
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.listDeviceStatesCallable().futureCall(request);
-   *   // Do something.
-   *   ListDeviceStatesResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - listDeviceStatesCallable() { - return stub.listDeviceStatesCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - *

Sample code: - * - *

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

Sample code: - * - *

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

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   Policy response = deviceManagerClient.setIamPolicy(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Policy setIamPolicy(SetIamPolicyRequest request) { - return setIamPolicyCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sets the access control policy on the specified resource. Replaces any existing policy. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   SetIamPolicyRequest request =
-   *       SetIamPolicyRequest.newBuilder()
-   *           .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setPolicy(Policy.newBuilder().build())
-   *           .setUpdateMask(FieldMask.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = deviceManagerClient.setIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable setIamPolicyCallable() { - return stub.setIamPolicyCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists - * and does not have a policy set. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]");
-   *   Policy response = deviceManagerClient.getIamPolicy(resource);
-   * }
-   * }
- * - * @param resource REQUIRED: The resource for which the policy is being requested. See the - * operation documentation for the appropriate value for this field. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Policy getIamPolicy(ResourceName resource) { - GetIamPolicyRequest request = - GetIamPolicyRequest.newBuilder() - .setResource(resource == null ? null : resource.toString()) - .build(); - return getIamPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists - * and does not have a policy set. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String resource =
-   *       DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   Policy response = deviceManagerClient.getIamPolicy(resource);
-   * }
-   * }
- * - * @param resource REQUIRED: The resource for which the policy is being requested. See the - * operation documentation for the appropriate value for this field. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Policy getIamPolicy(String resource) { - GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); - return getIamPolicy(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists - * and does not have a policy set. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   Policy response = deviceManagerClient.getIamPolicy(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final Policy getIamPolicy(GetIamPolicyRequest request) { - return getIamPolicyCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Gets the access control policy for a resource. Returns an empty policy if the resource exists - * and does not have a policy set. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   GetIamPolicyRequest request =
-   *       GetIamPolicyRequest.newBuilder()
-   *           .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setOptions(GetPolicyOptions.newBuilder().build())
-   *           .build();
-   *   ApiFuture future = deviceManagerClient.getIamPolicyCallable().futureCall(request);
-   *   // Do something.
-   *   Policy response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable getIamPolicyCallable() { - return stub.getIamPolicyCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a NOT_FOUND error. - * - *

Sample code: - * - *

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

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String resource =
-   *       DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   List permissions = new ArrayList<>();
-   *   TestIamPermissionsResponse response =
-   *       deviceManagerClient.testIamPermissions(resource, permissions);
-   * }
-   * }
- * - * @param resource REQUIRED: The resource for which the policy detail is being requested. See the - * operation documentation for the appropriate value for this field. - * @param permissions The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final TestIamPermissionsResponse testIamPermissions( - String resource, List permissions) { - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(resource) - .addAllPermissions(permissions) - .build(); - return testIamPermissions(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a NOT_FOUND error. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   TestIamPermissionsResponse response = deviceManagerClient.testIamPermissions(request);
-   * }
-   * }
- * - * @param request The request object containing all of the parameters for the API call. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { - return testIamPermissionsCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Returns permissions that a caller has on the specified resource. If the resource does not - * exist, this will return an empty set of permissions, not a NOT_FOUND error. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   TestIamPermissionsRequest request =
-   *       TestIamPermissionsRequest.newBuilder()
-   *           .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .addAllPermissions(new ArrayList())
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.testIamPermissionsCallable().futureCall(request);
-   *   // Do something.
-   *   TestIamPermissionsResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - testIamPermissionsCallable() { - return stub.testIamPermissionsCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sends a command to the specified device. In order for a device to be able to receive commands, - * it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the - * group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will - * receive commands at the top-level topic /devices/{device-id}/commands as well as commands for - * subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific - * subfolders is not supported. If the command could not be delivered to the device, this method - * will return an error; in particular, if the device is not subscribed, this method will return - * FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at - * least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the - * device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]");
-   *   ByteString binaryData = ByteString.EMPTY;
-   *   SendCommandToDeviceResponse response =
-   *       deviceManagerClient.sendCommandToDevice(name, binaryData);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param binaryData Required. The command data to send to the device. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final SendCommandToDeviceResponse sendCommandToDevice( - DeviceName name, ByteString binaryData) { - SendCommandToDeviceRequest request = - SendCommandToDeviceRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setBinaryData(binaryData) - .build(); - return sendCommandToDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sends a command to the specified device. In order for a device to be able to receive commands, - * it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the - * group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will - * receive commands at the top-level topic /devices/{device-id}/commands as well as commands for - * subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific - * subfolders is not supported. If the command could not be delivered to the device, this method - * will return an error; in particular, if the device is not subscribed, this method will return - * FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at - * least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the - * device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   ByteString binaryData = ByteString.EMPTY;
-   *   SendCommandToDeviceResponse response =
-   *       deviceManagerClient.sendCommandToDevice(name, binaryData);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param binaryData Required. The command data to send to the device. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final SendCommandToDeviceResponse sendCommandToDevice(String name, ByteString binaryData) { - SendCommandToDeviceRequest request = - SendCommandToDeviceRequest.newBuilder().setName(name).setBinaryData(binaryData).build(); - return sendCommandToDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sends a command to the specified device. In order for a device to be able to receive commands, - * it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the - * group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will - * receive commands at the top-level topic /devices/{device-id}/commands as well as commands for - * subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific - * subfolders is not supported. If the command could not be delivered to the device, this method - * will return an error; in particular, if the device is not subscribed, this method will return - * FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at - * least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the - * device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]");
-   *   ByteString binaryData = ByteString.EMPTY;
-   *   String subfolder = "subfolder153561774";
-   *   SendCommandToDeviceResponse response =
-   *       deviceManagerClient.sendCommandToDevice(name, binaryData, subfolder);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param binaryData Required. The command data to send to the device. - * @param subfolder Optional subfolder for the command. If empty, the command will be delivered to - * the /devices/{device-id}/commands topic, otherwise it will be delivered to the - * /devices/{device-id}/commands/{subfolder} topic. Multi-level subfolders are allowed. This - * field must not have more than 256 characters, and must not contain any MQTT wildcards ("+" - * or "#") or null characters. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final SendCommandToDeviceResponse sendCommandToDevice( - DeviceName name, ByteString binaryData, String subfolder) { - SendCommandToDeviceRequest request = - SendCommandToDeviceRequest.newBuilder() - .setName(name == null ? null : name.toString()) - .setBinaryData(binaryData) - .setSubfolder(subfolder) - .build(); - return sendCommandToDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sends a command to the specified device. In order for a device to be able to receive commands, - * it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the - * group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will - * receive commands at the top-level topic /devices/{device-id}/commands as well as commands for - * subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific - * subfolders is not supported. If the command could not be delivered to the device, this method - * will return an error; in particular, if the device is not subscribed, this method will return - * FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at - * least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the - * device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString();
-   *   ByteString binaryData = ByteString.EMPTY;
-   *   String subfolder = "subfolder153561774";
-   *   SendCommandToDeviceResponse response =
-   *       deviceManagerClient.sendCommandToDevice(name, binaryData, subfolder);
-   * }
-   * }
- * - * @param name Required. The name of the device. For example, - * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - * @param binaryData Required. The command data to send to the device. - * @param subfolder Optional subfolder for the command. If empty, the command will be delivered to - * the /devices/{device-id}/commands topic, otherwise it will be delivered to the - * /devices/{device-id}/commands/{subfolder} topic. Multi-level subfolders are allowed. This - * field must not have more than 256 characters, and must not contain any MQTT wildcards ("+" - * or "#") or null characters. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final SendCommandToDeviceResponse sendCommandToDevice( - String name, ByteString binaryData, String subfolder) { - SendCommandToDeviceRequest request = - SendCommandToDeviceRequest.newBuilder() - .setName(name) - .setBinaryData(binaryData) - .setSubfolder(subfolder) - .build(); - return sendCommandToDevice(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sends a command to the specified device. In order for a device to be able to receive commands, - * it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the - * group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will - * receive commands at the top-level topic /devices/{device-id}/commands as well as commands for - * subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific - * subfolders is not supported. If the command could not be delivered to the device, this method - * will return an error; in particular, if the device is not subscribed, this method will return - * FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at - * least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the - * device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   SendCommandToDeviceRequest request =
-   *       SendCommandToDeviceRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setBinaryData(ByteString.EMPTY)
-   *           .setSubfolder("subfolder153561774")
-   *           .build();
-   *   SendCommandToDeviceResponse response = deviceManagerClient.sendCommandToDevice(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 SendCommandToDeviceResponse sendCommandToDevice(SendCommandToDeviceRequest request) { - return sendCommandToDeviceCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Sends a command to the specified device. In order for a device to be able to receive commands, - * it must: 1) be connected to Cloud IoT Core using the MQTT protocol, and 2) be subscribed to the - * group of MQTT topics specified by /devices/{device-id}/commands/#. This subscription will - * receive commands at the top-level topic /devices/{device-id}/commands as well as commands for - * subfolders, like /devices/{device-id}/commands/subfolder. Note that subscribing to specific - * subfolders is not supported. If the command could not be delivered to the device, this method - * will return an error; in particular, if the device is not subscribed, this method will return - * FAILED_PRECONDITION. Otherwise, this method will return OK. If the subscription is QoS 1, at - * least once delivery will be guaranteed; for QoS 0, no acknowledgment will be expected from the - * device. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   SendCommandToDeviceRequest request =
-   *       SendCommandToDeviceRequest.newBuilder()
-   *           .setName(
-   *               DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString())
-   *           .setBinaryData(ByteString.EMPTY)
-   *           .setSubfolder("subfolder153561774")
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.sendCommandToDeviceCallable().futureCall(request);
-   *   // Do something.
-   *   SendCommandToDeviceResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - sendCommandToDeviceCallable() { - return stub.sendCommandToDeviceCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Associates the device with the gateway. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]");
-   *   String gatewayId = "gatewayId-1354641793";
-   *   String deviceId = "deviceId1109191185";
-   *   BindDeviceToGatewayResponse response =
-   *       deviceManagerClient.bindDeviceToGateway(parent, gatewayId, deviceId);
-   * }
-   * }
- * - * @param parent Required. The name of the registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param gatewayId Required. The value of `gateway_id` can be either the device numeric ID or the - * user-defined device identifier. - * @param deviceId Required. The device to associate with the specified gateway. The value of - * `device_id` can be either the device numeric ID or the user-defined device identifier. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final BindDeviceToGatewayResponse bindDeviceToGateway( - RegistryName parent, String gatewayId, String deviceId) { - BindDeviceToGatewayRequest request = - BindDeviceToGatewayRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .setGatewayId(gatewayId) - .setDeviceId(deviceId) - .build(); - return bindDeviceToGateway(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Associates the device with the gateway. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString();
-   *   String gatewayId = "gatewayId-1354641793";
-   *   String deviceId = "deviceId1109191185";
-   *   BindDeviceToGatewayResponse response =
-   *       deviceManagerClient.bindDeviceToGateway(parent, gatewayId, deviceId);
-   * }
-   * }
- * - * @param parent Required. The name of the registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param gatewayId Required. The value of `gateway_id` can be either the device numeric ID or the - * user-defined device identifier. - * @param deviceId Required. The device to associate with the specified gateway. The value of - * `device_id` can be either the device numeric ID or the user-defined device identifier. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final BindDeviceToGatewayResponse bindDeviceToGateway( - String parent, String gatewayId, String deviceId) { - BindDeviceToGatewayRequest request = - BindDeviceToGatewayRequest.newBuilder() - .setParent(parent) - .setGatewayId(gatewayId) - .setDeviceId(deviceId) - .build(); - return bindDeviceToGateway(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Associates the device with the gateway. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   BindDeviceToGatewayRequest request =
-   *       BindDeviceToGatewayRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setGatewayId("gatewayId-1354641793")
-   *           .setDeviceId("deviceId1109191185")
-   *           .build();
-   *   BindDeviceToGatewayResponse response = deviceManagerClient.bindDeviceToGateway(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 BindDeviceToGatewayResponse bindDeviceToGateway(BindDeviceToGatewayRequest request) { - return bindDeviceToGatewayCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Associates the device with the gateway. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   BindDeviceToGatewayRequest request =
-   *       BindDeviceToGatewayRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setGatewayId("gatewayId-1354641793")
-   *           .setDeviceId("deviceId1109191185")
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.bindDeviceToGatewayCallable().futureCall(request);
-   *   // Do something.
-   *   BindDeviceToGatewayResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - bindDeviceToGatewayCallable() { - return stub.bindDeviceToGatewayCallable(); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes the association between the device and the gateway. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]");
-   *   String gatewayId = "gatewayId-1354641793";
-   *   String deviceId = "deviceId1109191185";
-   *   UnbindDeviceFromGatewayResponse response =
-   *       deviceManagerClient.unbindDeviceFromGateway(parent, gatewayId, deviceId);
-   * }
-   * }
- * - * @param parent Required. The name of the registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param gatewayId Required. The value of `gateway_id` can be either the device numeric ID or the - * user-defined device identifier. - * @param deviceId Required. The device to disassociate from the specified gateway. The value of - * `device_id` can be either the device numeric ID or the user-defined device identifier. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final UnbindDeviceFromGatewayResponse unbindDeviceFromGateway( - RegistryName parent, String gatewayId, String deviceId) { - UnbindDeviceFromGatewayRequest request = - UnbindDeviceFromGatewayRequest.newBuilder() - .setParent(parent == null ? null : parent.toString()) - .setGatewayId(gatewayId) - .setDeviceId(deviceId) - .build(); - return unbindDeviceFromGateway(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes the association between the device and the gateway. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   String parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString();
-   *   String gatewayId = "gatewayId-1354641793";
-   *   String deviceId = "deviceId1109191185";
-   *   UnbindDeviceFromGatewayResponse response =
-   *       deviceManagerClient.unbindDeviceFromGateway(parent, gatewayId, deviceId);
-   * }
-   * }
- * - * @param parent Required. The name of the registry. For example, - * `projects/example-project/locations/us-central1/registries/my-registry`. - * @param gatewayId Required. The value of `gateway_id` can be either the device numeric ID or the - * user-defined device identifier. - * @param deviceId Required. The device to disassociate from the specified gateway. The value of - * `device_id` can be either the device numeric ID or the user-defined device identifier. - * @throws com.google.api.gax.rpc.ApiException if the remote call fails - */ - public final UnbindDeviceFromGatewayResponse unbindDeviceFromGateway( - String parent, String gatewayId, String deviceId) { - UnbindDeviceFromGatewayRequest request = - UnbindDeviceFromGatewayRequest.newBuilder() - .setParent(parent) - .setGatewayId(gatewayId) - .setDeviceId(deviceId) - .build(); - return unbindDeviceFromGateway(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes the association between the device and the gateway. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   UnbindDeviceFromGatewayRequest request =
-   *       UnbindDeviceFromGatewayRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setGatewayId("gatewayId-1354641793")
-   *           .setDeviceId("deviceId1109191185")
-   *           .build();
-   *   UnbindDeviceFromGatewayResponse response =
-   *       deviceManagerClient.unbindDeviceFromGateway(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 UnbindDeviceFromGatewayResponse unbindDeviceFromGateway( - UnbindDeviceFromGatewayRequest request) { - return unbindDeviceFromGatewayCallable().call(request); - } - - // AUTO-GENERATED DOCUMENTATION AND METHOD. - /** - * Deletes the association between the device and the gateway. - * - *

Sample code: - * - *

{@code
-   * // This snippet has been automatically generated and should be regarded as a code template only.
-   * // It will require modifications to work:
-   * // - It may require correct/in-range values for request initialization.
-   * // - It may require specifying regional endpoints when creating the service client as shown in
-   * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
-   * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
-   *   UnbindDeviceFromGatewayRequest request =
-   *       UnbindDeviceFromGatewayRequest.newBuilder()
-   *           .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString())
-   *           .setGatewayId("gatewayId-1354641793")
-   *           .setDeviceId("deviceId1109191185")
-   *           .build();
-   *   ApiFuture future =
-   *       deviceManagerClient.unbindDeviceFromGatewayCallable().futureCall(request);
-   *   // Do something.
-   *   UnbindDeviceFromGatewayResponse response = future.get();
-   * }
-   * }
- */ - public final UnaryCallable - unbindDeviceFromGatewayCallable() { - return stub.unbindDeviceFromGatewayCallable(); - } - - @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 ListDeviceRegistriesPagedResponse - extends AbstractPagedListResponse< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - DeviceRegistry, - ListDeviceRegistriesPage, - ListDeviceRegistriesFixedSizeCollection> { - - public static ApiFuture createAsync( - PageContext - context, - ApiFuture futureResponse) { - ApiFuture futurePage = - ListDeviceRegistriesPage.createEmptyPage().createPageAsync(context, futureResponse); - return ApiFutures.transform( - futurePage, - input -> new ListDeviceRegistriesPagedResponse(input), - MoreExecutors.directExecutor()); - } - - private ListDeviceRegistriesPagedResponse(ListDeviceRegistriesPage page) { - super(page, ListDeviceRegistriesFixedSizeCollection.createEmptyCollection()); - } - } - - public static class ListDeviceRegistriesPage - extends AbstractPage< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - DeviceRegistry, - ListDeviceRegistriesPage> { - - private ListDeviceRegistriesPage( - PageContext - context, - ListDeviceRegistriesResponse response) { - super(context, response); - } - - private static ListDeviceRegistriesPage createEmptyPage() { - return new ListDeviceRegistriesPage(null, null); - } - - @Override - protected ListDeviceRegistriesPage createPage( - PageContext - context, - ListDeviceRegistriesResponse response) { - return new ListDeviceRegistriesPage(context, response); - } - - @Override - public ApiFuture createPageAsync( - PageContext - context, - ApiFuture futureResponse) { - return super.createPageAsync(context, futureResponse); - } - } - - public static class ListDeviceRegistriesFixedSizeCollection - extends AbstractFixedSizeCollection< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - DeviceRegistry, - ListDeviceRegistriesPage, - ListDeviceRegistriesFixedSizeCollection> { - - private ListDeviceRegistriesFixedSizeCollection( - List pages, int collectionSize) { - super(pages, collectionSize); - } - - private static ListDeviceRegistriesFixedSizeCollection createEmptyCollection() { - return new ListDeviceRegistriesFixedSizeCollection(null, 0); - } - - @Override - protected ListDeviceRegistriesFixedSizeCollection createCollection( - List pages, int collectionSize) { - return new ListDeviceRegistriesFixedSizeCollection(pages, collectionSize); - } - } - - public static class ListDevicesPagedResponse - extends AbstractPagedListResponse< - ListDevicesRequest, - ListDevicesResponse, - Device, - ListDevicesPage, - ListDevicesFixedSizeCollection> { - - public static ApiFuture createAsync( - PageContext context, - ApiFuture futureResponse) { - ApiFuture futurePage = - ListDevicesPage.createEmptyPage().createPageAsync(context, futureResponse); - return ApiFutures.transform( - futurePage, input -> new ListDevicesPagedResponse(input), MoreExecutors.directExecutor()); - } - - private ListDevicesPagedResponse(ListDevicesPage page) { - super(page, ListDevicesFixedSizeCollection.createEmptyCollection()); - } - } - - public static class ListDevicesPage - extends AbstractPage { - - private ListDevicesPage( - PageContext context, - ListDevicesResponse response) { - super(context, response); - } - - private static ListDevicesPage createEmptyPage() { - return new ListDevicesPage(null, null); - } - - @Override - protected ListDevicesPage createPage( - PageContext context, - ListDevicesResponse response) { - return new ListDevicesPage(context, response); - } - - @Override - public ApiFuture createPageAsync( - PageContext context, - ApiFuture futureResponse) { - return super.createPageAsync(context, futureResponse); - } - } - - public static class ListDevicesFixedSizeCollection - extends AbstractFixedSizeCollection< - ListDevicesRequest, - ListDevicesResponse, - Device, - ListDevicesPage, - ListDevicesFixedSizeCollection> { - - private ListDevicesFixedSizeCollection(List pages, int collectionSize) { - super(pages, collectionSize); - } - - private static ListDevicesFixedSizeCollection createEmptyCollection() { - return new ListDevicesFixedSizeCollection(null, 0); - } - - @Override - protected ListDevicesFixedSizeCollection createCollection( - List pages, int collectionSize) { - return new ListDevicesFixedSizeCollection(pages, collectionSize); - } - } -} diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerSettings.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerSettings.java deleted file mode 100644 index 3c64e9cd..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerSettings.java +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1; - -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse; -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse; - -import com.google.api.core.ApiFunction; -import com.google.api.core.BetaApi; -import com.google.api.gax.core.GoogleCredentialsProvider; -import com.google.api.gax.core.InstantiatingExecutorProvider; -import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; -import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.ClientSettings; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.cloud.iot.v1.stub.DeviceManagerStubSettings; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.Empty; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link DeviceManagerClient}. - * - *

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

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

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * DeviceManagerSettings.Builder deviceManagerSettingsBuilder = DeviceManagerSettings.newBuilder();
- * deviceManagerSettingsBuilder
- *     .createDeviceRegistrySettings()
- *     .setRetrySettings(
- *         deviceManagerSettingsBuilder
- *             .createDeviceRegistrySettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * DeviceManagerSettings deviceManagerSettings = deviceManagerSettingsBuilder.build();
- * }
- */ -@Generated("by gapic-generator-java") -public class DeviceManagerSettings extends ClientSettings { - - /** Returns the object with the settings used for calls to createDeviceRegistry. */ - public UnaryCallSettings - createDeviceRegistrySettings() { - return ((DeviceManagerStubSettings) getStubSettings()).createDeviceRegistrySettings(); - } - - /** Returns the object with the settings used for calls to getDeviceRegistry. */ - public UnaryCallSettings getDeviceRegistrySettings() { - return ((DeviceManagerStubSettings) getStubSettings()).getDeviceRegistrySettings(); - } - - /** Returns the object with the settings used for calls to updateDeviceRegistry. */ - public UnaryCallSettings - updateDeviceRegistrySettings() { - return ((DeviceManagerStubSettings) getStubSettings()).updateDeviceRegistrySettings(); - } - - /** Returns the object with the settings used for calls to deleteDeviceRegistry. */ - public UnaryCallSettings deleteDeviceRegistrySettings() { - return ((DeviceManagerStubSettings) getStubSettings()).deleteDeviceRegistrySettings(); - } - - /** Returns the object with the settings used for calls to listDeviceRegistries. */ - public PagedCallSettings< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - ListDeviceRegistriesPagedResponse> - listDeviceRegistriesSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).listDeviceRegistriesSettings(); - } - - /** Returns the object with the settings used for calls to createDevice. */ - public UnaryCallSettings createDeviceSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).createDeviceSettings(); - } - - /** Returns the object with the settings used for calls to getDevice. */ - public UnaryCallSettings getDeviceSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).getDeviceSettings(); - } - - /** Returns the object with the settings used for calls to updateDevice. */ - public UnaryCallSettings updateDeviceSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).updateDeviceSettings(); - } - - /** Returns the object with the settings used for calls to deleteDevice. */ - public UnaryCallSettings deleteDeviceSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).deleteDeviceSettings(); - } - - /** Returns the object with the settings used for calls to listDevices. */ - public PagedCallSettings - listDevicesSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).listDevicesSettings(); - } - - /** Returns the object with the settings used for calls to modifyCloudToDeviceConfig. */ - public UnaryCallSettings - modifyCloudToDeviceConfigSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).modifyCloudToDeviceConfigSettings(); - } - - /** Returns the object with the settings used for calls to listDeviceConfigVersions. */ - public UnaryCallSettings - listDeviceConfigVersionsSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).listDeviceConfigVersionsSettings(); - } - - /** Returns the object with the settings used for calls to listDeviceStates. */ - public UnaryCallSettings - listDeviceStatesSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).listDeviceStatesSettings(); - } - - /** Returns the object with the settings used for calls to setIamPolicy. */ - public UnaryCallSettings setIamPolicySettings() { - return ((DeviceManagerStubSettings) getStubSettings()).setIamPolicySettings(); - } - - /** Returns the object with the settings used for calls to getIamPolicy. */ - public UnaryCallSettings getIamPolicySettings() { - return ((DeviceManagerStubSettings) getStubSettings()).getIamPolicySettings(); - } - - /** Returns the object with the settings used for calls to testIamPermissions. */ - public UnaryCallSettings - testIamPermissionsSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).testIamPermissionsSettings(); - } - - /** Returns the object with the settings used for calls to sendCommandToDevice. */ - public UnaryCallSettings - sendCommandToDeviceSettings() { - return ((DeviceManagerStubSettings) getStubSettings()).sendCommandToDeviceSettings(); - } - - /** Returns the object with the settings used for calls to bindDeviceToGateway. */ - public UnaryCallSettings - bindDeviceToGatewaySettings() { - return ((DeviceManagerStubSettings) getStubSettings()).bindDeviceToGatewaySettings(); - } - - /** Returns the object with the settings used for calls to unbindDeviceFromGateway. */ - public UnaryCallSettings - unbindDeviceFromGatewaySettings() { - return ((DeviceManagerStubSettings) getStubSettings()).unbindDeviceFromGatewaySettings(); - } - - public static final DeviceManagerSettings create(DeviceManagerStubSettings stub) - throws IOException { - return new DeviceManagerSettings.Builder(stub.toBuilder()).build(); - } - - /** Returns a builder for the default ExecutorProvider for this service. */ - public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { - return DeviceManagerStubSettings.defaultExecutorProviderBuilder(); - } - - /** Returns the default service endpoint. */ - public static String getDefaultEndpoint() { - return DeviceManagerStubSettings.getDefaultEndpoint(); - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DeviceManagerStubSettings.getDefaultServiceScopes(); - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return DeviceManagerStubSettings.defaultCredentialsProviderBuilder(); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return DeviceManagerStubSettings.defaultGrpcTransportProviderBuilder(); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return DeviceManagerStubSettings.defaultHttpJsonTransportProviderBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return DeviceManagerStubSettings.defaultTransportChannelProvider(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return DeviceManagerStubSettings.defaultApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - @BetaApi - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected DeviceManagerSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - } - - /** Builder for DeviceManagerSettings. */ - public static class Builder extends ClientSettings.Builder { - - protected Builder() throws IOException { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(DeviceManagerStubSettings.newBuilder(clientContext)); - } - - protected Builder(DeviceManagerSettings settings) { - super(settings.getStubSettings().toBuilder()); - } - - protected Builder(DeviceManagerStubSettings.Builder stubSettings) { - super(stubSettings); - } - - private static Builder createDefault() { - return new Builder(DeviceManagerStubSettings.newBuilder()); - } - - @BetaApi - private static Builder createHttpJsonDefault() { - return new Builder(DeviceManagerStubSettings.newHttpJsonBuilder()); - } - - public DeviceManagerStubSettings.Builder getStubSettingsBuilder() { - return ((DeviceManagerStubSettings.Builder) getStubSettings()); - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods( - getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); - return this; - } - - /** Returns the builder for the settings used for calls to createDeviceRegistry. */ - public UnaryCallSettings.Builder - createDeviceRegistrySettings() { - return getStubSettingsBuilder().createDeviceRegistrySettings(); - } - - /** Returns the builder for the settings used for calls to getDeviceRegistry. */ - public UnaryCallSettings.Builder - getDeviceRegistrySettings() { - return getStubSettingsBuilder().getDeviceRegistrySettings(); - } - - /** Returns the builder for the settings used for calls to updateDeviceRegistry. */ - public UnaryCallSettings.Builder - updateDeviceRegistrySettings() { - return getStubSettingsBuilder().updateDeviceRegistrySettings(); - } - - /** Returns the builder for the settings used for calls to deleteDeviceRegistry. */ - public UnaryCallSettings.Builder - deleteDeviceRegistrySettings() { - return getStubSettingsBuilder().deleteDeviceRegistrySettings(); - } - - /** Returns the builder for the settings used for calls to listDeviceRegistries. */ - public PagedCallSettings.Builder< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - ListDeviceRegistriesPagedResponse> - listDeviceRegistriesSettings() { - return getStubSettingsBuilder().listDeviceRegistriesSettings(); - } - - /** Returns the builder for the settings used for calls to createDevice. */ - public UnaryCallSettings.Builder createDeviceSettings() { - return getStubSettingsBuilder().createDeviceSettings(); - } - - /** Returns the builder for the settings used for calls to getDevice. */ - public UnaryCallSettings.Builder getDeviceSettings() { - return getStubSettingsBuilder().getDeviceSettings(); - } - - /** Returns the builder for the settings used for calls to updateDevice. */ - public UnaryCallSettings.Builder updateDeviceSettings() { - return getStubSettingsBuilder().updateDeviceSettings(); - } - - /** Returns the builder for the settings used for calls to deleteDevice. */ - public UnaryCallSettings.Builder deleteDeviceSettings() { - return getStubSettingsBuilder().deleteDeviceSettings(); - } - - /** Returns the builder for the settings used for calls to listDevices. */ - public PagedCallSettings.Builder< - ListDevicesRequest, ListDevicesResponse, ListDevicesPagedResponse> - listDevicesSettings() { - return getStubSettingsBuilder().listDevicesSettings(); - } - - /** Returns the builder for the settings used for calls to modifyCloudToDeviceConfig. */ - public UnaryCallSettings.Builder - modifyCloudToDeviceConfigSettings() { - return getStubSettingsBuilder().modifyCloudToDeviceConfigSettings(); - } - - /** Returns the builder for the settings used for calls to listDeviceConfigVersions. */ - public UnaryCallSettings.Builder< - ListDeviceConfigVersionsRequest, ListDeviceConfigVersionsResponse> - listDeviceConfigVersionsSettings() { - return getStubSettingsBuilder().listDeviceConfigVersionsSettings(); - } - - /** Returns the builder for the settings used for calls to listDeviceStates. */ - public UnaryCallSettings.Builder - listDeviceStatesSettings() { - return getStubSettingsBuilder().listDeviceStatesSettings(); - } - - /** Returns the builder for the settings used for calls to setIamPolicy. */ - public UnaryCallSettings.Builder setIamPolicySettings() { - return getStubSettingsBuilder().setIamPolicySettings(); - } - - /** Returns the builder for the settings used for calls to getIamPolicy. */ - public UnaryCallSettings.Builder getIamPolicySettings() { - return getStubSettingsBuilder().getIamPolicySettings(); - } - - /** Returns the builder for the settings used for calls to testIamPermissions. */ - public UnaryCallSettings.Builder - testIamPermissionsSettings() { - return getStubSettingsBuilder().testIamPermissionsSettings(); - } - - /** Returns the builder for the settings used for calls to sendCommandToDevice. */ - public UnaryCallSettings.Builder - sendCommandToDeviceSettings() { - return getStubSettingsBuilder().sendCommandToDeviceSettings(); - } - - /** Returns the builder for the settings used for calls to bindDeviceToGateway. */ - public UnaryCallSettings.Builder - bindDeviceToGatewaySettings() { - return getStubSettingsBuilder().bindDeviceToGatewaySettings(); - } - - /** Returns the builder for the settings used for calls to unbindDeviceFromGateway. */ - public UnaryCallSettings.Builder< - UnbindDeviceFromGatewayRequest, UnbindDeviceFromGatewayResponse> - unbindDeviceFromGatewaySettings() { - return getStubSettingsBuilder().unbindDeviceFromGatewaySettings(); - } - - @Override - public DeviceManagerSettings build() throws IOException { - return new DeviceManagerSettings(this); - } - } -} diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/gapic_metadata.json b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/gapic_metadata.json deleted file mode 100644 index 6b042a32..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/gapic_metadata.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "java", - "protoPackage": "google.cloud.iot.v1", - "libraryPackage": "com.google.cloud.iot.v1", - "services": { - "DeviceManager": { - "clients": { - "grpc": { - "libraryClient": "DeviceManagerClient", - "rpcs": { - "BindDeviceToGateway": { - "methods": ["bindDeviceToGateway", "bindDeviceToGateway", "bindDeviceToGateway", "bindDeviceToGatewayCallable"] - }, - "CreateDevice": { - "methods": ["createDevice", "createDevice", "createDevice", "createDeviceCallable"] - }, - "CreateDeviceRegistry": { - "methods": ["createDeviceRegistry", "createDeviceRegistry", "createDeviceRegistry", "createDeviceRegistryCallable"] - }, - "DeleteDevice": { - "methods": ["deleteDevice", "deleteDevice", "deleteDevice", "deleteDeviceCallable"] - }, - "DeleteDeviceRegistry": { - "methods": ["deleteDeviceRegistry", "deleteDeviceRegistry", "deleteDeviceRegistry", "deleteDeviceRegistryCallable"] - }, - "GetDevice": { - "methods": ["getDevice", "getDevice", "getDevice", "getDeviceCallable"] - }, - "GetDeviceRegistry": { - "methods": ["getDeviceRegistry", "getDeviceRegistry", "getDeviceRegistry", "getDeviceRegistryCallable"] - }, - "GetIamPolicy": { - "methods": ["getIamPolicy", "getIamPolicy", "getIamPolicy", "getIamPolicyCallable"] - }, - "ListDeviceConfigVersions": { - "methods": ["listDeviceConfigVersions", "listDeviceConfigVersions", "listDeviceConfigVersions", "listDeviceConfigVersionsCallable"] - }, - "ListDeviceRegistries": { - "methods": ["listDeviceRegistries", "listDeviceRegistries", "listDeviceRegistries", "listDeviceRegistriesPagedCallable", "listDeviceRegistriesCallable"] - }, - "ListDeviceStates": { - "methods": ["listDeviceStates", "listDeviceStates", "listDeviceStates", "listDeviceStatesCallable"] - }, - "ListDevices": { - "methods": ["listDevices", "listDevices", "listDevices", "listDevicesPagedCallable", "listDevicesCallable"] - }, - "ModifyCloudToDeviceConfig": { - "methods": ["modifyCloudToDeviceConfig", "modifyCloudToDeviceConfig", "modifyCloudToDeviceConfig", "modifyCloudToDeviceConfigCallable"] - }, - "SendCommandToDevice": { - "methods": ["sendCommandToDevice", "sendCommandToDevice", "sendCommandToDevice", "sendCommandToDevice", "sendCommandToDevice", "sendCommandToDeviceCallable"] - }, - "SetIamPolicy": { - "methods": ["setIamPolicy", "setIamPolicy", "setIamPolicy", "setIamPolicyCallable"] - }, - "TestIamPermissions": { - "methods": ["testIamPermissions", "testIamPermissions", "testIamPermissions", "testIamPermissionsCallable"] - }, - "UnbindDeviceFromGateway": { - "methods": ["unbindDeviceFromGateway", "unbindDeviceFromGateway", "unbindDeviceFromGateway", "unbindDeviceFromGatewayCallable"] - }, - "UpdateDevice": { - "methods": ["updateDevice", "updateDevice", "updateDeviceCallable"] - }, - "UpdateDeviceRegistry": { - "methods": ["updateDeviceRegistry", "updateDeviceRegistry", "updateDeviceRegistryCallable"] - } - } - } - } - } - } -} \ No newline at end of file diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/package-info.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/package-info.java deleted file mode 100644 index 0e447431..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/package-info.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * The interfaces provided are listed below, along with usage samples. - * - *

======================= DeviceManagerClient ======================= - * - *

Service Description: Internet of Things (IoT) service. Securely connect and manage IoT - * devices. - * - *

Sample for DeviceManagerClient: - * - *

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) {
- *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
- *   DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build();
- *   DeviceRegistry response = deviceManagerClient.createDeviceRegistry(parent, deviceRegistry);
- * }
- * }
- */ -@Generated("by gapic-generator-java") -package com.google.cloud.iot.v1; - -import javax.annotation.Generated; diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStub.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStub.java deleted file mode 100644 index 3417a46d..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStub.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.stub; - -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse; -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse; - -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.iot.v1.BindDeviceToGatewayRequest; -import com.google.cloud.iot.v1.BindDeviceToGatewayResponse; -import com.google.cloud.iot.v1.CreateDeviceRegistryRequest; -import com.google.cloud.iot.v1.CreateDeviceRequest; -import com.google.cloud.iot.v1.DeleteDeviceRegistryRequest; -import com.google.cloud.iot.v1.DeleteDeviceRequest; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.GetDeviceRegistryRequest; -import com.google.cloud.iot.v1.GetDeviceRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; -import com.google.cloud.iot.v1.ListDeviceRegistriesRequest; -import com.google.cloud.iot.v1.ListDeviceRegistriesResponse; -import com.google.cloud.iot.v1.ListDeviceStatesRequest; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; -import com.google.cloud.iot.v1.ListDevicesRequest; -import com.google.cloud.iot.v1.ListDevicesResponse; -import com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse; -import com.google.cloud.iot.v1.UpdateDeviceRegistryRequest; -import com.google.cloud.iot.v1.UpdateDeviceRequest; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.Empty; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Base stub class for the DeviceManager service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator-java") -public abstract class DeviceManagerStub implements BackgroundResource { - - public UnaryCallable createDeviceRegistryCallable() { - throw new UnsupportedOperationException("Not implemented: createDeviceRegistryCallable()"); - } - - public UnaryCallable getDeviceRegistryCallable() { - throw new UnsupportedOperationException("Not implemented: getDeviceRegistryCallable()"); - } - - public UnaryCallable updateDeviceRegistryCallable() { - throw new UnsupportedOperationException("Not implemented: updateDeviceRegistryCallable()"); - } - - public UnaryCallable deleteDeviceRegistryCallable() { - throw new UnsupportedOperationException("Not implemented: deleteDeviceRegistryCallable()"); - } - - public UnaryCallable - listDeviceRegistriesPagedCallable() { - throw new UnsupportedOperationException("Not implemented: listDeviceRegistriesPagedCallable()"); - } - - public UnaryCallable - listDeviceRegistriesCallable() { - throw new UnsupportedOperationException("Not implemented: listDeviceRegistriesCallable()"); - } - - public UnaryCallable createDeviceCallable() { - throw new UnsupportedOperationException("Not implemented: createDeviceCallable()"); - } - - public UnaryCallable getDeviceCallable() { - throw new UnsupportedOperationException("Not implemented: getDeviceCallable()"); - } - - public UnaryCallable updateDeviceCallable() { - throw new UnsupportedOperationException("Not implemented: updateDeviceCallable()"); - } - - public UnaryCallable deleteDeviceCallable() { - throw new UnsupportedOperationException("Not implemented: deleteDeviceCallable()"); - } - - public UnaryCallable listDevicesPagedCallable() { - throw new UnsupportedOperationException("Not implemented: listDevicesPagedCallable()"); - } - - public UnaryCallable listDevicesCallable() { - throw new UnsupportedOperationException("Not implemented: listDevicesCallable()"); - } - - public UnaryCallable - modifyCloudToDeviceConfigCallable() { - throw new UnsupportedOperationException("Not implemented: modifyCloudToDeviceConfigCallable()"); - } - - public UnaryCallable - listDeviceConfigVersionsCallable() { - throw new UnsupportedOperationException("Not implemented: listDeviceConfigVersionsCallable()"); - } - - public UnaryCallable - listDeviceStatesCallable() { - throw new UnsupportedOperationException("Not implemented: listDeviceStatesCallable()"); - } - - public UnaryCallable setIamPolicyCallable() { - throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); - } - - public UnaryCallable getIamPolicyCallable() { - throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); - } - - public UnaryCallable - testIamPermissionsCallable() { - throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); - } - - public UnaryCallable - sendCommandToDeviceCallable() { - throw new UnsupportedOperationException("Not implemented: sendCommandToDeviceCallable()"); - } - - public UnaryCallable - bindDeviceToGatewayCallable() { - throw new UnsupportedOperationException("Not implemented: bindDeviceToGatewayCallable()"); - } - - public UnaryCallable - unbindDeviceFromGatewayCallable() { - throw new UnsupportedOperationException("Not implemented: unbindDeviceFromGatewayCallable()"); - } - - @Override - public abstract void close(); -} diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStubSettings.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStubSettings.java deleted file mode 100644 index 2eb0c0b5..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStubSettings.java +++ /dev/null @@ -1,980 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.stub; - -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse; -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse; - -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.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.HttpJsonTransportChannel; -import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; -import com.google.api.gax.retrying.RetrySettings; -import com.google.api.gax.rpc.ApiCallContext; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.PageContext; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.PagedListDescriptor; -import com.google.api.gax.rpc.PagedListResponseFactory; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.StubSettings; -import com.google.api.gax.rpc.TransportChannelProvider; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.iot.v1.BindDeviceToGatewayRequest; -import com.google.cloud.iot.v1.BindDeviceToGatewayResponse; -import com.google.cloud.iot.v1.CreateDeviceRegistryRequest; -import com.google.cloud.iot.v1.CreateDeviceRequest; -import com.google.cloud.iot.v1.DeleteDeviceRegistryRequest; -import com.google.cloud.iot.v1.DeleteDeviceRequest; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.GetDeviceRegistryRequest; -import com.google.cloud.iot.v1.GetDeviceRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; -import com.google.cloud.iot.v1.ListDeviceRegistriesRequest; -import com.google.cloud.iot.v1.ListDeviceRegistriesResponse; -import com.google.cloud.iot.v1.ListDeviceStatesRequest; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; -import com.google.cloud.iot.v1.ListDevicesRequest; -import com.google.cloud.iot.v1.ListDevicesResponse; -import com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse; -import com.google.cloud.iot.v1.UpdateDeviceRegistryRequest; -import com.google.cloud.iot.v1.UpdateDeviceRequest; -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.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.Empty; -import java.io.IOException; -import java.util.List; -import javax.annotation.Generated; -import org.threeten.bp.Duration; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * Settings class to configure an instance of {@link DeviceManagerStub}. - * - *

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

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

{@code
- * // This snippet has been automatically generated and should be regarded as a code template only.
- * // It will require modifications to work:
- * // - It may require correct/in-range values for request initialization.
- * // - It may require specifying regional endpoints when creating the service client as shown in
- * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
- * DeviceManagerStubSettings.Builder deviceManagerSettingsBuilder =
- *     DeviceManagerStubSettings.newBuilder();
- * deviceManagerSettingsBuilder
- *     .createDeviceRegistrySettings()
- *     .setRetrySettings(
- *         deviceManagerSettingsBuilder
- *             .createDeviceRegistrySettings()
- *             .getRetrySettings()
- *             .toBuilder()
- *             .setTotalTimeout(Duration.ofSeconds(30))
- *             .build());
- * DeviceManagerStubSettings deviceManagerSettings = deviceManagerSettingsBuilder.build();
- * }
- */ -@Generated("by gapic-generator-java") -public class DeviceManagerStubSettings extends StubSettings { - /** The default scopes of the service. */ - private static final ImmutableList DEFAULT_SERVICE_SCOPES = - ImmutableList.builder() - .add("https://www.googleapis.com/auth/cloud-platform") - .add("https://www.googleapis.com/auth/cloudiot") - .build(); - - private final UnaryCallSettings - createDeviceRegistrySettings; - private final UnaryCallSettings - getDeviceRegistrySettings; - private final UnaryCallSettings - updateDeviceRegistrySettings; - private final UnaryCallSettings deleteDeviceRegistrySettings; - private final PagedCallSettings< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - ListDeviceRegistriesPagedResponse> - listDeviceRegistriesSettings; - private final UnaryCallSettings createDeviceSettings; - private final UnaryCallSettings getDeviceSettings; - private final UnaryCallSettings updateDeviceSettings; - private final UnaryCallSettings deleteDeviceSettings; - private final PagedCallSettings - listDevicesSettings; - private final UnaryCallSettings - modifyCloudToDeviceConfigSettings; - private final UnaryCallSettings - listDeviceConfigVersionsSettings; - private final UnaryCallSettings - listDeviceStatesSettings; - private final UnaryCallSettings setIamPolicySettings; - private final UnaryCallSettings getIamPolicySettings; - private final UnaryCallSettings - testIamPermissionsSettings; - private final UnaryCallSettings - sendCommandToDeviceSettings; - private final UnaryCallSettings - bindDeviceToGatewaySettings; - private final UnaryCallSettings - unbindDeviceFromGatewaySettings; - - private static final PagedListDescriptor< - ListDeviceRegistriesRequest, ListDeviceRegistriesResponse, DeviceRegistry> - LIST_DEVICE_REGISTRIES_PAGE_STR_DESC = - new PagedListDescriptor< - ListDeviceRegistriesRequest, ListDeviceRegistriesResponse, DeviceRegistry>() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListDeviceRegistriesRequest injectToken( - ListDeviceRegistriesRequest payload, String token) { - return ListDeviceRegistriesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListDeviceRegistriesRequest injectPageSize( - ListDeviceRegistriesRequest payload, int pageSize) { - return ListDeviceRegistriesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListDeviceRegistriesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListDeviceRegistriesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListDeviceRegistriesResponse payload) { - return payload.getDeviceRegistriesList() == null - ? ImmutableList.of() - : payload.getDeviceRegistriesList(); - } - }; - - private static final PagedListDescriptor - LIST_DEVICES_PAGE_STR_DESC = - new PagedListDescriptor() { - @Override - public String emptyToken() { - return ""; - } - - @Override - public ListDevicesRequest injectToken(ListDevicesRequest payload, String token) { - return ListDevicesRequest.newBuilder(payload).setPageToken(token).build(); - } - - @Override - public ListDevicesRequest injectPageSize(ListDevicesRequest payload, int pageSize) { - return ListDevicesRequest.newBuilder(payload).setPageSize(pageSize).build(); - } - - @Override - public Integer extractPageSize(ListDevicesRequest payload) { - return payload.getPageSize(); - } - - @Override - public String extractNextToken(ListDevicesResponse payload) { - return payload.getNextPageToken(); - } - - @Override - public Iterable extractResources(ListDevicesResponse payload) { - return payload.getDevicesList() == null - ? ImmutableList.of() - : payload.getDevicesList(); - } - }; - - private static final PagedListResponseFactory< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - ListDeviceRegistriesPagedResponse> - LIST_DEVICE_REGISTRIES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - ListDeviceRegistriesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListDeviceRegistriesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext - pageContext = - PageContext.create( - callable, LIST_DEVICE_REGISTRIES_PAGE_STR_DESC, request, context); - return ListDeviceRegistriesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - private static final PagedListResponseFactory< - ListDevicesRequest, ListDevicesResponse, ListDevicesPagedResponse> - LIST_DEVICES_PAGE_STR_FACT = - new PagedListResponseFactory< - ListDevicesRequest, ListDevicesResponse, ListDevicesPagedResponse>() { - @Override - public ApiFuture getFuturePagedResponse( - UnaryCallable callable, - ListDevicesRequest request, - ApiCallContext context, - ApiFuture futureResponse) { - PageContext pageContext = - PageContext.create(callable, LIST_DEVICES_PAGE_STR_DESC, request, context); - return ListDevicesPagedResponse.createAsync(pageContext, futureResponse); - } - }; - - /** Returns the object with the settings used for calls to createDeviceRegistry. */ - public UnaryCallSettings - createDeviceRegistrySettings() { - return createDeviceRegistrySettings; - } - - /** Returns the object with the settings used for calls to getDeviceRegistry. */ - public UnaryCallSettings getDeviceRegistrySettings() { - return getDeviceRegistrySettings; - } - - /** Returns the object with the settings used for calls to updateDeviceRegistry. */ - public UnaryCallSettings - updateDeviceRegistrySettings() { - return updateDeviceRegistrySettings; - } - - /** Returns the object with the settings used for calls to deleteDeviceRegistry. */ - public UnaryCallSettings deleteDeviceRegistrySettings() { - return deleteDeviceRegistrySettings; - } - - /** Returns the object with the settings used for calls to listDeviceRegistries. */ - public PagedCallSettings< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - ListDeviceRegistriesPagedResponse> - listDeviceRegistriesSettings() { - return listDeviceRegistriesSettings; - } - - /** Returns the object with the settings used for calls to createDevice. */ - public UnaryCallSettings createDeviceSettings() { - return createDeviceSettings; - } - - /** Returns the object with the settings used for calls to getDevice. */ - public UnaryCallSettings getDeviceSettings() { - return getDeviceSettings; - } - - /** Returns the object with the settings used for calls to updateDevice. */ - public UnaryCallSettings updateDeviceSettings() { - return updateDeviceSettings; - } - - /** Returns the object with the settings used for calls to deleteDevice. */ - public UnaryCallSettings deleteDeviceSettings() { - return deleteDeviceSettings; - } - - /** Returns the object with the settings used for calls to listDevices. */ - public PagedCallSettings - listDevicesSettings() { - return listDevicesSettings; - } - - /** Returns the object with the settings used for calls to modifyCloudToDeviceConfig. */ - public UnaryCallSettings - modifyCloudToDeviceConfigSettings() { - return modifyCloudToDeviceConfigSettings; - } - - /** Returns the object with the settings used for calls to listDeviceConfigVersions. */ - public UnaryCallSettings - listDeviceConfigVersionsSettings() { - return listDeviceConfigVersionsSettings; - } - - /** Returns the object with the settings used for calls to listDeviceStates. */ - public UnaryCallSettings - listDeviceStatesSettings() { - return listDeviceStatesSettings; - } - - /** Returns the object with the settings used for calls to setIamPolicy. */ - public UnaryCallSettings setIamPolicySettings() { - return setIamPolicySettings; - } - - /** Returns the object with the settings used for calls to getIamPolicy. */ - public UnaryCallSettings getIamPolicySettings() { - return getIamPolicySettings; - } - - /** Returns the object with the settings used for calls to testIamPermissions. */ - public UnaryCallSettings - testIamPermissionsSettings() { - return testIamPermissionsSettings; - } - - /** Returns the object with the settings used for calls to sendCommandToDevice. */ - public UnaryCallSettings - sendCommandToDeviceSettings() { - return sendCommandToDeviceSettings; - } - - /** Returns the object with the settings used for calls to bindDeviceToGateway. */ - public UnaryCallSettings - bindDeviceToGatewaySettings() { - return bindDeviceToGatewaySettings; - } - - /** Returns the object with the settings used for calls to unbindDeviceFromGateway. */ - public UnaryCallSettings - unbindDeviceFromGatewaySettings() { - return unbindDeviceFromGatewaySettings; - } - - public DeviceManagerStub createStub() throws IOException { - if (getTransportChannelProvider() - .getTransportName() - .equals(GrpcTransportChannel.getGrpcTransportName())) { - return GrpcDeviceManagerStub.create(this); - } - if (getTransportChannelProvider() - .getTransportName() - .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { - return HttpJsonDeviceManagerStub.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 "cloudiot.googleapis.com:443"; - } - - /** Returns the default mTLS service endpoint. */ - public static String getDefaultMtlsEndpoint() { - return "cloudiot.mtls.googleapis.com:443"; - } - - /** Returns the default service scopes. */ - public static List getDefaultServiceScopes() { - return DEFAULT_SERVICE_SCOPES; - } - - /** Returns a builder for the default credentials for this service. */ - public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { - return GoogleCredentialsProvider.newBuilder() - .setScopesToApply(DEFAULT_SERVICE_SCOPES) - .setUseJwtAccessWithScope(true); - } - - /** Returns a builder for the default gRPC ChannelProvider for this service. */ - public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { - return InstantiatingGrpcChannelProvider.newBuilder() - .setMaxInboundMessageSize(Integer.MAX_VALUE); - } - - /** Returns a builder for the default REST ChannelProvider for this service. */ - @BetaApi - public static InstantiatingHttpJsonChannelProvider.Builder - defaultHttpJsonTransportProviderBuilder() { - return InstantiatingHttpJsonChannelProvider.newBuilder(); - } - - public static TransportChannelProvider defaultTransportChannelProvider() { - return defaultGrpcTransportProviderBuilder().build(); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(DeviceManagerStubSettings.class)) - .setTransportToken( - GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); - } - - @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { - return ApiClientHeaderProvider.newBuilder() - .setGeneratedLibToken( - "gapic", GaxProperties.getLibraryVersion(DeviceManagerStubSettings.class)) - .setTransportToken( - GaxHttpJsonProperties.getHttpJsonTokenName(), - GaxHttpJsonProperties.getHttpJsonVersion()); - } - - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { - return DeviceManagerStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); - } - - /** Returns a new gRPC builder for this class. */ - public static Builder newBuilder() { - return Builder.createDefault(); - } - - /** Returns a new REST builder for this class. */ - public static Builder newHttpJsonBuilder() { - return Builder.createHttpJsonDefault(); - } - - /** Returns a new builder for this class. */ - public static Builder newBuilder(ClientContext clientContext) { - return new Builder(clientContext); - } - - /** Returns a builder containing all the values of this settings class. */ - public Builder toBuilder() { - return new Builder(this); - } - - protected DeviceManagerStubSettings(Builder settingsBuilder) throws IOException { - super(settingsBuilder); - - createDeviceRegistrySettings = settingsBuilder.createDeviceRegistrySettings().build(); - getDeviceRegistrySettings = settingsBuilder.getDeviceRegistrySettings().build(); - updateDeviceRegistrySettings = settingsBuilder.updateDeviceRegistrySettings().build(); - deleteDeviceRegistrySettings = settingsBuilder.deleteDeviceRegistrySettings().build(); - listDeviceRegistriesSettings = settingsBuilder.listDeviceRegistriesSettings().build(); - createDeviceSettings = settingsBuilder.createDeviceSettings().build(); - getDeviceSettings = settingsBuilder.getDeviceSettings().build(); - updateDeviceSettings = settingsBuilder.updateDeviceSettings().build(); - deleteDeviceSettings = settingsBuilder.deleteDeviceSettings().build(); - listDevicesSettings = settingsBuilder.listDevicesSettings().build(); - modifyCloudToDeviceConfigSettings = settingsBuilder.modifyCloudToDeviceConfigSettings().build(); - listDeviceConfigVersionsSettings = settingsBuilder.listDeviceConfigVersionsSettings().build(); - listDeviceStatesSettings = settingsBuilder.listDeviceStatesSettings().build(); - setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); - getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); - testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); - sendCommandToDeviceSettings = settingsBuilder.sendCommandToDeviceSettings().build(); - bindDeviceToGatewaySettings = settingsBuilder.bindDeviceToGatewaySettings().build(); - unbindDeviceFromGatewaySettings = settingsBuilder.unbindDeviceFromGatewaySettings().build(); - } - - /** Builder for DeviceManagerStubSettings. */ - public static class Builder extends StubSettings.Builder { - private final ImmutableList> unaryMethodSettingsBuilders; - private final UnaryCallSettings.Builder - createDeviceRegistrySettings; - private final UnaryCallSettings.Builder - getDeviceRegistrySettings; - private final UnaryCallSettings.Builder - updateDeviceRegistrySettings; - private final UnaryCallSettings.Builder - deleteDeviceRegistrySettings; - private final PagedCallSettings.Builder< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - ListDeviceRegistriesPagedResponse> - listDeviceRegistriesSettings; - private final UnaryCallSettings.Builder createDeviceSettings; - private final UnaryCallSettings.Builder getDeviceSettings; - private final UnaryCallSettings.Builder updateDeviceSettings; - private final UnaryCallSettings.Builder deleteDeviceSettings; - private final PagedCallSettings.Builder< - ListDevicesRequest, ListDevicesResponse, ListDevicesPagedResponse> - listDevicesSettings; - private final UnaryCallSettings.Builder - modifyCloudToDeviceConfigSettings; - private final UnaryCallSettings.Builder< - ListDeviceConfigVersionsRequest, ListDeviceConfigVersionsResponse> - listDeviceConfigVersionsSettings; - private final UnaryCallSettings.Builder - listDeviceStatesSettings; - private final UnaryCallSettings.Builder setIamPolicySettings; - private final UnaryCallSettings.Builder getIamPolicySettings; - private final UnaryCallSettings.Builder - testIamPermissionsSettings; - private final UnaryCallSettings.Builder - sendCommandToDeviceSettings; - private final UnaryCallSettings.Builder - bindDeviceToGatewaySettings; - private final UnaryCallSettings.Builder< - UnbindDeviceFromGatewayRequest, UnbindDeviceFromGatewayResponse> - unbindDeviceFromGatewaySettings; - private static final ImmutableMap> - RETRYABLE_CODE_DEFINITIONS; - - static { - ImmutableMap.Builder> definitions = - ImmutableMap.builder(); - definitions.put( - "no_retry_0_codes", ImmutableSet.copyOf(Lists.newArrayList())); - definitions.put( - "retry_policy_1_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED))); - definitions.put( - "retry_policy_2_codes", - ImmutableSet.copyOf( - Lists.newArrayList( - StatusCode.Code.UNAVAILABLE, - StatusCode.Code.DEADLINE_EXCEEDED, - StatusCode.Code.RESOURCE_EXHAUSTED))); - RETRYABLE_CODE_DEFINITIONS = definitions.build(); - } - - private static final ImmutableMap RETRY_PARAM_DEFINITIONS; - - static { - ImmutableMap.Builder definitions = ImmutableMap.builder(); - RetrySettings settings = null; - settings = - RetrySettings.newBuilder() - .setInitialRpcTimeout(Duration.ofMillis(120000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(120000L)) - .setTotalTimeout(Duration.ofMillis(120000L)) - .build(); - definitions.put("no_retry_0_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(100L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(120000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(120000L)) - .setTotalTimeout(Duration.ofMillis(120000L)) - .build(); - definitions.put("retry_policy_1_params", settings); - settings = - RetrySettings.newBuilder() - .setInitialRetryDelay(Duration.ofMillis(1000L)) - .setRetryDelayMultiplier(1.3) - .setMaxRetryDelay(Duration.ofMillis(60000L)) - .setInitialRpcTimeout(Duration.ofMillis(120000L)) - .setRpcTimeoutMultiplier(1.0) - .setMaxRpcTimeout(Duration.ofMillis(120000L)) - .setTotalTimeout(Duration.ofMillis(120000L)) - .build(); - definitions.put("retry_policy_2_params", settings); - RETRY_PARAM_DEFINITIONS = definitions.build(); - } - - protected Builder() { - this(((ClientContext) null)); - } - - protected Builder(ClientContext clientContext) { - super(clientContext); - - createDeviceRegistrySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - getDeviceRegistrySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateDeviceRegistrySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteDeviceRegistrySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listDeviceRegistriesSettings = - PagedCallSettings.newBuilder(LIST_DEVICE_REGISTRIES_PAGE_STR_FACT); - createDeviceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - getDeviceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - updateDeviceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - deleteDeviceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listDevicesSettings = PagedCallSettings.newBuilder(LIST_DEVICES_PAGE_STR_FACT); - modifyCloudToDeviceConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listDeviceConfigVersionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - listDeviceStatesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - sendCommandToDeviceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - bindDeviceToGatewaySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - unbindDeviceFromGatewaySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createDeviceRegistrySettings, - getDeviceRegistrySettings, - updateDeviceRegistrySettings, - deleteDeviceRegistrySettings, - listDeviceRegistriesSettings, - createDeviceSettings, - getDeviceSettings, - updateDeviceSettings, - deleteDeviceSettings, - listDevicesSettings, - modifyCloudToDeviceConfigSettings, - listDeviceConfigVersionsSettings, - listDeviceStatesSettings, - setIamPolicySettings, - getIamPolicySettings, - testIamPermissionsSettings, - sendCommandToDeviceSettings, - bindDeviceToGatewaySettings, - unbindDeviceFromGatewaySettings); - initDefaults(this); - } - - protected Builder(DeviceManagerStubSettings settings) { - super(settings); - - createDeviceRegistrySettings = settings.createDeviceRegistrySettings.toBuilder(); - getDeviceRegistrySettings = settings.getDeviceRegistrySettings.toBuilder(); - updateDeviceRegistrySettings = settings.updateDeviceRegistrySettings.toBuilder(); - deleteDeviceRegistrySettings = settings.deleteDeviceRegistrySettings.toBuilder(); - listDeviceRegistriesSettings = settings.listDeviceRegistriesSettings.toBuilder(); - createDeviceSettings = settings.createDeviceSettings.toBuilder(); - getDeviceSettings = settings.getDeviceSettings.toBuilder(); - updateDeviceSettings = settings.updateDeviceSettings.toBuilder(); - deleteDeviceSettings = settings.deleteDeviceSettings.toBuilder(); - listDevicesSettings = settings.listDevicesSettings.toBuilder(); - modifyCloudToDeviceConfigSettings = settings.modifyCloudToDeviceConfigSettings.toBuilder(); - listDeviceConfigVersionsSettings = settings.listDeviceConfigVersionsSettings.toBuilder(); - listDeviceStatesSettings = settings.listDeviceStatesSettings.toBuilder(); - setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); - getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); - testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); - sendCommandToDeviceSettings = settings.sendCommandToDeviceSettings.toBuilder(); - bindDeviceToGatewaySettings = settings.bindDeviceToGatewaySettings.toBuilder(); - unbindDeviceFromGatewaySettings = settings.unbindDeviceFromGatewaySettings.toBuilder(); - - unaryMethodSettingsBuilders = - ImmutableList.>of( - createDeviceRegistrySettings, - getDeviceRegistrySettings, - updateDeviceRegistrySettings, - deleteDeviceRegistrySettings, - listDeviceRegistriesSettings, - createDeviceSettings, - getDeviceSettings, - updateDeviceSettings, - deleteDeviceSettings, - listDevicesSettings, - modifyCloudToDeviceConfigSettings, - listDeviceConfigVersionsSettings, - listDeviceStatesSettings, - setIamPolicySettings, - getIamPolicySettings, - testIamPermissionsSettings, - sendCommandToDeviceSettings, - bindDeviceToGatewaySettings, - unbindDeviceFromGatewaySettings); - } - - private static Builder createDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultTransportChannelProvider()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder createHttpJsonDefault() { - Builder builder = new Builder(((ClientContext) null)); - - builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); - builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); - builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); - builder.setEndpoint(getDefaultEndpoint()); - builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); - builder.setSwitchToMtlsEndpointAllowed(true); - - return initDefaults(builder); - } - - private static Builder initDefaults(Builder builder) { - builder - .createDeviceRegistrySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - builder - .getDeviceRegistrySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .updateDeviceRegistrySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - builder - .deleteDeviceRegistrySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .listDeviceRegistriesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .createDeviceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - builder - .getDeviceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .updateDeviceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - builder - .deleteDeviceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .listDevicesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .modifyCloudToDeviceConfigSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); - - builder - .listDeviceConfigVersionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .listDeviceStatesSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params")); - - builder - .setIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - builder - .getIamPolicySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - builder - .testIamPermissionsSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - builder - .sendCommandToDeviceSettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params")); - - builder - .bindDeviceToGatewaySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - builder - .unbindDeviceFromGatewaySettings() - .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes")) - .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params")); - - return builder; - } - - /** - * Applies the given settings updater function to all of the unary API methods in this service. - * - *

Note: This method does not support applying settings to streaming methods. - */ - public Builder applyToAllUnaryMethods( - ApiFunction, Void> settingsUpdater) { - super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); - return this; - } - - public ImmutableList> unaryMethodSettingsBuilders() { - return unaryMethodSettingsBuilders; - } - - /** Returns the builder for the settings used for calls to createDeviceRegistry. */ - public UnaryCallSettings.Builder - createDeviceRegistrySettings() { - return createDeviceRegistrySettings; - } - - /** Returns the builder for the settings used for calls to getDeviceRegistry. */ - public UnaryCallSettings.Builder - getDeviceRegistrySettings() { - return getDeviceRegistrySettings; - } - - /** Returns the builder for the settings used for calls to updateDeviceRegistry. */ - public UnaryCallSettings.Builder - updateDeviceRegistrySettings() { - return updateDeviceRegistrySettings; - } - - /** Returns the builder for the settings used for calls to deleteDeviceRegistry. */ - public UnaryCallSettings.Builder - deleteDeviceRegistrySettings() { - return deleteDeviceRegistrySettings; - } - - /** Returns the builder for the settings used for calls to listDeviceRegistries. */ - public PagedCallSettings.Builder< - ListDeviceRegistriesRequest, - ListDeviceRegistriesResponse, - ListDeviceRegistriesPagedResponse> - listDeviceRegistriesSettings() { - return listDeviceRegistriesSettings; - } - - /** Returns the builder for the settings used for calls to createDevice. */ - public UnaryCallSettings.Builder createDeviceSettings() { - return createDeviceSettings; - } - - /** Returns the builder for the settings used for calls to getDevice. */ - public UnaryCallSettings.Builder getDeviceSettings() { - return getDeviceSettings; - } - - /** Returns the builder for the settings used for calls to updateDevice. */ - public UnaryCallSettings.Builder updateDeviceSettings() { - return updateDeviceSettings; - } - - /** Returns the builder for the settings used for calls to deleteDevice. */ - public UnaryCallSettings.Builder deleteDeviceSettings() { - return deleteDeviceSettings; - } - - /** Returns the builder for the settings used for calls to listDevices. */ - public PagedCallSettings.Builder< - ListDevicesRequest, ListDevicesResponse, ListDevicesPagedResponse> - listDevicesSettings() { - return listDevicesSettings; - } - - /** Returns the builder for the settings used for calls to modifyCloudToDeviceConfig. */ - public UnaryCallSettings.Builder - modifyCloudToDeviceConfigSettings() { - return modifyCloudToDeviceConfigSettings; - } - - /** Returns the builder for the settings used for calls to listDeviceConfigVersions. */ - public UnaryCallSettings.Builder< - ListDeviceConfigVersionsRequest, ListDeviceConfigVersionsResponse> - listDeviceConfigVersionsSettings() { - return listDeviceConfigVersionsSettings; - } - - /** Returns the builder for the settings used for calls to listDeviceStates. */ - public UnaryCallSettings.Builder - listDeviceStatesSettings() { - return listDeviceStatesSettings; - } - - /** Returns the builder for the settings used for calls to setIamPolicy. */ - public UnaryCallSettings.Builder setIamPolicySettings() { - return setIamPolicySettings; - } - - /** Returns the builder for the settings used for calls to getIamPolicy. */ - public UnaryCallSettings.Builder getIamPolicySettings() { - return getIamPolicySettings; - } - - /** Returns the builder for the settings used for calls to testIamPermissions. */ - public UnaryCallSettings.Builder - testIamPermissionsSettings() { - return testIamPermissionsSettings; - } - - /** Returns the builder for the settings used for calls to sendCommandToDevice. */ - public UnaryCallSettings.Builder - sendCommandToDeviceSettings() { - return sendCommandToDeviceSettings; - } - - /** Returns the builder for the settings used for calls to bindDeviceToGateway. */ - public UnaryCallSettings.Builder - bindDeviceToGatewaySettings() { - return bindDeviceToGatewaySettings; - } - - /** Returns the builder for the settings used for calls to unbindDeviceFromGateway. */ - public UnaryCallSettings.Builder< - UnbindDeviceFromGatewayRequest, UnbindDeviceFromGatewayResponse> - unbindDeviceFromGatewaySettings() { - return unbindDeviceFromGatewaySettings; - } - - @Override - public DeviceManagerStubSettings build() throws IOException { - return new DeviceManagerStubSettings(this); - } - } -} diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/GrpcDeviceManagerCallableFactory.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/GrpcDeviceManagerCallableFactory.java deleted file mode 100644 index ea87b08a..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/GrpcDeviceManagerCallableFactory.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.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 DeviceManager service API. - * - *

This class is for advanced usage. - */ -@Generated("by gapic-generator-java") -public class GrpcDeviceManagerCallableFactory 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-iot/src/main/java/com/google/cloud/iot/v1/stub/GrpcDeviceManagerStub.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/GrpcDeviceManagerStub.java deleted file mode 100644 index 2641a62f..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/GrpcDeviceManagerStub.java +++ /dev/null @@ -1,791 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.stub; - -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse; -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse; - -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.UnaryCallable; -import com.google.cloud.iot.v1.BindDeviceToGatewayRequest; -import com.google.cloud.iot.v1.BindDeviceToGatewayResponse; -import com.google.cloud.iot.v1.CreateDeviceRegistryRequest; -import com.google.cloud.iot.v1.CreateDeviceRequest; -import com.google.cloud.iot.v1.DeleteDeviceRegistryRequest; -import com.google.cloud.iot.v1.DeleteDeviceRequest; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.GetDeviceRegistryRequest; -import com.google.cloud.iot.v1.GetDeviceRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; -import com.google.cloud.iot.v1.ListDeviceRegistriesRequest; -import com.google.cloud.iot.v1.ListDeviceRegistriesResponse; -import com.google.cloud.iot.v1.ListDeviceStatesRequest; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; -import com.google.cloud.iot.v1.ListDevicesRequest; -import com.google.cloud.iot.v1.ListDevicesResponse; -import com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse; -import com.google.cloud.iot.v1.UpdateDeviceRegistryRequest; -import com.google.cloud.iot.v1.UpdateDeviceRequest; -import com.google.common.collect.ImmutableMap; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.longrunning.stub.GrpcOperationsStub; -import com.google.protobuf.Empty; -import io.grpc.MethodDescriptor; -import io.grpc.protobuf.ProtoUtils; -import java.io.IOException; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * gRPC stub implementation for the DeviceManager service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator-java") -public class GrpcDeviceManagerStub extends DeviceManagerStub { - private static final MethodDescriptor - createDeviceRegistryMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/CreateDeviceRegistry") - .setRequestMarshaller( - ProtoUtils.marshaller(CreateDeviceRegistryRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(DeviceRegistry.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - getDeviceRegistryMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetDeviceRegistry") - .setRequestMarshaller( - ProtoUtils.marshaller(GetDeviceRegistryRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(DeviceRegistry.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - updateDeviceRegistryMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/UpdateDeviceRegistry") - .setRequestMarshaller( - ProtoUtils.marshaller(UpdateDeviceRegistryRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(DeviceRegistry.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - deleteDeviceRegistryMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/DeleteDeviceRegistry") - .setRequestMarshaller( - ProtoUtils.marshaller(DeleteDeviceRegistryRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - listDeviceRegistriesMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceRegistries") - .setRequestMarshaller( - ProtoUtils.marshaller(ListDeviceRegistriesRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListDeviceRegistriesResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor createDeviceMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/CreateDevice") - .setRequestMarshaller(ProtoUtils.marshaller(CreateDeviceRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Device.getDefaultInstance())) - .build(); - - private static final MethodDescriptor getDeviceMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetDevice") - .setRequestMarshaller(ProtoUtils.marshaller(GetDeviceRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Device.getDefaultInstance())) - .build(); - - private static final MethodDescriptor updateDeviceMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/UpdateDevice") - .setRequestMarshaller(ProtoUtils.marshaller(UpdateDeviceRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Device.getDefaultInstance())) - .build(); - - private static final MethodDescriptor deleteDeviceMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/DeleteDevice") - .setRequestMarshaller(ProtoUtils.marshaller(DeleteDeviceRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - listDevicesMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDevices") - .setRequestMarshaller(ProtoUtils.marshaller(ListDevicesRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListDevicesResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - modifyCloudToDeviceConfigMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ModifyCloudToDeviceConfig") - .setRequestMarshaller( - ProtoUtils.marshaller(ModifyCloudToDeviceConfigRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(DeviceConfig.getDefaultInstance())) - .build(); - - private static final MethodDescriptor< - ListDeviceConfigVersionsRequest, ListDeviceConfigVersionsResponse> - listDeviceConfigVersionsMethodDescriptor = - MethodDescriptor - .newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceConfigVersions") - .setRequestMarshaller( - ProtoUtils.marshaller(ListDeviceConfigVersionsRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListDeviceConfigVersionsResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - listDeviceStatesMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceStates") - .setRequestMarshaller( - ProtoUtils.marshaller(ListDeviceStatesRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(ListDeviceStatesResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor setIamPolicyMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/SetIamPolicy") - .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) - .build(); - - private static final MethodDescriptor getIamPolicyMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetIamPolicy") - .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) - .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - testIamPermissionsMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/TestIamPermissions") - .setRequestMarshaller( - ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - sendCommandToDeviceMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/SendCommandToDevice") - .setRequestMarshaller( - ProtoUtils.marshaller(SendCommandToDeviceRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(SendCommandToDeviceResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor - bindDeviceToGatewayMethodDescriptor = - MethodDescriptor.newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/BindDeviceToGateway") - .setRequestMarshaller( - ProtoUtils.marshaller(BindDeviceToGatewayRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(BindDeviceToGatewayResponse.getDefaultInstance())) - .build(); - - private static final MethodDescriptor< - UnbindDeviceFromGatewayRequest, UnbindDeviceFromGatewayResponse> - unbindDeviceFromGatewayMethodDescriptor = - MethodDescriptor - .newBuilder() - .setType(MethodDescriptor.MethodType.UNARY) - .setFullMethodName("google.cloud.iot.v1.DeviceManager/UnbindDeviceFromGateway") - .setRequestMarshaller( - ProtoUtils.marshaller(UnbindDeviceFromGatewayRequest.getDefaultInstance())) - .setResponseMarshaller( - ProtoUtils.marshaller(UnbindDeviceFromGatewayResponse.getDefaultInstance())) - .build(); - - private final UnaryCallable - createDeviceRegistryCallable; - private final UnaryCallable getDeviceRegistryCallable; - private final UnaryCallable - updateDeviceRegistryCallable; - private final UnaryCallable deleteDeviceRegistryCallable; - private final UnaryCallable - listDeviceRegistriesCallable; - private final UnaryCallable - listDeviceRegistriesPagedCallable; - private final UnaryCallable createDeviceCallable; - private final UnaryCallable getDeviceCallable; - private final UnaryCallable updateDeviceCallable; - private final UnaryCallable deleteDeviceCallable; - private final UnaryCallable listDevicesCallable; - private final UnaryCallable - listDevicesPagedCallable; - private final UnaryCallable - modifyCloudToDeviceConfigCallable; - private final UnaryCallable - listDeviceConfigVersionsCallable; - private final UnaryCallable - listDeviceStatesCallable; - private final UnaryCallable setIamPolicyCallable; - private final UnaryCallable getIamPolicyCallable; - private final UnaryCallable - testIamPermissionsCallable; - private final UnaryCallable - sendCommandToDeviceCallable; - private final UnaryCallable - bindDeviceToGatewayCallable; - private final UnaryCallable - unbindDeviceFromGatewayCallable; - - private final BackgroundResource backgroundResources; - private final GrpcOperationsStub operationsStub; - private final GrpcStubCallableFactory callableFactory; - - public static final GrpcDeviceManagerStub create(DeviceManagerStubSettings settings) - throws IOException { - return new GrpcDeviceManagerStub(settings, ClientContext.create(settings)); - } - - public static final GrpcDeviceManagerStub create(ClientContext clientContext) throws IOException { - return new GrpcDeviceManagerStub(DeviceManagerStubSettings.newBuilder().build(), clientContext); - } - - public static final GrpcDeviceManagerStub create( - ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { - return new GrpcDeviceManagerStub( - DeviceManagerStubSettings.newBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of GrpcDeviceManagerStub, 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 GrpcDeviceManagerStub(DeviceManagerStubSettings settings, ClientContext clientContext) - throws IOException { - this(settings, clientContext, new GrpcDeviceManagerCallableFactory()); - } - - /** - * Constructs an instance of GrpcDeviceManagerStub, 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 GrpcDeviceManagerStub( - DeviceManagerStubSettings settings, - ClientContext clientContext, - GrpcStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); - - GrpcCallSettings - createDeviceRegistryTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(createDeviceRegistryMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - }) - .build(); - GrpcCallSettings getDeviceRegistryTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getDeviceRegistryMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings - updateDeviceRegistryTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(updateDeviceRegistryMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put( - "device_registry.name", - String.valueOf(request.getDeviceRegistry().getName())); - return params.build(); - }) - .build(); - GrpcCallSettings deleteDeviceRegistryTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(deleteDeviceRegistryMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings - listDeviceRegistriesTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listDeviceRegistriesMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - }) - .build(); - GrpcCallSettings createDeviceTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(createDeviceMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - }) - .build(); - GrpcCallSettings getDeviceTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getDeviceMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings updateDeviceTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(updateDeviceMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("device.name", String.valueOf(request.getDevice().getName())); - return params.build(); - }) - .build(); - GrpcCallSettings deleteDeviceTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(deleteDeviceMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings listDevicesTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listDevicesMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - }) - .build(); - GrpcCallSettings - modifyCloudToDeviceConfigTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(modifyCloudToDeviceConfigMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings - listDeviceConfigVersionsTransportSettings = - GrpcCallSettings - .newBuilder() - .setMethodDescriptor(listDeviceConfigVersionsMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings - listDeviceStatesTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(listDeviceStatesMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings setIamPolicyTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(setIamPolicyMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - }) - .build(); - GrpcCallSettings getIamPolicyTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(getIamPolicyMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - }) - .build(); - GrpcCallSettings - testIamPermissionsTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(testIamPermissionsMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("resource", String.valueOf(request.getResource())); - return params.build(); - }) - .build(); - GrpcCallSettings - sendCommandToDeviceTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(sendCommandToDeviceMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("name", String.valueOf(request.getName())); - return params.build(); - }) - .build(); - GrpcCallSettings - bindDeviceToGatewayTransportSettings = - GrpcCallSettings.newBuilder() - .setMethodDescriptor(bindDeviceToGatewayMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - }) - .build(); - GrpcCallSettings - unbindDeviceFromGatewayTransportSettings = - GrpcCallSettings - .newBuilder() - .setMethodDescriptor(unbindDeviceFromGatewayMethodDescriptor) - .setParamsExtractor( - request -> { - ImmutableMap.Builder params = ImmutableMap.builder(); - params.put("parent", String.valueOf(request.getParent())); - return params.build(); - }) - .build(); - - this.createDeviceRegistryCallable = - callableFactory.createUnaryCallable( - createDeviceRegistryTransportSettings, - settings.createDeviceRegistrySettings(), - clientContext); - this.getDeviceRegistryCallable = - callableFactory.createUnaryCallable( - getDeviceRegistryTransportSettings, - settings.getDeviceRegistrySettings(), - clientContext); - this.updateDeviceRegistryCallable = - callableFactory.createUnaryCallable( - updateDeviceRegistryTransportSettings, - settings.updateDeviceRegistrySettings(), - clientContext); - this.deleteDeviceRegistryCallable = - callableFactory.createUnaryCallable( - deleteDeviceRegistryTransportSettings, - settings.deleteDeviceRegistrySettings(), - clientContext); - this.listDeviceRegistriesCallable = - callableFactory.createUnaryCallable( - listDeviceRegistriesTransportSettings, - settings.listDeviceRegistriesSettings(), - clientContext); - this.listDeviceRegistriesPagedCallable = - callableFactory.createPagedCallable( - listDeviceRegistriesTransportSettings, - settings.listDeviceRegistriesSettings(), - clientContext); - this.createDeviceCallable = - callableFactory.createUnaryCallable( - createDeviceTransportSettings, settings.createDeviceSettings(), clientContext); - this.getDeviceCallable = - callableFactory.createUnaryCallable( - getDeviceTransportSettings, settings.getDeviceSettings(), clientContext); - this.updateDeviceCallable = - callableFactory.createUnaryCallable( - updateDeviceTransportSettings, settings.updateDeviceSettings(), clientContext); - this.deleteDeviceCallable = - callableFactory.createUnaryCallable( - deleteDeviceTransportSettings, settings.deleteDeviceSettings(), clientContext); - this.listDevicesCallable = - callableFactory.createUnaryCallable( - listDevicesTransportSettings, settings.listDevicesSettings(), clientContext); - this.listDevicesPagedCallable = - callableFactory.createPagedCallable( - listDevicesTransportSettings, settings.listDevicesSettings(), clientContext); - this.modifyCloudToDeviceConfigCallable = - callableFactory.createUnaryCallable( - modifyCloudToDeviceConfigTransportSettings, - settings.modifyCloudToDeviceConfigSettings(), - clientContext); - this.listDeviceConfigVersionsCallable = - callableFactory.createUnaryCallable( - listDeviceConfigVersionsTransportSettings, - settings.listDeviceConfigVersionsSettings(), - clientContext); - this.listDeviceStatesCallable = - callableFactory.createUnaryCallable( - listDeviceStatesTransportSettings, settings.listDeviceStatesSettings(), clientContext); - this.setIamPolicyCallable = - callableFactory.createUnaryCallable( - setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); - this.getIamPolicyCallable = - callableFactory.createUnaryCallable( - getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); - this.testIamPermissionsCallable = - callableFactory.createUnaryCallable( - testIamPermissionsTransportSettings, - settings.testIamPermissionsSettings(), - clientContext); - this.sendCommandToDeviceCallable = - callableFactory.createUnaryCallable( - sendCommandToDeviceTransportSettings, - settings.sendCommandToDeviceSettings(), - clientContext); - this.bindDeviceToGatewayCallable = - callableFactory.createUnaryCallable( - bindDeviceToGatewayTransportSettings, - settings.bindDeviceToGatewaySettings(), - clientContext); - this.unbindDeviceFromGatewayCallable = - callableFactory.createUnaryCallable( - unbindDeviceFromGatewayTransportSettings, - settings.unbindDeviceFromGatewaySettings(), - clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - public GrpcOperationsStub getOperationsStub() { - return operationsStub; - } - - @Override - public UnaryCallable createDeviceRegistryCallable() { - return createDeviceRegistryCallable; - } - - @Override - public UnaryCallable getDeviceRegistryCallable() { - return getDeviceRegistryCallable; - } - - @Override - public UnaryCallable updateDeviceRegistryCallable() { - return updateDeviceRegistryCallable; - } - - @Override - public UnaryCallable deleteDeviceRegistryCallable() { - return deleteDeviceRegistryCallable; - } - - @Override - public UnaryCallable - listDeviceRegistriesCallable() { - return listDeviceRegistriesCallable; - } - - @Override - public UnaryCallable - listDeviceRegistriesPagedCallable() { - return listDeviceRegistriesPagedCallable; - } - - @Override - public UnaryCallable createDeviceCallable() { - return createDeviceCallable; - } - - @Override - public UnaryCallable getDeviceCallable() { - return getDeviceCallable; - } - - @Override - public UnaryCallable updateDeviceCallable() { - return updateDeviceCallable; - } - - @Override - public UnaryCallable deleteDeviceCallable() { - return deleteDeviceCallable; - } - - @Override - public UnaryCallable listDevicesCallable() { - return listDevicesCallable; - } - - @Override - public UnaryCallable listDevicesPagedCallable() { - return listDevicesPagedCallable; - } - - @Override - public UnaryCallable - modifyCloudToDeviceConfigCallable() { - return modifyCloudToDeviceConfigCallable; - } - - @Override - public UnaryCallable - listDeviceConfigVersionsCallable() { - return listDeviceConfigVersionsCallable; - } - - @Override - public UnaryCallable - listDeviceStatesCallable() { - return listDeviceStatesCallable; - } - - @Override - public UnaryCallable setIamPolicyCallable() { - return setIamPolicyCallable; - } - - @Override - public UnaryCallable getIamPolicyCallable() { - return getIamPolicyCallable; - } - - @Override - public UnaryCallable - testIamPermissionsCallable() { - return testIamPermissionsCallable; - } - - @Override - public UnaryCallable - sendCommandToDeviceCallable() { - return sendCommandToDeviceCallable; - } - - @Override - public UnaryCallable - bindDeviceToGatewayCallable() { - return bindDeviceToGatewayCallable; - } - - @Override - public UnaryCallable - unbindDeviceFromGatewayCallable() { - return unbindDeviceFromGatewayCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerCallableFactory.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerCallableFactory.java deleted file mode 100644 index 58d6577e..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerCallableFactory.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.stub; - -import com.google.api.core.BetaApi; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonCallableFactory; -import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; -import com.google.api.gax.rpc.BatchingCallSettings; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.OperationCallSettings; -import com.google.api.gax.rpc.OperationCallable; -import com.google.api.gax.rpc.PagedCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallSettings; -import com.google.api.gax.rpc.ServerStreamingCallable; -import com.google.api.gax.rpc.UnaryCallSettings; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.longrunning.Operation; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST callable factory implementation for the DeviceManager service API. - * - *

This class is for advanced usage. - */ -@Generated("by gapic-generator-java") -@BetaApi -public class HttpJsonDeviceManagerCallableFactory - implements HttpJsonStubCallableFactory { - - @Override - public UnaryCallable createUnaryCallable( - HttpJsonCallSettings httpJsonCallSettings, - UnaryCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createUnaryCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public - UnaryCallable createPagedCallable( - HttpJsonCallSettings httpJsonCallSettings, - PagedCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createPagedCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @Override - public UnaryCallable createBatchingCallable( - HttpJsonCallSettings httpJsonCallSettings, - BatchingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createBatchingCallable( - httpJsonCallSettings, callSettings, clientContext); - } - - @BetaApi( - "The surface for long-running operations is not stable yet and may change in the future.") - @Override - public - OperationCallable createOperationCallable( - HttpJsonCallSettings httpJsonCallSettings, - OperationCallSettings callSettings, - ClientContext clientContext, - OperationsStub operationsStub) { - UnaryCallable innerCallable = - HttpJsonCallableFactory.createBaseUnaryCallable( - httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); - HttpJsonOperationSnapshotCallable initialCallable = - new HttpJsonOperationSnapshotCallable( - innerCallable, - httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); - return HttpJsonCallableFactory.createOperationCallable( - callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); - } - - @Override - public - ServerStreamingCallable createServerStreamingCallable( - HttpJsonCallSettings httpJsonCallSettings, - ServerStreamingCallSettings callSettings, - ClientContext clientContext) { - return HttpJsonCallableFactory.createServerStreamingCallable( - httpJsonCallSettings, callSettings, clientContext); - } -} diff --git a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerStub.java b/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerStub.java deleted file mode 100644 index fd445c9f..00000000 --- a/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/HttpJsonDeviceManagerStub.java +++ /dev/null @@ -1,1250 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.stub; - -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse; -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse; - -import com.google.api.core.BetaApi; -import com.google.api.core.InternalApi; -import com.google.api.gax.core.BackgroundResource; -import com.google.api.gax.core.BackgroundResourceAggregation; -import com.google.api.gax.httpjson.ApiMethodDescriptor; -import com.google.api.gax.httpjson.HttpJsonCallSettings; -import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; -import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; -import com.google.api.gax.httpjson.ProtoMessageResponseParser; -import com.google.api.gax.httpjson.ProtoRestSerializer; -import com.google.api.gax.rpc.ClientContext; -import com.google.api.gax.rpc.UnaryCallable; -import com.google.cloud.iot.v1.BindDeviceToGatewayRequest; -import com.google.cloud.iot.v1.BindDeviceToGatewayResponse; -import com.google.cloud.iot.v1.CreateDeviceRegistryRequest; -import com.google.cloud.iot.v1.CreateDeviceRequest; -import com.google.cloud.iot.v1.DeleteDeviceRegistryRequest; -import com.google.cloud.iot.v1.DeleteDeviceRequest; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.GetDeviceRegistryRequest; -import com.google.cloud.iot.v1.GetDeviceRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; -import com.google.cloud.iot.v1.ListDeviceRegistriesRequest; -import com.google.cloud.iot.v1.ListDeviceRegistriesResponse; -import com.google.cloud.iot.v1.ListDeviceStatesRequest; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; -import com.google.cloud.iot.v1.ListDevicesRequest; -import com.google.cloud.iot.v1.ListDevicesResponse; -import com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse; -import com.google.cloud.iot.v1.UpdateDeviceRegistryRequest; -import com.google.cloud.iot.v1.UpdateDeviceRequest; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.Empty; -import com.google.protobuf.TypeRegistry; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import javax.annotation.Generated; - -// AUTO-GENERATED DOCUMENTATION AND CLASS. -/** - * REST stub implementation for the DeviceManager service API. - * - *

This class is for advanced usage and reflects the underlying API directly. - */ -@Generated("by gapic-generator-java") -@BetaApi -public class HttpJsonDeviceManagerStub extends DeviceManagerStub { - private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); - - private static final ApiMethodDescriptor - createDeviceRegistryMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/CreateDeviceRegistry") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{parent=projects/*/locations/*}/registries", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "parent", request.getParent()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("deviceRegistry", request.getDeviceRegistry(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(DeviceRegistry.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - getDeviceRegistryMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetDeviceRegistry") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{name=projects/*/locations/*/registries/*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(DeviceRegistry.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - updateDeviceRegistryMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/UpdateDeviceRegistry") - .setHttpMethod("PATCH") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{deviceRegistry.name=projects/*/locations/*/registries/*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam( - fields, - "deviceRegistry.name", - request.getDeviceRegistry().getName()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("deviceRegistry", request.getDeviceRegistry(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(DeviceRegistry.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - deleteDeviceRegistryMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/DeleteDeviceRegistry") - .setHttpMethod("DELETE") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{name=projects/*/locations/*/registries/*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Empty.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor< - ListDeviceRegistriesRequest, ListDeviceRegistriesResponse> - listDeviceRegistriesMethodDescriptor = - ApiMethodDescriptor - .newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceRegistries") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{parent=projects/*/locations/*}/registries", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "parent", request.getParent()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putQueryParam(fields, "pageSize", request.getPageSize()); - serializer.putQueryParam(fields, "pageToken", request.getPageToken()); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(ListDeviceRegistriesResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - createDeviceMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/CreateDevice") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{parent=projects/*/locations/*/registries/*}/devices", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "parent", request.getParent()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("device", request.getDevice(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Device.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor getDeviceMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetDevice") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{name=projects/*/locations/*/registries/*/devices/*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setAdditionalPaths( - "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putQueryParam(fields, "fieldMask", request.getFieldMask()); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Device.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - updateDeviceMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/UpdateDevice") - .setHttpMethod("PATCH") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{device.name=projects/*/locations/*/registries/*/devices/*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam( - fields, "device.name", request.getDevice().getName()); - return fields; - }) - .setAdditionalPaths( - "/v1/{device.name=projects/*/locations/*/registries/*/groups/*/devices/*}") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("device", request.getDevice(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Device.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - deleteDeviceMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/DeleteDevice") - .setHttpMethod("DELETE") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{name=projects/*/locations/*/registries/*/devices/*}", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Empty.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - listDevicesMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDevices") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{parent=projects/*/locations/*/registries/*}/devices", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "parent", request.getParent()); - return fields; - }) - .setAdditionalPaths( - "/v1/{parent=projects/*/locations/*/registries/*/groups/*}/devices") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putQueryParam( - fields, "deviceIds", request.getDeviceIdsList()); - serializer.putQueryParam( - fields, "deviceNumIds", request.getDeviceNumIdsList()); - serializer.putQueryParam(fields, "fieldMask", request.getFieldMask()); - serializer.putQueryParam( - fields, "gatewayListOptions", request.getGatewayListOptions()); - serializer.putQueryParam(fields, "pageSize", request.getPageSize()); - serializer.putQueryParam(fields, "pageToken", request.getPageToken()); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(ListDevicesResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - modifyCloudToDeviceConfigMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ModifyCloudToDeviceConfig") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{name=projects/*/locations/*/registries/*/devices/*}:modifyCloudToDeviceConfig", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setAdditionalPaths( - "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:modifyCloudToDeviceConfig") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().clearName().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(DeviceConfig.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor< - ListDeviceConfigVersionsRequest, ListDeviceConfigVersionsResponse> - listDeviceConfigVersionsMethodDescriptor = - ApiMethodDescriptor - .newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceConfigVersions") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{name=projects/*/locations/*/registries/*/devices/*}/configVersions", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setAdditionalPaths( - "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/configVersions") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putQueryParam( - fields, "numVersions", request.getNumVersions()); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(ListDeviceConfigVersionsResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - listDeviceStatesMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/ListDeviceStates") - .setHttpMethod("GET") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{name=projects/*/locations/*/registries/*/devices/*}/states", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setAdditionalPaths( - "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/states") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putQueryParam(fields, "numStates", request.getNumStates()); - return fields; - }) - .setRequestBodyExtractor(request -> null) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(ListDeviceStatesResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - setIamPolicyMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/SetIamPolicy") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{resource=projects/*/locations/*/registries/*}:setIamPolicy", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "resource", request.getResource()); - return fields; - }) - .setAdditionalPaths( - "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:setIamPolicy") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().clearResource().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Policy.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - getIamPolicyMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/GetIamPolicy") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{resource=projects/*/locations/*/registries/*}:getIamPolicy", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "resource", request.getResource()); - return fields; - }) - .setAdditionalPaths( - "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:getIamPolicy") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().clearResource().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(Policy.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - testIamPermissionsMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/TestIamPermissions") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{resource=projects/*/locations/*/registries/*}:testIamPermissions", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "resource", request.getResource()); - return fields; - }) - .setAdditionalPaths( - "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:testIamPermissions") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().clearResource().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(TestIamPermissionsResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - sendCommandToDeviceMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/SendCommandToDevice") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{name=projects/*/locations/*/registries/*/devices/*}:sendCommandToDevice", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "name", request.getName()); - return fields; - }) - .setAdditionalPaths( - "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:sendCommandToDevice") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().clearName().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(SendCommandToDeviceResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor - bindDeviceToGatewayMethodDescriptor = - ApiMethodDescriptor.newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/BindDeviceToGateway") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{parent=projects/*/locations/*/registries/*}:bindDeviceToGateway", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "parent", request.getParent()); - return fields; - }) - .setAdditionalPaths( - "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:bindDeviceToGateway") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().clearParent().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(BindDeviceToGatewayResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private static final ApiMethodDescriptor< - UnbindDeviceFromGatewayRequest, UnbindDeviceFromGatewayResponse> - unbindDeviceFromGatewayMethodDescriptor = - ApiMethodDescriptor - .newBuilder() - .setFullMethodName("google.cloud.iot.v1.DeviceManager/UnbindDeviceFromGateway") - .setHttpMethod("POST") - .setType(ApiMethodDescriptor.MethodType.UNARY) - .setRequestFormatter( - ProtoMessageRequestFormatter.newBuilder() - .setPath( - "/v1/{parent=projects/*/locations/*/registries/*}:unbindDeviceFromGateway", - request -> { - Map fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - serializer.putPathParam(fields, "parent", request.getParent()); - return fields; - }) - .setAdditionalPaths( - "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:unbindDeviceFromGateway") - .setQueryParamsExtractor( - request -> { - Map> fields = new HashMap<>(); - ProtoRestSerializer serializer = - ProtoRestSerializer.create(); - return fields; - }) - .setRequestBodyExtractor( - request -> - ProtoRestSerializer.create() - .toBody("*", request.toBuilder().clearParent().build(), false)) - .build()) - .setResponseParser( - ProtoMessageResponseParser.newBuilder() - .setDefaultInstance(UnbindDeviceFromGatewayResponse.getDefaultInstance()) - .setDefaultTypeRegistry(typeRegistry) - .build()) - .build(); - - private final UnaryCallable - createDeviceRegistryCallable; - private final UnaryCallable getDeviceRegistryCallable; - private final UnaryCallable - updateDeviceRegistryCallable; - private final UnaryCallable deleteDeviceRegistryCallable; - private final UnaryCallable - listDeviceRegistriesCallable; - private final UnaryCallable - listDeviceRegistriesPagedCallable; - private final UnaryCallable createDeviceCallable; - private final UnaryCallable getDeviceCallable; - private final UnaryCallable updateDeviceCallable; - private final UnaryCallable deleteDeviceCallable; - private final UnaryCallable listDevicesCallable; - private final UnaryCallable - listDevicesPagedCallable; - private final UnaryCallable - modifyCloudToDeviceConfigCallable; - private final UnaryCallable - listDeviceConfigVersionsCallable; - private final UnaryCallable - listDeviceStatesCallable; - private final UnaryCallable setIamPolicyCallable; - private final UnaryCallable getIamPolicyCallable; - private final UnaryCallable - testIamPermissionsCallable; - private final UnaryCallable - sendCommandToDeviceCallable; - private final UnaryCallable - bindDeviceToGatewayCallable; - private final UnaryCallable - unbindDeviceFromGatewayCallable; - - private final BackgroundResource backgroundResources; - private final HttpJsonStubCallableFactory callableFactory; - - public static final HttpJsonDeviceManagerStub create(DeviceManagerStubSettings settings) - throws IOException { - return new HttpJsonDeviceManagerStub(settings, ClientContext.create(settings)); - } - - public static final HttpJsonDeviceManagerStub create(ClientContext clientContext) - throws IOException { - return new HttpJsonDeviceManagerStub( - DeviceManagerStubSettings.newHttpJsonBuilder().build(), clientContext); - } - - public static final HttpJsonDeviceManagerStub create( - ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { - return new HttpJsonDeviceManagerStub( - DeviceManagerStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory); - } - - /** - * Constructs an instance of HttpJsonDeviceManagerStub, 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 HttpJsonDeviceManagerStub( - DeviceManagerStubSettings settings, ClientContext clientContext) throws IOException { - this(settings, clientContext, new HttpJsonDeviceManagerCallableFactory()); - } - - /** - * Constructs an instance of HttpJsonDeviceManagerStub, 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 HttpJsonDeviceManagerStub( - DeviceManagerStubSettings settings, - ClientContext clientContext, - HttpJsonStubCallableFactory callableFactory) - throws IOException { - this.callableFactory = callableFactory; - - HttpJsonCallSettings - createDeviceRegistryTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(createDeviceRegistryMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - getDeviceRegistryTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(getDeviceRegistryMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - updateDeviceRegistryTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(updateDeviceRegistryMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings deleteDeviceRegistryTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(deleteDeviceRegistryMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - listDeviceRegistriesTransportSettings = - HttpJsonCallSettings - .newBuilder() - .setMethodDescriptor(listDeviceRegistriesMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings createDeviceTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(createDeviceMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings getDeviceTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(getDeviceMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings updateDeviceTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(updateDeviceMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings deleteDeviceTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(deleteDeviceMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings listDevicesTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(listDevicesMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - modifyCloudToDeviceConfigTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(modifyCloudToDeviceConfigMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - listDeviceConfigVersionsTransportSettings = - HttpJsonCallSettings - .newBuilder() - .setMethodDescriptor(listDeviceConfigVersionsMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - listDeviceStatesTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(listDeviceStatesMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings setIamPolicyTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(setIamPolicyMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings getIamPolicyTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(getIamPolicyMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - testIamPermissionsTransportSettings = - HttpJsonCallSettings.newBuilder() - .setMethodDescriptor(testIamPermissionsMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - sendCommandToDeviceTransportSettings = - HttpJsonCallSettings - .newBuilder() - .setMethodDescriptor(sendCommandToDeviceMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - bindDeviceToGatewayTransportSettings = - HttpJsonCallSettings - .newBuilder() - .setMethodDescriptor(bindDeviceToGatewayMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - HttpJsonCallSettings - unbindDeviceFromGatewayTransportSettings = - HttpJsonCallSettings - .newBuilder() - .setMethodDescriptor(unbindDeviceFromGatewayMethodDescriptor) - .setTypeRegistry(typeRegistry) - .build(); - - this.createDeviceRegistryCallable = - callableFactory.createUnaryCallable( - createDeviceRegistryTransportSettings, - settings.createDeviceRegistrySettings(), - clientContext); - this.getDeviceRegistryCallable = - callableFactory.createUnaryCallable( - getDeviceRegistryTransportSettings, - settings.getDeviceRegistrySettings(), - clientContext); - this.updateDeviceRegistryCallable = - callableFactory.createUnaryCallable( - updateDeviceRegistryTransportSettings, - settings.updateDeviceRegistrySettings(), - clientContext); - this.deleteDeviceRegistryCallable = - callableFactory.createUnaryCallable( - deleteDeviceRegistryTransportSettings, - settings.deleteDeviceRegistrySettings(), - clientContext); - this.listDeviceRegistriesCallable = - callableFactory.createUnaryCallable( - listDeviceRegistriesTransportSettings, - settings.listDeviceRegistriesSettings(), - clientContext); - this.listDeviceRegistriesPagedCallable = - callableFactory.createPagedCallable( - listDeviceRegistriesTransportSettings, - settings.listDeviceRegistriesSettings(), - clientContext); - this.createDeviceCallable = - callableFactory.createUnaryCallable( - createDeviceTransportSettings, settings.createDeviceSettings(), clientContext); - this.getDeviceCallable = - callableFactory.createUnaryCallable( - getDeviceTransportSettings, settings.getDeviceSettings(), clientContext); - this.updateDeviceCallable = - callableFactory.createUnaryCallable( - updateDeviceTransportSettings, settings.updateDeviceSettings(), clientContext); - this.deleteDeviceCallable = - callableFactory.createUnaryCallable( - deleteDeviceTransportSettings, settings.deleteDeviceSettings(), clientContext); - this.listDevicesCallable = - callableFactory.createUnaryCallable( - listDevicesTransportSettings, settings.listDevicesSettings(), clientContext); - this.listDevicesPagedCallable = - callableFactory.createPagedCallable( - listDevicesTransportSettings, settings.listDevicesSettings(), clientContext); - this.modifyCloudToDeviceConfigCallable = - callableFactory.createUnaryCallable( - modifyCloudToDeviceConfigTransportSettings, - settings.modifyCloudToDeviceConfigSettings(), - clientContext); - this.listDeviceConfigVersionsCallable = - callableFactory.createUnaryCallable( - listDeviceConfigVersionsTransportSettings, - settings.listDeviceConfigVersionsSettings(), - clientContext); - this.listDeviceStatesCallable = - callableFactory.createUnaryCallable( - listDeviceStatesTransportSettings, settings.listDeviceStatesSettings(), clientContext); - this.setIamPolicyCallable = - callableFactory.createUnaryCallable( - setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); - this.getIamPolicyCallable = - callableFactory.createUnaryCallable( - getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); - this.testIamPermissionsCallable = - callableFactory.createUnaryCallable( - testIamPermissionsTransportSettings, - settings.testIamPermissionsSettings(), - clientContext); - this.sendCommandToDeviceCallable = - callableFactory.createUnaryCallable( - sendCommandToDeviceTransportSettings, - settings.sendCommandToDeviceSettings(), - clientContext); - this.bindDeviceToGatewayCallable = - callableFactory.createUnaryCallable( - bindDeviceToGatewayTransportSettings, - settings.bindDeviceToGatewaySettings(), - clientContext); - this.unbindDeviceFromGatewayCallable = - callableFactory.createUnaryCallable( - unbindDeviceFromGatewayTransportSettings, - settings.unbindDeviceFromGatewaySettings(), - clientContext); - - this.backgroundResources = - new BackgroundResourceAggregation(clientContext.getBackgroundResources()); - } - - @InternalApi - public static List getMethodDescriptors() { - List methodDescriptors = new ArrayList<>(); - methodDescriptors.add(createDeviceRegistryMethodDescriptor); - methodDescriptors.add(getDeviceRegistryMethodDescriptor); - methodDescriptors.add(updateDeviceRegistryMethodDescriptor); - methodDescriptors.add(deleteDeviceRegistryMethodDescriptor); - methodDescriptors.add(listDeviceRegistriesMethodDescriptor); - methodDescriptors.add(createDeviceMethodDescriptor); - methodDescriptors.add(getDeviceMethodDescriptor); - methodDescriptors.add(updateDeviceMethodDescriptor); - methodDescriptors.add(deleteDeviceMethodDescriptor); - methodDescriptors.add(listDevicesMethodDescriptor); - methodDescriptors.add(modifyCloudToDeviceConfigMethodDescriptor); - methodDescriptors.add(listDeviceConfigVersionsMethodDescriptor); - methodDescriptors.add(listDeviceStatesMethodDescriptor); - methodDescriptors.add(setIamPolicyMethodDescriptor); - methodDescriptors.add(getIamPolicyMethodDescriptor); - methodDescriptors.add(testIamPermissionsMethodDescriptor); - methodDescriptors.add(sendCommandToDeviceMethodDescriptor); - methodDescriptors.add(bindDeviceToGatewayMethodDescriptor); - methodDescriptors.add(unbindDeviceFromGatewayMethodDescriptor); - return methodDescriptors; - } - - @Override - public UnaryCallable createDeviceRegistryCallable() { - return createDeviceRegistryCallable; - } - - @Override - public UnaryCallable getDeviceRegistryCallable() { - return getDeviceRegistryCallable; - } - - @Override - public UnaryCallable updateDeviceRegistryCallable() { - return updateDeviceRegistryCallable; - } - - @Override - public UnaryCallable deleteDeviceRegistryCallable() { - return deleteDeviceRegistryCallable; - } - - @Override - public UnaryCallable - listDeviceRegistriesCallable() { - return listDeviceRegistriesCallable; - } - - @Override - public UnaryCallable - listDeviceRegistriesPagedCallable() { - return listDeviceRegistriesPagedCallable; - } - - @Override - public UnaryCallable createDeviceCallable() { - return createDeviceCallable; - } - - @Override - public UnaryCallable getDeviceCallable() { - return getDeviceCallable; - } - - @Override - public UnaryCallable updateDeviceCallable() { - return updateDeviceCallable; - } - - @Override - public UnaryCallable deleteDeviceCallable() { - return deleteDeviceCallable; - } - - @Override - public UnaryCallable listDevicesCallable() { - return listDevicesCallable; - } - - @Override - public UnaryCallable listDevicesPagedCallable() { - return listDevicesPagedCallable; - } - - @Override - public UnaryCallable - modifyCloudToDeviceConfigCallable() { - return modifyCloudToDeviceConfigCallable; - } - - @Override - public UnaryCallable - listDeviceConfigVersionsCallable() { - return listDeviceConfigVersionsCallable; - } - - @Override - public UnaryCallable - listDeviceStatesCallable() { - return listDeviceStatesCallable; - } - - @Override - public UnaryCallable setIamPolicyCallable() { - return setIamPolicyCallable; - } - - @Override - public UnaryCallable getIamPolicyCallable() { - return getIamPolicyCallable; - } - - @Override - public UnaryCallable - testIamPermissionsCallable() { - return testIamPermissionsCallable; - } - - @Override - public UnaryCallable - sendCommandToDeviceCallable() { - return sendCommandToDeviceCallable; - } - - @Override - public UnaryCallable - bindDeviceToGatewayCallable() { - return bindDeviceToGatewayCallable; - } - - @Override - public UnaryCallable - unbindDeviceFromGatewayCallable() { - return unbindDeviceFromGatewayCallable; - } - - @Override - public final void close() { - try { - backgroundResources.close(); - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new IllegalStateException("Failed to close resource", e); - } - } - - @Override - public void shutdown() { - backgroundResources.shutdown(); - } - - @Override - public boolean isShutdown() { - return backgroundResources.isShutdown(); - } - - @Override - public boolean isTerminated() { - return backgroundResources.isTerminated(); - } - - @Override - public void shutdownNow() { - backgroundResources.shutdownNow(); - } - - @Override - public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { - return backgroundResources.awaitTermination(duration, unit); - } -} diff --git a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/DeviceManagerClientHttpJsonTest.java b/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/DeviceManagerClientHttpJsonTest.java deleted file mode 100644 index 5878f0fb..00000000 --- a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/DeviceManagerClientHttpJsonTest.java +++ /dev/null @@ -1,2008 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1; - -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse; -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse; - -import com.google.api.gax.core.NoCredentialsProvider; -import com.google.api.gax.httpjson.GaxHttpJsonProperties; -import com.google.api.gax.httpjson.testing.MockHttpService; -import com.google.api.gax.rpc.ApiClientHeaderProvider; -import com.google.api.gax.rpc.ApiException; -import com.google.api.gax.rpc.ApiExceptionFactory; -import com.google.api.gax.rpc.InvalidArgumentException; -import com.google.api.gax.rpc.StatusCode; -import com.google.api.gax.rpc.testing.FakeStatusCode; -import com.google.api.resourcenames.ResourceName; -import com.google.cloud.iot.v1.stub.HttpJsonDeviceManagerStub; -import com.google.common.collect.Lists; -import com.google.iam.v1.AuditConfig; -import com.google.iam.v1.Binding; -import com.google.iam.v1.Policy; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.ByteString; -import com.google.protobuf.Empty; -import com.google.protobuf.FieldMask; -import com.google.protobuf.Timestamp; -import com.google.rpc.Status; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -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 DeviceManagerClientHttpJsonTest { - private static MockHttpService mockService; - private static DeviceManagerClient client; - - @BeforeClass - public static void startStaticServer() throws IOException { - mockService = - new MockHttpService( - HttpJsonDeviceManagerStub.getMethodDescriptors(), - DeviceManagerSettings.getDefaultEndpoint()); - DeviceManagerSettings settings = - DeviceManagerSettings.newHttpJsonBuilder() - .setTransportChannelProvider( - DeviceManagerSettings.defaultHttpJsonTransportProviderBuilder() - .setHttpTransport(mockService) - .build()) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = DeviceManagerClient.create(settings); - } - - @AfterClass - public static void stopServer() { - client.close(); - } - - @Before - public void setUp() {} - - @After - public void tearDown() throws Exception { - mockService.reset(); - } - - @Test - public void createDeviceRegistryTest() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - - DeviceRegistry actualResponse = client.createDeviceRegistry(parent, deviceRegistry); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void createDeviceRegistryExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - client.createDeviceRegistry(parent, deviceRegistry); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void createDeviceRegistryTest2() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - String parent = "projects/project-5833/locations/location-5833"; - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - - DeviceRegistry actualResponse = client.createDeviceRegistry(parent, deviceRegistry); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void createDeviceRegistryExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String parent = "projects/project-5833/locations/location-5833"; - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - client.createDeviceRegistry(parent, deviceRegistry); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getDeviceRegistryTest() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - - DeviceRegistry actualResponse = client.getDeviceRegistry(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void getDeviceRegistryExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - client.getDeviceRegistry(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getDeviceRegistryTest2() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - String name = "projects/project-5653/locations/location-5653/registries/registrie-5653"; - - DeviceRegistry actualResponse = client.getDeviceRegistry(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void getDeviceRegistryExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = "projects/project-5653/locations/location-5653/registries/registrie-5653"; - client.getDeviceRegistry(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void updateDeviceRegistryTest() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - DeviceRegistry deviceRegistry = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - - DeviceRegistry actualResponse = client.updateDeviceRegistry(deviceRegistry, updateMask); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void updateDeviceRegistryExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - DeviceRegistry deviceRegistry = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateDeviceRegistry(deviceRegistry, updateMask); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void deleteDeviceRegistryTest() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); - mockService.addResponse(expectedResponse); - - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - - client.deleteDeviceRegistry(name); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void deleteDeviceRegistryExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - client.deleteDeviceRegistry(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void deleteDeviceRegistryTest2() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); - mockService.addResponse(expectedResponse); - - String name = "projects/project-5653/locations/location-5653/registries/registrie-5653"; - - client.deleteDeviceRegistry(name); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void deleteDeviceRegistryExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = "projects/project-5653/locations/location-5653/registries/registrie-5653"; - client.deleteDeviceRegistry(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceRegistriesTest() throws Exception { - DeviceRegistry responsesElement = DeviceRegistry.newBuilder().build(); - ListDeviceRegistriesResponse expectedResponse = - ListDeviceRegistriesResponse.newBuilder() - .setNextPageToken("") - .addAllDeviceRegistries(Arrays.asList(responsesElement)) - .build(); - mockService.addResponse(expectedResponse); - - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - - ListDeviceRegistriesPagedResponse pagedListResponse = client.listDeviceRegistries(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDeviceRegistriesList().get(0), resources.get(0)); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listDeviceRegistriesExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - client.listDeviceRegistries(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceRegistriesTest2() throws Exception { - DeviceRegistry responsesElement = DeviceRegistry.newBuilder().build(); - ListDeviceRegistriesResponse expectedResponse = - ListDeviceRegistriesResponse.newBuilder() - .setNextPageToken("") - .addAllDeviceRegistries(Arrays.asList(responsesElement)) - .build(); - mockService.addResponse(expectedResponse); - - String parent = "projects/project-5833/locations/location-5833"; - - ListDeviceRegistriesPagedResponse pagedListResponse = client.listDeviceRegistries(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDeviceRegistriesList().get(0), resources.get(0)); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listDeviceRegistriesExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String parent = "projects/project-5833/locations/location-5833"; - client.listDeviceRegistries(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void createDeviceTest() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockService.addResponse(expectedResponse); - - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Device device = Device.newBuilder().build(); - - Device actualResponse = client.createDevice(parent, device); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void createDeviceExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Device device = Device.newBuilder().build(); - client.createDevice(parent, device); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void createDeviceTest2() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockService.addResponse(expectedResponse); - - String parent = "projects/project-6316/locations/location-6316/registries/registrie-6316"; - Device device = Device.newBuilder().build(); - - Device actualResponse = client.createDevice(parent, device); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void createDeviceExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String parent = "projects/project-6316/locations/location-6316/registries/registrie-6316"; - Device device = Device.newBuilder().build(); - client.createDevice(parent, device); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getDeviceTest() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockService.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - - Device actualResponse = client.getDevice(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void getDeviceExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - client.getDevice(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getDeviceTest2() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockService.addResponse(expectedResponse); - - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - - Device actualResponse = client.getDevice(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void getDeviceExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - client.getDevice(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void updateDeviceTest() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockService.addResponse(expectedResponse); - - Device device = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - - Device actualResponse = client.updateDevice(device, updateMask); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void updateDeviceExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - Device device = - Device.newBuilder() - .setId("id3355") - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateDevice(device, updateMask); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void deleteDeviceTest() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); - mockService.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - - client.deleteDevice(name); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void deleteDeviceExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - client.deleteDevice(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void deleteDeviceTest2() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); - mockService.addResponse(expectedResponse); - - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - - client.deleteDevice(name); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void deleteDeviceExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - client.deleteDevice(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDevicesTest() throws Exception { - Device responsesElement = Device.newBuilder().build(); - ListDevicesResponse expectedResponse = - ListDevicesResponse.newBuilder() - .setNextPageToken("") - .addAllDevices(Arrays.asList(responsesElement)) - .build(); - mockService.addResponse(expectedResponse); - - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - - ListDevicesPagedResponse pagedListResponse = client.listDevices(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDevicesList().get(0), resources.get(0)); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listDevicesExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - client.listDevices(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDevicesTest2() throws Exception { - Device responsesElement = Device.newBuilder().build(); - ListDevicesResponse expectedResponse = - ListDevicesResponse.newBuilder() - .setNextPageToken("") - .addAllDevices(Arrays.asList(responsesElement)) - .build(); - mockService.addResponse(expectedResponse); - - String parent = "projects/project-6316/locations/location-6316/registries/registrie-6316"; - - ListDevicesPagedResponse pagedListResponse = client.listDevices(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDevicesList().get(0), resources.get(0)); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listDevicesExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String parent = "projects/project-6316/locations/location-6316/registries/registrie-6316"; - client.listDevices(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void modifyCloudToDeviceConfigTest() throws Exception { - DeviceConfig expectedResponse = - DeviceConfig.newBuilder() - .setVersion(351608024) - .setCloudUpdateTime(Timestamp.newBuilder().build()) - .setDeviceAckTime(Timestamp.newBuilder().build()) - .setBinaryData(ByteString.EMPTY) - .build(); - mockService.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - - DeviceConfig actualResponse = client.modifyCloudToDeviceConfig(name, binaryData); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void modifyCloudToDeviceConfigExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - client.modifyCloudToDeviceConfig(name, binaryData); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void modifyCloudToDeviceConfigTest2() throws Exception { - DeviceConfig expectedResponse = - DeviceConfig.newBuilder() - .setVersion(351608024) - .setCloudUpdateTime(Timestamp.newBuilder().build()) - .setDeviceAckTime(Timestamp.newBuilder().build()) - .setBinaryData(ByteString.EMPTY) - .build(); - mockService.addResponse(expectedResponse); - - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - ByteString binaryData = ByteString.EMPTY; - - DeviceConfig actualResponse = client.modifyCloudToDeviceConfig(name, binaryData); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void modifyCloudToDeviceConfigExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - ByteString binaryData = ByteString.EMPTY; - client.modifyCloudToDeviceConfig(name, binaryData); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceConfigVersionsTest() throws Exception { - ListDeviceConfigVersionsResponse expectedResponse = - ListDeviceConfigVersionsResponse.newBuilder() - .addAllDeviceConfigs(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - - ListDeviceConfigVersionsResponse actualResponse = client.listDeviceConfigVersions(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listDeviceConfigVersionsExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - client.listDeviceConfigVersions(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceConfigVersionsTest2() throws Exception { - ListDeviceConfigVersionsResponse expectedResponse = - ListDeviceConfigVersionsResponse.newBuilder() - .addAllDeviceConfigs(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - - ListDeviceConfigVersionsResponse actualResponse = client.listDeviceConfigVersions(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listDeviceConfigVersionsExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - client.listDeviceConfigVersions(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceStatesTest() throws Exception { - ListDeviceStatesResponse expectedResponse = - ListDeviceStatesResponse.newBuilder() - .addAllDeviceStates(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - - ListDeviceStatesResponse actualResponse = client.listDeviceStates(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listDeviceStatesExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - client.listDeviceStates(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceStatesTest2() throws Exception { - ListDeviceStatesResponse expectedResponse = - ListDeviceStatesResponse.newBuilder() - .addAllDeviceStates(new ArrayList()) - .build(); - mockService.addResponse(expectedResponse); - - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - - ListDeviceStatesResponse actualResponse = client.listDeviceStates(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void listDeviceStatesExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - client.listDeviceStates(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void setIamPolicyTest() throws Exception { - Policy expectedResponse = - Policy.newBuilder() - .setVersion(351608024) - .addAllBindings(new ArrayList()) - .addAllAuditConfigs(new ArrayList()) - .setEtag(ByteString.EMPTY) - .build(); - mockService.addResponse(expectedResponse); - - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Policy policy = Policy.newBuilder().build(); - - Policy actualResponse = client.setIamPolicy(resource, policy); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void setIamPolicyExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Policy policy = Policy.newBuilder().build(); - client.setIamPolicy(resource, policy); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void setIamPolicyTest2() throws Exception { - Policy expectedResponse = - Policy.newBuilder() - .setVersion(351608024) - .addAllBindings(new ArrayList()) - .addAllAuditConfigs(new ArrayList()) - .setEtag(ByteString.EMPTY) - .build(); - mockService.addResponse(expectedResponse); - - String resource = "projects/project-6248/locations/location-6248/registries/registrie-6248"; - Policy policy = Policy.newBuilder().build(); - - Policy actualResponse = client.setIamPolicy(resource, policy); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void setIamPolicyExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String resource = "projects/project-6248/locations/location-6248/registries/registrie-6248"; - Policy policy = Policy.newBuilder().build(); - client.setIamPolicy(resource, policy); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getIamPolicyTest() throws Exception { - Policy expectedResponse = - Policy.newBuilder() - .setVersion(351608024) - .addAllBindings(new ArrayList()) - .addAllAuditConfigs(new ArrayList()) - .setEtag(ByteString.EMPTY) - .build(); - mockService.addResponse(expectedResponse); - - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - - Policy actualResponse = client.getIamPolicy(resource); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void getIamPolicyExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - client.getIamPolicy(resource); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getIamPolicyTest2() throws Exception { - Policy expectedResponse = - Policy.newBuilder() - .setVersion(351608024) - .addAllBindings(new ArrayList()) - .addAllAuditConfigs(new ArrayList()) - .setEtag(ByteString.EMPTY) - .build(); - mockService.addResponse(expectedResponse); - - String resource = "projects/project-6248/locations/location-6248/registries/registrie-6248"; - - Policy actualResponse = client.getIamPolicy(resource); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void getIamPolicyExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String resource = "projects/project-6248/locations/location-6248/registries/registrie-6248"; - client.getIamPolicy(resource); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void testIamPermissionsTest() throws Exception { - TestIamPermissionsResponse expectedResponse = - TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); - mockService.addResponse(expectedResponse); - - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - List permissions = new ArrayList<>(); - - TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void testIamPermissionsExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - List permissions = new ArrayList<>(); - client.testIamPermissions(resource, permissions); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void testIamPermissionsTest2() throws Exception { - TestIamPermissionsResponse expectedResponse = - TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); - mockService.addResponse(expectedResponse); - - String resource = "projects/project-6248/locations/location-6248/registries/registrie-6248"; - List permissions = new ArrayList<>(); - - TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void testIamPermissionsExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String resource = "projects/project-6248/locations/location-6248/registries/registrie-6248"; - List permissions = new ArrayList<>(); - client.testIamPermissions(resource, permissions); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void sendCommandToDeviceTest() throws Exception { - SendCommandToDeviceResponse expectedResponse = SendCommandToDeviceResponse.newBuilder().build(); - mockService.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - - SendCommandToDeviceResponse actualResponse = client.sendCommandToDevice(name, binaryData); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void sendCommandToDeviceExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - client.sendCommandToDevice(name, binaryData); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void sendCommandToDeviceTest2() throws Exception { - SendCommandToDeviceResponse expectedResponse = SendCommandToDeviceResponse.newBuilder().build(); - mockService.addResponse(expectedResponse); - - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - ByteString binaryData = ByteString.EMPTY; - - SendCommandToDeviceResponse actualResponse = client.sendCommandToDevice(name, binaryData); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void sendCommandToDeviceExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - ByteString binaryData = ByteString.EMPTY; - client.sendCommandToDevice(name, binaryData); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void sendCommandToDeviceTest3() throws Exception { - SendCommandToDeviceResponse expectedResponse = SendCommandToDeviceResponse.newBuilder().build(); - mockService.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - - SendCommandToDeviceResponse actualResponse = - client.sendCommandToDevice(name, binaryData, subfolder); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void sendCommandToDeviceExceptionTest3() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - client.sendCommandToDevice(name, binaryData, subfolder); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void sendCommandToDeviceTest4() throws Exception { - SendCommandToDeviceResponse expectedResponse = SendCommandToDeviceResponse.newBuilder().build(); - mockService.addResponse(expectedResponse); - - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - - SendCommandToDeviceResponse actualResponse = - client.sendCommandToDevice(name, binaryData, subfolder); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void sendCommandToDeviceExceptionTest4() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String name = - "projects/project-6436/locations/location-6436/registries/registrie-6436/devices/device-6436"; - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - client.sendCommandToDevice(name, binaryData, subfolder); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void bindDeviceToGatewayTest() throws Exception { - BindDeviceToGatewayResponse expectedResponse = BindDeviceToGatewayResponse.newBuilder().build(); - mockService.addResponse(expectedResponse); - - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - - BindDeviceToGatewayResponse actualResponse = - client.bindDeviceToGateway(parent, gatewayId, deviceId); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void bindDeviceToGatewayExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - client.bindDeviceToGateway(parent, gatewayId, deviceId); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void bindDeviceToGatewayTest2() throws Exception { - BindDeviceToGatewayResponse expectedResponse = BindDeviceToGatewayResponse.newBuilder().build(); - mockService.addResponse(expectedResponse); - - String parent = "projects/project-6316/locations/location-6316/registries/registrie-6316"; - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - - BindDeviceToGatewayResponse actualResponse = - client.bindDeviceToGateway(parent, gatewayId, deviceId); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void bindDeviceToGatewayExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String parent = "projects/project-6316/locations/location-6316/registries/registrie-6316"; - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - client.bindDeviceToGateway(parent, gatewayId, deviceId); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void unbindDeviceFromGatewayTest() throws Exception { - UnbindDeviceFromGatewayResponse expectedResponse = - UnbindDeviceFromGatewayResponse.newBuilder().build(); - mockService.addResponse(expectedResponse); - - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - - UnbindDeviceFromGatewayResponse actualResponse = - client.unbindDeviceFromGateway(parent, gatewayId, deviceId); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void unbindDeviceFromGatewayExceptionTest() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - client.unbindDeviceFromGateway(parent, gatewayId, deviceId); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void unbindDeviceFromGatewayTest2() throws Exception { - UnbindDeviceFromGatewayResponse expectedResponse = - UnbindDeviceFromGatewayResponse.newBuilder().build(); - mockService.addResponse(expectedResponse); - - String parent = "projects/project-6316/locations/location-6316/registries/registrie-6316"; - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - - UnbindDeviceFromGatewayResponse actualResponse = - client.unbindDeviceFromGateway(parent, gatewayId, deviceId); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockService.getRequestPaths(); - Assert.assertEquals(1, actualRequests.size()); - - String apiClientHeaderKey = - mockService - .getRequestHeaders() - .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) - .iterator() - .next(); - Assert.assertTrue( - GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() - .matcher(apiClientHeaderKey) - .matches()); - } - - @Test - public void unbindDeviceFromGatewayExceptionTest2() throws Exception { - ApiException exception = - ApiExceptionFactory.createException( - new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); - mockService.addException(exception); - - try { - String parent = "projects/project-6316/locations/location-6316/registries/registrie-6316"; - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - client.unbindDeviceFromGateway(parent, gatewayId, deviceId); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/DeviceManagerClientTest.java b/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/DeviceManagerClientTest.java deleted file mode 100644 index 7dc640a7..00000000 --- a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/DeviceManagerClientTest.java +++ /dev/null @@ -1,1752 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1; - -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse; -import static com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse; - -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.resourcenames.ResourceName; -import com.google.common.collect.Lists; -import com.google.iam.v1.AuditConfig; -import com.google.iam.v1.Binding; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.AbstractMessage; -import com.google.protobuf.ByteString; -import com.google.protobuf.Empty; -import com.google.protobuf.FieldMask; -import com.google.protobuf.Timestamp; -import com.google.rpc.Status; -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 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 DeviceManagerClientTest { - private static MockDeviceManager mockDeviceManager; - private static MockServiceHelper mockServiceHelper; - private LocalChannelProvider channelProvider; - private DeviceManagerClient client; - - @BeforeClass - public static void startStaticServer() { - mockDeviceManager = new MockDeviceManager(); - mockServiceHelper = - new MockServiceHelper( - UUID.randomUUID().toString(), Arrays.asList(mockDeviceManager)); - mockServiceHelper.start(); - } - - @AfterClass - public static void stopServer() { - mockServiceHelper.stop(); - } - - @Before - public void setUp() throws IOException { - mockServiceHelper.reset(); - channelProvider = mockServiceHelper.createChannelProvider(); - DeviceManagerSettings settings = - DeviceManagerSettings.newBuilder() - .setTransportChannelProvider(channelProvider) - .setCredentialsProvider(NoCredentialsProvider.create()) - .build(); - client = DeviceManagerClient.create(settings); - } - - @After - public void tearDown() throws Exception { - client.close(); - } - - @Test - public void createDeviceRegistryTest() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - - DeviceRegistry actualResponse = client.createDeviceRegistry(parent, deviceRegistry); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - CreateDeviceRegistryRequest actualRequest = - ((CreateDeviceRegistryRequest) actualRequests.get(0)); - - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(deviceRegistry, actualRequest.getDeviceRegistry()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void createDeviceRegistryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - client.createDeviceRegistry(parent, deviceRegistry); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void createDeviceRegistryTest2() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String parent = "parent-995424086"; - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - - DeviceRegistry actualResponse = client.createDeviceRegistry(parent, deviceRegistry); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - CreateDeviceRegistryRequest actualRequest = - ((CreateDeviceRegistryRequest) actualRequests.get(0)); - - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(deviceRegistry, actualRequest.getDeviceRegistry()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void createDeviceRegistryExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String parent = "parent-995424086"; - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - client.createDeviceRegistry(parent, deviceRegistry); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getDeviceRegistryTest() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - - DeviceRegistry actualResponse = client.getDeviceRegistry(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetDeviceRegistryRequest actualRequest = ((GetDeviceRegistryRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getDeviceRegistryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - client.getDeviceRegistry(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getDeviceRegistryTest2() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - - DeviceRegistry actualResponse = client.getDeviceRegistry(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetDeviceRegistryRequest actualRequest = ((GetDeviceRegistryRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getDeviceRegistryExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - client.getDeviceRegistry(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void updateDeviceRegistryTest() throws Exception { - DeviceRegistry expectedResponse = - DeviceRegistry.newBuilder() - .setId("id3355") - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllEventNotificationConfigs(new ArrayList()) - .setStateNotificationConfig(StateNotificationConfig.newBuilder().build()) - .setMqttConfig(MqttConfig.newBuilder().build()) - .setHttpConfig(HttpConfig.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .addAllCredentials(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - - DeviceRegistry actualResponse = client.updateDeviceRegistry(deviceRegistry, updateMask); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - UpdateDeviceRegistryRequest actualRequest = - ((UpdateDeviceRegistryRequest) actualRequests.get(0)); - - Assert.assertEquals(deviceRegistry, actualRequest.getDeviceRegistry()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void updateDeviceRegistryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateDeviceRegistry(deviceRegistry, updateMask); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void deleteDeviceRegistryTest() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - - client.deleteDeviceRegistry(name); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - DeleteDeviceRegistryRequest actualRequest = - ((DeleteDeviceRegistryRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void deleteDeviceRegistryExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - client.deleteDeviceRegistry(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void deleteDeviceRegistryTest2() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - - client.deleteDeviceRegistry(name); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - DeleteDeviceRegistryRequest actualRequest = - ((DeleteDeviceRegistryRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void deleteDeviceRegistryExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - client.deleteDeviceRegistry(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceRegistriesTest() throws Exception { - DeviceRegistry responsesElement = DeviceRegistry.newBuilder().build(); - ListDeviceRegistriesResponse expectedResponse = - ListDeviceRegistriesResponse.newBuilder() - .setNextPageToken("") - .addAllDeviceRegistries(Arrays.asList(responsesElement)) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - - ListDeviceRegistriesPagedResponse pagedListResponse = client.listDeviceRegistries(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDeviceRegistriesList().get(0), resources.get(0)); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListDeviceRegistriesRequest actualRequest = - ((ListDeviceRegistriesRequest) actualRequests.get(0)); - - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listDeviceRegistriesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - client.listDeviceRegistries(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceRegistriesTest2() throws Exception { - DeviceRegistry responsesElement = DeviceRegistry.newBuilder().build(); - ListDeviceRegistriesResponse expectedResponse = - ListDeviceRegistriesResponse.newBuilder() - .setNextPageToken("") - .addAllDeviceRegistries(Arrays.asList(responsesElement)) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String parent = "parent-995424086"; - - ListDeviceRegistriesPagedResponse pagedListResponse = client.listDeviceRegistries(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDeviceRegistriesList().get(0), resources.get(0)); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListDeviceRegistriesRequest actualRequest = - ((ListDeviceRegistriesRequest) actualRequests.get(0)); - - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listDeviceRegistriesExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String parent = "parent-995424086"; - client.listDeviceRegistries(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void createDeviceTest() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Device device = Device.newBuilder().build(); - - Device actualResponse = client.createDevice(parent, device); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - CreateDeviceRequest actualRequest = ((CreateDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(device, actualRequest.getDevice()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void createDeviceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Device device = Device.newBuilder().build(); - client.createDevice(parent, device); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void createDeviceTest2() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String parent = "parent-995424086"; - Device device = Device.newBuilder().build(); - - Device actualResponse = client.createDevice(parent, device); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - CreateDeviceRequest actualRequest = ((CreateDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(device, actualRequest.getDevice()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void createDeviceExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String parent = "parent-995424086"; - Device device = Device.newBuilder().build(); - client.createDevice(parent, device); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getDeviceTest() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - - Device actualResponse = client.getDevice(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetDeviceRequest actualRequest = ((GetDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getDeviceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - client.getDevice(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getDeviceTest2() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - - Device actualResponse = client.getDevice(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetDeviceRequest actualRequest = ((GetDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getDeviceExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - client.getDevice(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void updateDeviceTest() throws Exception { - Device expectedResponse = - Device.newBuilder() - .setId("id3355") - .setName(DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumId(-1034366860) - .addAllCredentials(new ArrayList()) - .setLastHeartbeatTime(Timestamp.newBuilder().build()) - .setLastEventTime(Timestamp.newBuilder().build()) - .setLastStateTime(Timestamp.newBuilder().build()) - .setLastConfigAckTime(Timestamp.newBuilder().build()) - .setLastConfigSendTime(Timestamp.newBuilder().build()) - .setBlocked(true) - .setLastErrorTime(Timestamp.newBuilder().build()) - .setLastErrorStatus(Status.newBuilder().build()) - .setConfig(DeviceConfig.newBuilder().build()) - .setState(DeviceState.newBuilder().build()) - .setLogLevel(LogLevel.forNumber(0)) - .putAllMetadata(new HashMap()) - .setGatewayConfig(GatewayConfig.newBuilder().build()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - Device device = Device.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - - Device actualResponse = client.updateDevice(device, updateMask); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - UpdateDeviceRequest actualRequest = ((UpdateDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(device, actualRequest.getDevice()); - Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void updateDeviceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - Device device = Device.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - client.updateDevice(device, updateMask); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void deleteDeviceTest() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - - client.deleteDevice(name); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - DeleteDeviceRequest actualRequest = ((DeleteDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void deleteDeviceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - client.deleteDevice(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void deleteDeviceTest2() throws Exception { - Empty expectedResponse = Empty.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - - client.deleteDevice(name); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - DeleteDeviceRequest actualRequest = ((DeleteDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void deleteDeviceExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - client.deleteDevice(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDevicesTest() throws Exception { - Device responsesElement = Device.newBuilder().build(); - ListDevicesResponse expectedResponse = - ListDevicesResponse.newBuilder() - .setNextPageToken("") - .addAllDevices(Arrays.asList(responsesElement)) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - - ListDevicesPagedResponse pagedListResponse = client.listDevices(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDevicesList().get(0), resources.get(0)); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListDevicesRequest actualRequest = ((ListDevicesRequest) actualRequests.get(0)); - - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listDevicesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - client.listDevices(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDevicesTest2() throws Exception { - Device responsesElement = Device.newBuilder().build(); - ListDevicesResponse expectedResponse = - ListDevicesResponse.newBuilder() - .setNextPageToken("") - .addAllDevices(Arrays.asList(responsesElement)) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String parent = "parent-995424086"; - - ListDevicesPagedResponse pagedListResponse = client.listDevices(parent); - - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - - Assert.assertEquals(1, resources.size()); - Assert.assertEquals(expectedResponse.getDevicesList().get(0), resources.get(0)); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListDevicesRequest actualRequest = ((ListDevicesRequest) actualRequests.get(0)); - - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listDevicesExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String parent = "parent-995424086"; - client.listDevices(parent); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void modifyCloudToDeviceConfigTest() throws Exception { - DeviceConfig expectedResponse = - DeviceConfig.newBuilder() - .setVersion(351608024) - .setCloudUpdateTime(Timestamp.newBuilder().build()) - .setDeviceAckTime(Timestamp.newBuilder().build()) - .setBinaryData(ByteString.EMPTY) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - - DeviceConfig actualResponse = client.modifyCloudToDeviceConfig(name, binaryData); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ModifyCloudToDeviceConfigRequest actualRequest = - ((ModifyCloudToDeviceConfigRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertEquals(binaryData, actualRequest.getBinaryData()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void modifyCloudToDeviceConfigExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - client.modifyCloudToDeviceConfig(name, binaryData); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void modifyCloudToDeviceConfigTest2() throws Exception { - DeviceConfig expectedResponse = - DeviceConfig.newBuilder() - .setVersion(351608024) - .setCloudUpdateTime(Timestamp.newBuilder().build()) - .setDeviceAckTime(Timestamp.newBuilder().build()) - .setBinaryData(ByteString.EMPTY) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - ByteString binaryData = ByteString.EMPTY; - - DeviceConfig actualResponse = client.modifyCloudToDeviceConfig(name, binaryData); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ModifyCloudToDeviceConfigRequest actualRequest = - ((ModifyCloudToDeviceConfigRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertEquals(binaryData, actualRequest.getBinaryData()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void modifyCloudToDeviceConfigExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - ByteString binaryData = ByteString.EMPTY; - client.modifyCloudToDeviceConfig(name, binaryData); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceConfigVersionsTest() throws Exception { - ListDeviceConfigVersionsResponse expectedResponse = - ListDeviceConfigVersionsResponse.newBuilder() - .addAllDeviceConfigs(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - - ListDeviceConfigVersionsResponse actualResponse = client.listDeviceConfigVersions(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListDeviceConfigVersionsRequest actualRequest = - ((ListDeviceConfigVersionsRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listDeviceConfigVersionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - client.listDeviceConfigVersions(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceConfigVersionsTest2() throws Exception { - ListDeviceConfigVersionsResponse expectedResponse = - ListDeviceConfigVersionsResponse.newBuilder() - .addAllDeviceConfigs(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - - ListDeviceConfigVersionsResponse actualResponse = client.listDeviceConfigVersions(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListDeviceConfigVersionsRequest actualRequest = - ((ListDeviceConfigVersionsRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listDeviceConfigVersionsExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - client.listDeviceConfigVersions(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceStatesTest() throws Exception { - ListDeviceStatesResponse expectedResponse = - ListDeviceStatesResponse.newBuilder() - .addAllDeviceStates(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - - ListDeviceStatesResponse actualResponse = client.listDeviceStates(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListDeviceStatesRequest actualRequest = ((ListDeviceStatesRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listDeviceStatesExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - client.listDeviceStates(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void listDeviceStatesTest2() throws Exception { - ListDeviceStatesResponse expectedResponse = - ListDeviceStatesResponse.newBuilder() - .addAllDeviceStates(new ArrayList()) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - - ListDeviceStatesResponse actualResponse = client.listDeviceStates(name); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - ListDeviceStatesRequest actualRequest = ((ListDeviceStatesRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void listDeviceStatesExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - client.listDeviceStates(name); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void setIamPolicyTest() throws Exception { - Policy expectedResponse = - Policy.newBuilder() - .setVersion(351608024) - .addAllBindings(new ArrayList()) - .addAllAuditConfigs(new ArrayList()) - .setEtag(ByteString.EMPTY) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Policy policy = Policy.newBuilder().build(); - - Policy actualResponse = client.setIamPolicy(resource, policy); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - - Assert.assertEquals(resource.toString(), actualRequest.getResource()); - Assert.assertEquals(policy, actualRequest.getPolicy()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void setIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Policy policy = Policy.newBuilder().build(); - client.setIamPolicy(resource, policy); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void setIamPolicyTest2() throws Exception { - Policy expectedResponse = - Policy.newBuilder() - .setVersion(351608024) - .addAllBindings(new ArrayList()) - .addAllAuditConfigs(new ArrayList()) - .setEtag(ByteString.EMPTY) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String resource = "resource-341064690"; - Policy policy = Policy.newBuilder().build(); - - Policy actualResponse = client.setIamPolicy(resource, policy); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - SetIamPolicyRequest actualRequest = ((SetIamPolicyRequest) actualRequests.get(0)); - - Assert.assertEquals(resource, actualRequest.getResource()); - Assert.assertEquals(policy, actualRequest.getPolicy()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void setIamPolicyExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String resource = "resource-341064690"; - Policy policy = Policy.newBuilder().build(); - client.setIamPolicy(resource, policy); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getIamPolicyTest() throws Exception { - Policy expectedResponse = - Policy.newBuilder() - .setVersion(351608024) - .addAllBindings(new ArrayList()) - .addAllAuditConfigs(new ArrayList()) - .setEtag(ByteString.EMPTY) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - - Policy actualResponse = client.getIamPolicy(resource); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - - Assert.assertEquals(resource.toString(), actualRequest.getResource()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getIamPolicyExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - client.getIamPolicy(resource); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void getIamPolicyTest2() throws Exception { - Policy expectedResponse = - Policy.newBuilder() - .setVersion(351608024) - .addAllBindings(new ArrayList()) - .addAllAuditConfigs(new ArrayList()) - .setEtag(ByteString.EMPTY) - .build(); - mockDeviceManager.addResponse(expectedResponse); - - String resource = "resource-341064690"; - - Policy actualResponse = client.getIamPolicy(resource); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - GetIamPolicyRequest actualRequest = ((GetIamPolicyRequest) actualRequests.get(0)); - - Assert.assertEquals(resource, actualRequest.getResource()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void getIamPolicyExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String resource = "resource-341064690"; - client.getIamPolicy(resource); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void testIamPermissionsTest() throws Exception { - TestIamPermissionsResponse expectedResponse = - TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); - mockDeviceManager.addResponse(expectedResponse); - - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - List permissions = new ArrayList<>(); - - TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - - Assert.assertEquals(resource.toString(), actualRequest.getResource()); - Assert.assertEquals(permissions, actualRequest.getPermissionsList()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void testIamPermissionsExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - List permissions = new ArrayList<>(); - client.testIamPermissions(resource, permissions); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void testIamPermissionsTest2() throws Exception { - TestIamPermissionsResponse expectedResponse = - TestIamPermissionsResponse.newBuilder().addAllPermissions(new ArrayList()).build(); - mockDeviceManager.addResponse(expectedResponse); - - String resource = "resource-341064690"; - List permissions = new ArrayList<>(); - - TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - TestIamPermissionsRequest actualRequest = ((TestIamPermissionsRequest) actualRequests.get(0)); - - Assert.assertEquals(resource, actualRequest.getResource()); - Assert.assertEquals(permissions, actualRequest.getPermissionsList()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void testIamPermissionsExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String resource = "resource-341064690"; - List permissions = new ArrayList<>(); - client.testIamPermissions(resource, permissions); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void sendCommandToDeviceTest() throws Exception { - SendCommandToDeviceResponse expectedResponse = SendCommandToDeviceResponse.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - - SendCommandToDeviceResponse actualResponse = client.sendCommandToDevice(name, binaryData); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - SendCommandToDeviceRequest actualRequest = ((SendCommandToDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertEquals(binaryData, actualRequest.getBinaryData()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void sendCommandToDeviceExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - client.sendCommandToDevice(name, binaryData); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void sendCommandToDeviceTest2() throws Exception { - SendCommandToDeviceResponse expectedResponse = SendCommandToDeviceResponse.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - ByteString binaryData = ByteString.EMPTY; - - SendCommandToDeviceResponse actualResponse = client.sendCommandToDevice(name, binaryData); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - SendCommandToDeviceRequest actualRequest = ((SendCommandToDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertEquals(binaryData, actualRequest.getBinaryData()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void sendCommandToDeviceExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - ByteString binaryData = ByteString.EMPTY; - client.sendCommandToDevice(name, binaryData); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void sendCommandToDeviceTest3() throws Exception { - SendCommandToDeviceResponse expectedResponse = SendCommandToDeviceResponse.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - - SendCommandToDeviceResponse actualResponse = - client.sendCommandToDevice(name, binaryData, subfolder); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - SendCommandToDeviceRequest actualRequest = ((SendCommandToDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(name.toString(), actualRequest.getName()); - Assert.assertEquals(binaryData, actualRequest.getBinaryData()); - Assert.assertEquals(subfolder, actualRequest.getSubfolder()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void sendCommandToDeviceExceptionTest3() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - client.sendCommandToDevice(name, binaryData, subfolder); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void sendCommandToDeviceTest4() throws Exception { - SendCommandToDeviceResponse expectedResponse = SendCommandToDeviceResponse.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - String name = "name3373707"; - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - - SendCommandToDeviceResponse actualResponse = - client.sendCommandToDevice(name, binaryData, subfolder); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - SendCommandToDeviceRequest actualRequest = ((SendCommandToDeviceRequest) actualRequests.get(0)); - - Assert.assertEquals(name, actualRequest.getName()); - Assert.assertEquals(binaryData, actualRequest.getBinaryData()); - Assert.assertEquals(subfolder, actualRequest.getSubfolder()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void sendCommandToDeviceExceptionTest4() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String name = "name3373707"; - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - client.sendCommandToDevice(name, binaryData, subfolder); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void bindDeviceToGatewayTest() throws Exception { - BindDeviceToGatewayResponse expectedResponse = BindDeviceToGatewayResponse.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - - BindDeviceToGatewayResponse actualResponse = - client.bindDeviceToGateway(parent, gatewayId, deviceId); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - BindDeviceToGatewayRequest actualRequest = ((BindDeviceToGatewayRequest) actualRequests.get(0)); - - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(gatewayId, actualRequest.getGatewayId()); - Assert.assertEquals(deviceId, actualRequest.getDeviceId()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void bindDeviceToGatewayExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - client.bindDeviceToGateway(parent, gatewayId, deviceId); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void bindDeviceToGatewayTest2() throws Exception { - BindDeviceToGatewayResponse expectedResponse = BindDeviceToGatewayResponse.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - String parent = "parent-995424086"; - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - - BindDeviceToGatewayResponse actualResponse = - client.bindDeviceToGateway(parent, gatewayId, deviceId); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - BindDeviceToGatewayRequest actualRequest = ((BindDeviceToGatewayRequest) actualRequests.get(0)); - - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(gatewayId, actualRequest.getGatewayId()); - Assert.assertEquals(deviceId, actualRequest.getDeviceId()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void bindDeviceToGatewayExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String parent = "parent-995424086"; - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - client.bindDeviceToGateway(parent, gatewayId, deviceId); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void unbindDeviceFromGatewayTest() throws Exception { - UnbindDeviceFromGatewayResponse expectedResponse = - UnbindDeviceFromGatewayResponse.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - - UnbindDeviceFromGatewayResponse actualResponse = - client.unbindDeviceFromGateway(parent, gatewayId, deviceId); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - UnbindDeviceFromGatewayRequest actualRequest = - ((UnbindDeviceFromGatewayRequest) actualRequests.get(0)); - - Assert.assertEquals(parent.toString(), actualRequest.getParent()); - Assert.assertEquals(gatewayId, actualRequest.getGatewayId()); - Assert.assertEquals(deviceId, actualRequest.getDeviceId()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void unbindDeviceFromGatewayExceptionTest() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - client.unbindDeviceFromGateway(parent, gatewayId, deviceId); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } - - @Test - public void unbindDeviceFromGatewayTest2() throws Exception { - UnbindDeviceFromGatewayResponse expectedResponse = - UnbindDeviceFromGatewayResponse.newBuilder().build(); - mockDeviceManager.addResponse(expectedResponse); - - String parent = "parent-995424086"; - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - - UnbindDeviceFromGatewayResponse actualResponse = - client.unbindDeviceFromGateway(parent, gatewayId, deviceId); - Assert.assertEquals(expectedResponse, actualResponse); - - List actualRequests = mockDeviceManager.getRequests(); - Assert.assertEquals(1, actualRequests.size()); - UnbindDeviceFromGatewayRequest actualRequest = - ((UnbindDeviceFromGatewayRequest) actualRequests.get(0)); - - Assert.assertEquals(parent, actualRequest.getParent()); - Assert.assertEquals(gatewayId, actualRequest.getGatewayId()); - Assert.assertEquals(deviceId, actualRequest.getDeviceId()); - Assert.assertTrue( - channelProvider.isHeaderSent( - ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), - GaxGrpcProperties.getDefaultApiClientHeaderPattern())); - } - - @Test - public void unbindDeviceFromGatewayExceptionTest2() throws Exception { - StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); - mockDeviceManager.addException(exception); - - try { - String parent = "parent-995424086"; - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - client.unbindDeviceFromGateway(parent, gatewayId, deviceId); - Assert.fail("No exception raised"); - } catch (InvalidArgumentException e) { - // Expected exception. - } - } -} diff --git a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/MockDeviceManager.java b/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/MockDeviceManager.java deleted file mode 100644 index 5da71a7a..00000000 --- a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/MockDeviceManager.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.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 MockDeviceManager implements MockGrpcService { - private final MockDeviceManagerImpl serviceImpl; - - public MockDeviceManager() { - serviceImpl = new MockDeviceManagerImpl(); - } - - @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-iot/src/test/java/com/google/cloud/iot/v1/MockDeviceManagerImpl.java b/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/MockDeviceManagerImpl.java deleted file mode 100644 index f137ef47..00000000 --- a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/MockDeviceManagerImpl.java +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1; - -import com.google.api.core.BetaApi; -import com.google.cloud.iot.v1.DeviceManagerGrpc.DeviceManagerImplBase; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import com.google.protobuf.AbstractMessage; -import com.google.protobuf.Empty; -import io.grpc.stub.StreamObserver; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import javax.annotation.Generated; - -@BetaApi -@Generated("by gapic-generator-java") -public class MockDeviceManagerImpl extends DeviceManagerImplBase { - private List requests; - private Queue responses; - - public MockDeviceManagerImpl() { - 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 createDeviceRegistry( - CreateDeviceRegistryRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof DeviceRegistry) { - requests.add(request); - responseObserver.onNext(((DeviceRegistry) 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 CreateDeviceRegistry, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - DeviceRegistry.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void getDeviceRegistry( - GetDeviceRegistryRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof DeviceRegistry) { - requests.add(request); - responseObserver.onNext(((DeviceRegistry) 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 GetDeviceRegistry, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - DeviceRegistry.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void updateDeviceRegistry( - UpdateDeviceRegistryRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof DeviceRegistry) { - requests.add(request); - responseObserver.onNext(((DeviceRegistry) 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 UpdateDeviceRegistry, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - DeviceRegistry.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void deleteDeviceRegistry( - DeleteDeviceRegistryRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Empty) { - requests.add(request); - responseObserver.onNext(((Empty) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method DeleteDeviceRegistry, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Empty.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void listDeviceRegistries( - ListDeviceRegistriesRequest request, - StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof ListDeviceRegistriesResponse) { - requests.add(request); - responseObserver.onNext(((ListDeviceRegistriesResponse) 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 ListDeviceRegistries, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - ListDeviceRegistriesResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void createDevice(CreateDeviceRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Device) { - requests.add(request); - responseObserver.onNext(((Device) 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 CreateDevice, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Device.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void getDevice(GetDeviceRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Device) { - requests.add(request); - responseObserver.onNext(((Device) 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 GetDevice, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Device.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void updateDevice(UpdateDeviceRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Device) { - requests.add(request); - responseObserver.onNext(((Device) 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 UpdateDevice, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Device.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void deleteDevice(DeleteDeviceRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Empty) { - requests.add(request); - responseObserver.onNext(((Empty) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method DeleteDevice, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Empty.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void listDevices( - ListDevicesRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof ListDevicesResponse) { - requests.add(request); - responseObserver.onNext(((ListDevicesResponse) 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 ListDevices, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - ListDevicesResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void modifyCloudToDeviceConfig( - ModifyCloudToDeviceConfigRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof DeviceConfig) { - requests.add(request); - responseObserver.onNext(((DeviceConfig) 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 ModifyCloudToDeviceConfig, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - DeviceConfig.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void listDeviceConfigVersions( - ListDeviceConfigVersionsRequest request, - StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof ListDeviceConfigVersionsResponse) { - requests.add(request); - responseObserver.onNext(((ListDeviceConfigVersionsResponse) 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 ListDeviceConfigVersions, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - ListDeviceConfigVersionsResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void listDeviceStates( - ListDeviceStatesRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof ListDeviceStatesResponse) { - requests.add(request); - responseObserver.onNext(((ListDeviceStatesResponse) 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 ListDeviceStates, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - ListDeviceStatesResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Policy) { - requests.add(request); - responseObserver.onNext(((Policy) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method SetIamPolicy, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Policy.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof Policy) { - requests.add(request); - responseObserver.onNext(((Policy) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method GetIamPolicy, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - Policy.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void testIamPermissions( - TestIamPermissionsRequest request, - StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof TestIamPermissionsResponse) { - requests.add(request); - responseObserver.onNext(((TestIamPermissionsResponse) response)); - responseObserver.onCompleted(); - } else if (response instanceof Exception) { - responseObserver.onError(((Exception) response)); - } else { - responseObserver.onError( - new IllegalArgumentException( - String.format( - "Unrecognized response type %s for method TestIamPermissions, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - TestIamPermissionsResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void sendCommandToDevice( - SendCommandToDeviceRequest request, - StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof SendCommandToDeviceResponse) { - requests.add(request); - responseObserver.onNext(((SendCommandToDeviceResponse) 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 SendCommandToDevice, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - SendCommandToDeviceResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void bindDeviceToGateway( - BindDeviceToGatewayRequest request, - StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof BindDeviceToGatewayResponse) { - requests.add(request); - responseObserver.onNext(((BindDeviceToGatewayResponse) 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 BindDeviceToGateway, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - BindDeviceToGatewayResponse.class.getName(), - Exception.class.getName()))); - } - } - - @Override - public void unbindDeviceFromGateway( - UnbindDeviceFromGatewayRequest request, - StreamObserver responseObserver) { - Object response = responses.poll(); - if (response instanceof UnbindDeviceFromGatewayResponse) { - requests.add(request); - responseObserver.onNext(((UnbindDeviceFromGatewayResponse) 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 UnbindDeviceFromGateway, expected %s or %s", - response == null ? "null" : response.getClass().getName(), - UnbindDeviceFromGatewayResponse.class.getName(), - Exception.class.getName()))); - } - } -} diff --git a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/it/ITSystemTest.java b/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/it/ITSystemTest.java deleted file mode 100644 index 0c683327..00000000 --- a/google-cloud-iot/src/test/java/com/google/cloud/iot/v1/it/ITSystemTest.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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 - * - * 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.iot.v1.it; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import com.google.cloud.ServiceOptions; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceManagerClient.ListDeviceRegistriesPagedResponse; -import com.google.cloud.iot.v1.DeviceManagerClient.ListDevicesPagedResponse; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.DeviceState; -import com.google.cloud.iot.v1.GatewayAuthMethod; -import com.google.cloud.iot.v1.GatewayConfig; -import com.google.cloud.iot.v1.HttpConfig; -import com.google.cloud.iot.v1.HttpState; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; -import com.google.cloud.iot.v1.LocationName; -import com.google.cloud.iot.v1.MqttConfig; -import com.google.cloud.iot.v1.MqttState; -import com.google.cloud.iot.v1.RegistryName; -import com.google.common.collect.Lists; -import com.google.iam.v1.Policy; -import com.google.protobuf.ByteString; -import java.util.List; -import java.util.UUID; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; - -public class ITSystemTest { - - private static DeviceManagerClient client; - private static DeviceRegistry deviceRegistry; - private static Device device; - - private static final String PROJECT_ID = ServiceOptions.getDefaultProjectId(); - private static final String LOCATION = "us-central1"; - private static final String REGISTRY_ID = "test" + UUID.randomUUID().toString().substring(0, 8); - private static final RegistryName REGISTRY_NAME = - RegistryName.of(PROJECT_ID, LOCATION, REGISTRY_ID); - private static final LocationName PARENT = LocationName.of(PROJECT_ID, LOCATION); - private static final MqttConfig MQTT_CONFIG = - MqttConfig.newBuilder().setMqttEnabledState(MqttState.MQTT_ENABLED).build(); - private static final HttpConfig HTTP_CONFIG = - HttpConfig.newBuilder().setHttpEnabledState(HttpState.HTTP_ENABLED).build(); - private static final DeviceRegistry DEVICE_REGISTRY = - DeviceRegistry.newBuilder() - .setId(REGISTRY_ID) - .setMqttConfig(MQTT_CONFIG) - .setHttpConfig(HTTP_CONFIG) - .build(); - private static final String DEVICE_ID = - "test-device-" + UUID.randomUUID().toString().substring(0, 8); - private static final DeviceName DEVICE_NAME = - DeviceName.of(PROJECT_ID, LOCATION, REGISTRY_ID, DEVICE_ID); - private static final DeviceState DEVICE_STATE = - DeviceState.newBuilder().setBinaryData(ByteString.EMPTY).build(); - private static final boolean BLOCKED = true; - private static final GatewayConfig GATEWAY_CONFIG = - GatewayConfig.newBuilder() - .setGatewayAuthMethod(GatewayAuthMethod.ASSOCIATION_AND_DEVICE_AUTH_TOKEN) - .build(); - private static final Device DEVICE = - Device.newBuilder() - .setId(DEVICE_ID) - .setBlocked(BLOCKED) - .setGatewayConfig(GATEWAY_CONFIG) - .setState(DEVICE_STATE) - .build(); - - @BeforeClass - public static void beforeTest() throws Exception { - client = DeviceManagerClient.create(); - deviceRegistry = client.createDeviceRegistry(PARENT, DEVICE_REGISTRY); - if (deviceRegistry != null) { - RegistryName parent = RegistryName.of(PROJECT_ID, LOCATION, REGISTRY_ID); - device = client.createDevice(parent, DEVICE); - } - } - - @AfterClass - public static void afterTest() { - if (device != null) { - client.deleteDevice(DEVICE_NAME); - } - if (deviceRegistry != null) { - client.deleteDeviceRegistry(REGISTRY_NAME); - } - client.close(); - } - - @Test - public void getDeviceRegistryTest() { - DeviceRegistry registry = client.getDeviceRegistry(REGISTRY_NAME); - assertEquals(REGISTRY_ID, registry.getId()); - assertEquals(MQTT_CONFIG, registry.getMqttConfig()); - assertEquals(HTTP_CONFIG, registry.getHttpConfig()); - } - - @Test - public void listDeviceRegistryTest() { - ListDeviceRegistriesPagedResponse pagedListResponse = client.listDeviceRegistries(PARENT); - List resources = Lists.newArrayList(pagedListResponse.iterateAll()); - for (DeviceRegistry registry : resources) { - if (registry.equals(REGISTRY_ID)) { - assertEquals(REGISTRY_ID, registry.getId()); - assertEquals(MQTT_CONFIG, registry.getMqttConfig()); - assertEquals(HTTP_CONFIG, registry.getHttpConfig()); - } - } - } - - @Test - public void getDeviceTest() { - Device device = client.getDevice(DEVICE_NAME); - assertEquals(DEVICE_ID, device.getId()); - assertEquals(BLOCKED, device.getBlocked()); - assertEquals(GATEWAY_CONFIG, device.getGatewayConfig()); - } - - @Test - public void listDeviceTest() { - ListDevicesPagedResponse listDevices = client.listDevices(REGISTRY_NAME); - List devices = Lists.newArrayList(listDevices.iterateAll()); - assertEquals(1, devices.size()); - for (Device device : devices) { - if (device.equals(DEVICE_ID)) { - assertEquals(DEVICE_ID, device.getId()); - assertEquals(BLOCKED, device.getBlocked()); - assertEquals(GATEWAY_CONFIG, device.getGatewayConfig()); - } - } - } - - @Test - public void listDeviceStatesTest() { - ListDeviceStatesResponse deviceStates = client.listDeviceStates(DEVICE_NAME); - List devices = deviceStates.getDeviceStatesList(); - assertEquals(0, devices.size()); - } - - @Test - public void listDeviceConfigVersionsTest() { - ListDeviceConfigVersionsResponse deviceConfigVersions = - client.listDeviceConfigVersions(DEVICE_NAME); - List devicesConfigs = deviceConfigVersions.getDeviceConfigsList(); - assertEquals(1, devicesConfigs.size()); - for (DeviceConfig devicesConfig : devicesConfigs) { - assertEquals(1, devicesConfig.getVersion()); - } - } - - @Test - public void getIamPolicyTest() { - Policy policy = client.getIamPolicy(REGISTRY_NAME); - assertNotNull(policy); - assertEquals(0, policy.getVersion()); - } -} diff --git a/grpc-google-cloud-iot-v1/pom.xml b/grpc-google-cloud-iot-v1/pom.xml deleted file mode 100644 index 11787888..00000000 --- a/grpc-google-cloud-iot-v1/pom.xml +++ /dev/null @@ -1,69 +0,0 @@ - - 4.0.0 - com.google.api.grpc - grpc-google-cloud-iot-v1 - 2.3.5 - grpc-google-cloud-iot-v1 - GRPC library for grpc-google-cloud-iot-v1 - - com.google.cloud - google-cloud-iot-parent - 2.3.5 - - - - io.grpc - grpc-api - - - io.grpc - grpc-stub - - - io.grpc - grpc-protobuf - - - com.google.protobuf - protobuf-java - - - com.google.api.grpc - proto-google-cloud-iot-v1 - - - com.google.api.grpc - proto-google-iam-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-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceManagerGrpc.java b/grpc-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceManagerGrpc.java deleted file mode 100644 index 81c87170..00000000 --- a/grpc-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceManagerGrpc.java +++ /dev/null @@ -1,2533 +0,0 @@ -/* - * 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.iot.v1; - -import static io.grpc.MethodDescriptor.generateFullMethodName; - -/** - * - * - *
- * Internet of Things (IoT) service. Securely connect and manage IoT devices.
- * 
- */ -@javax.annotation.Generated( - value = "by gRPC proto compiler", - comments = "Source: google/cloud/iot/v1/device_manager.proto") -@io.grpc.stub.annotations.GrpcGenerated -public final class DeviceManagerGrpc { - - private DeviceManagerGrpc() {} - - public static final String SERVICE_NAME = "google.cloud.iot.v1.DeviceManager"; - - // Static method descriptors that strictly reflect the proto. - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.CreateDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry> - getCreateDeviceRegistryMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "CreateDeviceRegistry", - requestType = com.google.cloud.iot.v1.CreateDeviceRegistryRequest.class, - responseType = com.google.cloud.iot.v1.DeviceRegistry.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.CreateDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry> - getCreateDeviceRegistryMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.CreateDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry> - getCreateDeviceRegistryMethod; - if ((getCreateDeviceRegistryMethod = DeviceManagerGrpc.getCreateDeviceRegistryMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getCreateDeviceRegistryMethod = DeviceManagerGrpc.getCreateDeviceRegistryMethod) - == null) { - DeviceManagerGrpc.getCreateDeviceRegistryMethod = - getCreateDeviceRegistryMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "CreateDeviceRegistry")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.CreateDeviceRegistryRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("CreateDeviceRegistry")) - .build(); - } - } - } - return getCreateDeviceRegistryMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.GetDeviceRegistryRequest, com.google.cloud.iot.v1.DeviceRegistry> - getGetDeviceRegistryMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "GetDeviceRegistry", - requestType = com.google.cloud.iot.v1.GetDeviceRegistryRequest.class, - responseType = com.google.cloud.iot.v1.DeviceRegistry.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.GetDeviceRegistryRequest, com.google.cloud.iot.v1.DeviceRegistry> - getGetDeviceRegistryMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.GetDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry> - getGetDeviceRegistryMethod; - if ((getGetDeviceRegistryMethod = DeviceManagerGrpc.getGetDeviceRegistryMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getGetDeviceRegistryMethod = DeviceManagerGrpc.getGetDeviceRegistryMethod) == null) { - DeviceManagerGrpc.getGetDeviceRegistryMethod = - getGetDeviceRegistryMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetDeviceRegistry")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.GetDeviceRegistryRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("GetDeviceRegistry")) - .build(); - } - } - } - return getGetDeviceRegistryMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry> - getUpdateDeviceRegistryMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "UpdateDeviceRegistry", - requestType = com.google.cloud.iot.v1.UpdateDeviceRegistryRequest.class, - responseType = com.google.cloud.iot.v1.DeviceRegistry.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry> - getUpdateDeviceRegistryMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry> - getUpdateDeviceRegistryMethod; - if ((getUpdateDeviceRegistryMethod = DeviceManagerGrpc.getUpdateDeviceRegistryMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getUpdateDeviceRegistryMethod = DeviceManagerGrpc.getUpdateDeviceRegistryMethod) - == null) { - DeviceManagerGrpc.getUpdateDeviceRegistryMethod = - getUpdateDeviceRegistryMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "UpdateDeviceRegistry")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("UpdateDeviceRegistry")) - .build(); - } - } - } - return getUpdateDeviceRegistryMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest, com.google.protobuf.Empty> - getDeleteDeviceRegistryMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "DeleteDeviceRegistry", - requestType = com.google.cloud.iot.v1.DeleteDeviceRegistryRequest.class, - responseType = com.google.protobuf.Empty.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest, com.google.protobuf.Empty> - getDeleteDeviceRegistryMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest, com.google.protobuf.Empty> - getDeleteDeviceRegistryMethod; - if ((getDeleteDeviceRegistryMethod = DeviceManagerGrpc.getDeleteDeviceRegistryMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getDeleteDeviceRegistryMethod = DeviceManagerGrpc.getDeleteDeviceRegistryMethod) - == null) { - DeviceManagerGrpc.getDeleteDeviceRegistryMethod = - getDeleteDeviceRegistryMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "DeleteDeviceRegistry")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.protobuf.Empty.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("DeleteDeviceRegistry")) - .build(); - } - } - } - return getDeleteDeviceRegistryMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceRegistriesRequest, - com.google.cloud.iot.v1.ListDeviceRegistriesResponse> - getListDeviceRegistriesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ListDeviceRegistries", - requestType = com.google.cloud.iot.v1.ListDeviceRegistriesRequest.class, - responseType = com.google.cloud.iot.v1.ListDeviceRegistriesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceRegistriesRequest, - com.google.cloud.iot.v1.ListDeviceRegistriesResponse> - getListDeviceRegistriesMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceRegistriesRequest, - com.google.cloud.iot.v1.ListDeviceRegistriesResponse> - getListDeviceRegistriesMethod; - if ((getListDeviceRegistriesMethod = DeviceManagerGrpc.getListDeviceRegistriesMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getListDeviceRegistriesMethod = DeviceManagerGrpc.getListDeviceRegistriesMethod) - == null) { - DeviceManagerGrpc.getListDeviceRegistriesMethod = - getListDeviceRegistriesMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "ListDeviceRegistries")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ListDeviceRegistriesRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ListDeviceRegistriesResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("ListDeviceRegistries")) - .build(); - } - } - } - return getListDeviceRegistriesMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.CreateDeviceRequest, com.google.cloud.iot.v1.Device> - getCreateDeviceMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "CreateDevice", - requestType = com.google.cloud.iot.v1.CreateDeviceRequest.class, - responseType = com.google.cloud.iot.v1.Device.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.CreateDeviceRequest, com.google.cloud.iot.v1.Device> - getCreateDeviceMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.CreateDeviceRequest, com.google.cloud.iot.v1.Device> - getCreateDeviceMethod; - if ((getCreateDeviceMethod = DeviceManagerGrpc.getCreateDeviceMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getCreateDeviceMethod = DeviceManagerGrpc.getCreateDeviceMethod) == null) { - DeviceManagerGrpc.getCreateDeviceMethod = - getCreateDeviceMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateDevice")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.CreateDeviceRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.Device.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("CreateDevice")) - .build(); - } - } - } - return getCreateDeviceMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.GetDeviceRequest, com.google.cloud.iot.v1.Device> - getGetDeviceMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "GetDevice", - requestType = com.google.cloud.iot.v1.GetDeviceRequest.class, - responseType = com.google.cloud.iot.v1.Device.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.GetDeviceRequest, com.google.cloud.iot.v1.Device> - getGetDeviceMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.GetDeviceRequest, com.google.cloud.iot.v1.Device> - getGetDeviceMethod; - if ((getGetDeviceMethod = DeviceManagerGrpc.getGetDeviceMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getGetDeviceMethod = DeviceManagerGrpc.getGetDeviceMethod) == null) { - DeviceManagerGrpc.getGetDeviceMethod = - getGetDeviceMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetDevice")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.GetDeviceRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.Device.getDefaultInstance())) - .setSchemaDescriptor(new DeviceManagerMethodDescriptorSupplier("GetDevice")) - .build(); - } - } - } - return getGetDeviceMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UpdateDeviceRequest, com.google.cloud.iot.v1.Device> - getUpdateDeviceMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "UpdateDevice", - requestType = com.google.cloud.iot.v1.UpdateDeviceRequest.class, - responseType = com.google.cloud.iot.v1.Device.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UpdateDeviceRequest, com.google.cloud.iot.v1.Device> - getUpdateDeviceMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UpdateDeviceRequest, com.google.cloud.iot.v1.Device> - getUpdateDeviceMethod; - if ((getUpdateDeviceMethod = DeviceManagerGrpc.getUpdateDeviceMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getUpdateDeviceMethod = DeviceManagerGrpc.getUpdateDeviceMethod) == null) { - DeviceManagerGrpc.getUpdateDeviceMethod = - getUpdateDeviceMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "UpdateDevice")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.UpdateDeviceRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.Device.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("UpdateDevice")) - .build(); - } - } - } - return getUpdateDeviceMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.DeleteDeviceRequest, com.google.protobuf.Empty> - getDeleteDeviceMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "DeleteDevice", - requestType = com.google.cloud.iot.v1.DeleteDeviceRequest.class, - responseType = com.google.protobuf.Empty.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.DeleteDeviceRequest, com.google.protobuf.Empty> - getDeleteDeviceMethod() { - io.grpc.MethodDescriptor - getDeleteDeviceMethod; - if ((getDeleteDeviceMethod = DeviceManagerGrpc.getDeleteDeviceMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getDeleteDeviceMethod = DeviceManagerGrpc.getDeleteDeviceMethod) == null) { - DeviceManagerGrpc.getDeleteDeviceMethod = - getDeleteDeviceMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteDevice")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.DeleteDeviceRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.protobuf.Empty.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("DeleteDevice")) - .build(); - } - } - } - return getDeleteDeviceMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDevicesRequest, com.google.cloud.iot.v1.ListDevicesResponse> - getListDevicesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ListDevices", - requestType = com.google.cloud.iot.v1.ListDevicesRequest.class, - responseType = com.google.cloud.iot.v1.ListDevicesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDevicesRequest, com.google.cloud.iot.v1.ListDevicesResponse> - getListDevicesMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDevicesRequest, com.google.cloud.iot.v1.ListDevicesResponse> - getListDevicesMethod; - if ((getListDevicesMethod = DeviceManagerGrpc.getListDevicesMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getListDevicesMethod = DeviceManagerGrpc.getListDevicesMethod) == null) { - DeviceManagerGrpc.getListDevicesMethod = - getListDevicesMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListDevices")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ListDevicesRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ListDevicesResponse.getDefaultInstance())) - .setSchemaDescriptor(new DeviceManagerMethodDescriptorSupplier("ListDevices")) - .build(); - } - } - } - return getListDevicesMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest, - com.google.cloud.iot.v1.DeviceConfig> - getModifyCloudToDeviceConfigMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ModifyCloudToDeviceConfig", - requestType = com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.class, - responseType = com.google.cloud.iot.v1.DeviceConfig.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest, - com.google.cloud.iot.v1.DeviceConfig> - getModifyCloudToDeviceConfigMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest, - com.google.cloud.iot.v1.DeviceConfig> - getModifyCloudToDeviceConfigMethod; - if ((getModifyCloudToDeviceConfigMethod = DeviceManagerGrpc.getModifyCloudToDeviceConfigMethod) - == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getModifyCloudToDeviceConfigMethod = - DeviceManagerGrpc.getModifyCloudToDeviceConfigMethod) - == null) { - DeviceManagerGrpc.getModifyCloudToDeviceConfigMethod = - getModifyCloudToDeviceConfigMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "ModifyCloudToDeviceConfig")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.DeviceConfig.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("ModifyCloudToDeviceConfig")) - .build(); - } - } - } - return getModifyCloudToDeviceConfigMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest, - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse> - getListDeviceConfigVersionsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ListDeviceConfigVersions", - requestType = com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest.class, - responseType = com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest, - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse> - getListDeviceConfigVersionsMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest, - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse> - getListDeviceConfigVersionsMethod; - if ((getListDeviceConfigVersionsMethod = DeviceManagerGrpc.getListDeviceConfigVersionsMethod) - == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getListDeviceConfigVersionsMethod = - DeviceManagerGrpc.getListDeviceConfigVersionsMethod) - == null) { - DeviceManagerGrpc.getListDeviceConfigVersionsMethod = - getListDeviceConfigVersionsMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "ListDeviceConfigVersions")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("ListDeviceConfigVersions")) - .build(); - } - } - } - return getListDeviceConfigVersionsMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceStatesRequest, - com.google.cloud.iot.v1.ListDeviceStatesResponse> - getListDeviceStatesMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "ListDeviceStates", - requestType = com.google.cloud.iot.v1.ListDeviceStatesRequest.class, - responseType = com.google.cloud.iot.v1.ListDeviceStatesResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceStatesRequest, - com.google.cloud.iot.v1.ListDeviceStatesResponse> - getListDeviceStatesMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.ListDeviceStatesRequest, - com.google.cloud.iot.v1.ListDeviceStatesResponse> - getListDeviceStatesMethod; - if ((getListDeviceStatesMethod = DeviceManagerGrpc.getListDeviceStatesMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getListDeviceStatesMethod = DeviceManagerGrpc.getListDeviceStatesMethod) == null) { - DeviceManagerGrpc.getListDeviceStatesMethod = - getListDeviceStatesMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListDeviceStates")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ListDeviceStatesRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.ListDeviceStatesResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("ListDeviceStates")) - .build(); - } - } - } - return getListDeviceStatesMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> - getSetIamPolicyMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "SetIamPolicy", - requestType = com.google.iam.v1.SetIamPolicyRequest.class, - responseType = com.google.iam.v1.Policy.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> - getSetIamPolicyMethod() { - io.grpc.MethodDescriptor - getSetIamPolicyMethod; - if ((getSetIamPolicyMethod = DeviceManagerGrpc.getSetIamPolicyMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getSetIamPolicyMethod = DeviceManagerGrpc.getSetIamPolicyMethod) == null) { - DeviceManagerGrpc.getSetIamPolicyMethod = - getSetIamPolicyMethod = - io.grpc.MethodDescriptor - .newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetIamPolicy")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.iam.v1.SetIamPolicyRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.iam.v1.Policy.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("SetIamPolicy")) - .build(); - } - } - } - return getSetIamPolicyMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> - getGetIamPolicyMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "GetIamPolicy", - requestType = com.google.iam.v1.GetIamPolicyRequest.class, - responseType = com.google.iam.v1.Policy.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> - getGetIamPolicyMethod() { - io.grpc.MethodDescriptor - getGetIamPolicyMethod; - if ((getGetIamPolicyMethod = DeviceManagerGrpc.getGetIamPolicyMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getGetIamPolicyMethod = DeviceManagerGrpc.getGetIamPolicyMethod) == null) { - DeviceManagerGrpc.getGetIamPolicyMethod = - getGetIamPolicyMethod = - io.grpc.MethodDescriptor - .newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetIamPolicy")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.iam.v1.Policy.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("GetIamPolicy")) - .build(); - } - } - } - return getGetIamPolicyMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> - getTestIamPermissionsMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "TestIamPermissions", - requestType = com.google.iam.v1.TestIamPermissionsRequest.class, - responseType = com.google.iam.v1.TestIamPermissionsResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> - getTestIamPermissionsMethod() { - io.grpc.MethodDescriptor< - com.google.iam.v1.TestIamPermissionsRequest, - com.google.iam.v1.TestIamPermissionsResponse> - getTestIamPermissionsMethod; - if ((getTestIamPermissionsMethod = DeviceManagerGrpc.getTestIamPermissionsMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getTestIamPermissionsMethod = DeviceManagerGrpc.getTestIamPermissionsMethod) == null) { - DeviceManagerGrpc.getTestIamPermissionsMethod = - getTestIamPermissionsMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName(generateFullMethodName(SERVICE_NAME, "TestIamPermissions")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.iam.v1.TestIamPermissionsRequest.getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.iam.v1.TestIamPermissionsResponse.getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("TestIamPermissions")) - .build(); - } - } - } - return getTestIamPermissionsMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.SendCommandToDeviceRequest, - com.google.cloud.iot.v1.SendCommandToDeviceResponse> - getSendCommandToDeviceMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "SendCommandToDevice", - requestType = com.google.cloud.iot.v1.SendCommandToDeviceRequest.class, - responseType = com.google.cloud.iot.v1.SendCommandToDeviceResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.SendCommandToDeviceRequest, - com.google.cloud.iot.v1.SendCommandToDeviceResponse> - getSendCommandToDeviceMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.SendCommandToDeviceRequest, - com.google.cloud.iot.v1.SendCommandToDeviceResponse> - getSendCommandToDeviceMethod; - if ((getSendCommandToDeviceMethod = DeviceManagerGrpc.getSendCommandToDeviceMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getSendCommandToDeviceMethod = DeviceManagerGrpc.getSendCommandToDeviceMethod) - == null) { - DeviceManagerGrpc.getSendCommandToDeviceMethod = - getSendCommandToDeviceMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "SendCommandToDevice")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.SendCommandToDeviceRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.SendCommandToDeviceResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("SendCommandToDevice")) - .build(); - } - } - } - return getSendCommandToDeviceMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.BindDeviceToGatewayRequest, - com.google.cloud.iot.v1.BindDeviceToGatewayResponse> - getBindDeviceToGatewayMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "BindDeviceToGateway", - requestType = com.google.cloud.iot.v1.BindDeviceToGatewayRequest.class, - responseType = com.google.cloud.iot.v1.BindDeviceToGatewayResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.BindDeviceToGatewayRequest, - com.google.cloud.iot.v1.BindDeviceToGatewayResponse> - getBindDeviceToGatewayMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.BindDeviceToGatewayRequest, - com.google.cloud.iot.v1.BindDeviceToGatewayResponse> - getBindDeviceToGatewayMethod; - if ((getBindDeviceToGatewayMethod = DeviceManagerGrpc.getBindDeviceToGatewayMethod) == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getBindDeviceToGatewayMethod = DeviceManagerGrpc.getBindDeviceToGatewayMethod) - == null) { - DeviceManagerGrpc.getBindDeviceToGatewayMethod = - getBindDeviceToGatewayMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "BindDeviceToGateway")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.BindDeviceToGatewayRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.BindDeviceToGatewayResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("BindDeviceToGateway")) - .build(); - } - } - } - return getBindDeviceToGatewayMethod; - } - - private static volatile io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest, - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse> - getUnbindDeviceFromGatewayMethod; - - @io.grpc.stub.annotations.RpcMethod( - fullMethodName = SERVICE_NAME + '/' + "UnbindDeviceFromGateway", - requestType = com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest.class, - responseType = com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse.class, - methodType = io.grpc.MethodDescriptor.MethodType.UNARY) - public static io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest, - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse> - getUnbindDeviceFromGatewayMethod() { - io.grpc.MethodDescriptor< - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest, - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse> - getUnbindDeviceFromGatewayMethod; - if ((getUnbindDeviceFromGatewayMethod = DeviceManagerGrpc.getUnbindDeviceFromGatewayMethod) - == null) { - synchronized (DeviceManagerGrpc.class) { - if ((getUnbindDeviceFromGatewayMethod = DeviceManagerGrpc.getUnbindDeviceFromGatewayMethod) - == null) { - DeviceManagerGrpc.getUnbindDeviceFromGatewayMethod = - getUnbindDeviceFromGatewayMethod = - io.grpc.MethodDescriptor - . - newBuilder() - .setType(io.grpc.MethodDescriptor.MethodType.UNARY) - .setFullMethodName( - generateFullMethodName(SERVICE_NAME, "UnbindDeviceFromGateway")) - .setSampledToLocalTracing(true) - .setRequestMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest - .getDefaultInstance())) - .setResponseMarshaller( - io.grpc.protobuf.ProtoUtils.marshaller( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse - .getDefaultInstance())) - .setSchemaDescriptor( - new DeviceManagerMethodDescriptorSupplier("UnbindDeviceFromGateway")) - .build(); - } - } - } - return getUnbindDeviceFromGatewayMethod; - } - - /** Creates a new async stub that supports all call types for the service */ - public static DeviceManagerStub newStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DeviceManagerStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DeviceManagerStub(channel, callOptions); - } - }; - return DeviceManagerStub.newStub(factory, channel); - } - - /** - * Creates a new blocking-style stub that supports unary and streaming output calls on the service - */ - public static DeviceManagerBlockingStub newBlockingStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DeviceManagerBlockingStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DeviceManagerBlockingStub(channel, callOptions); - } - }; - return DeviceManagerBlockingStub.newStub(factory, channel); - } - - /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ - public static DeviceManagerFutureStub newFutureStub(io.grpc.Channel channel) { - io.grpc.stub.AbstractStub.StubFactory factory = - new io.grpc.stub.AbstractStub.StubFactory() { - @java.lang.Override - public DeviceManagerFutureStub newStub( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DeviceManagerFutureStub(channel, callOptions); - } - }; - return DeviceManagerFutureStub.newStub(factory, channel); - } - - /** - * - * - *
-   * Internet of Things (IoT) service. Securely connect and manage IoT devices.
-   * 
- */ - public abstract static class DeviceManagerImplBase implements io.grpc.BindableService { - - /** - * - * - *
-     * Creates a device registry that contains devices.
-     * 
- */ - public void createDeviceRegistry( - com.google.cloud.iot.v1.CreateDeviceRegistryRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getCreateDeviceRegistryMethod(), responseObserver); - } - - /** - * - * - *
-     * Gets a device registry configuration.
-     * 
- */ - public void getDeviceRegistry( - com.google.cloud.iot.v1.GetDeviceRegistryRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getGetDeviceRegistryMethod(), responseObserver); - } - - /** - * - * - *
-     * Updates a device registry configuration.
-     * 
- */ - public void updateDeviceRegistry( - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getUpdateDeviceRegistryMethod(), responseObserver); - } - - /** - * - * - *
-     * Deletes a device registry configuration.
-     * 
- */ - public void deleteDeviceRegistry( - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getDeleteDeviceRegistryMethod(), responseObserver); - } - - /** - * - * - *
-     * Lists device registries.
-     * 
- */ - public void listDeviceRegistries( - com.google.cloud.iot.v1.ListDeviceRegistriesRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getListDeviceRegistriesMethod(), responseObserver); - } - - /** - * - * - *
-     * Creates a device in a device registry.
-     * 
- */ - public void createDevice( - com.google.cloud.iot.v1.CreateDeviceRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getCreateDeviceMethod(), responseObserver); - } - - /** - * - * - *
-     * Gets details about a device.
-     * 
- */ - public void getDevice( - com.google.cloud.iot.v1.GetDeviceRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetDeviceMethod(), responseObserver); - } - - /** - * - * - *
-     * Updates a device.
-     * 
- */ - public void updateDevice( - com.google.cloud.iot.v1.UpdateDeviceRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getUpdateDeviceMethod(), responseObserver); - } - - /** - * - * - *
-     * Deletes a device.
-     * 
- */ - public void deleteDevice( - com.google.cloud.iot.v1.DeleteDeviceRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getDeleteDeviceMethod(), responseObserver); - } - - /** - * - * - *
-     * List devices in a device registry.
-     * 
- */ - public void listDevices( - com.google.cloud.iot.v1.ListDevicesRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getListDevicesMethod(), responseObserver); - } - - /** - * - * - *
-     * Modifies the configuration for the device, which is eventually sent from
-     * the Cloud IoT Core servers. Returns the modified configuration version and
-     * its metadata.
-     * 
- */ - public void modifyCloudToDeviceConfig( - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getModifyCloudToDeviceConfigMethod(), responseObserver); - } - - /** - * - * - *
-     * Lists the last few versions of the device configuration in descending
-     * order (i.e.: newest first).
-     * 
- */ - public void listDeviceConfigVersions( - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getListDeviceConfigVersionsMethod(), responseObserver); - } - - /** - * - * - *
-     * Lists the last few versions of the device state in descending order (i.e.:
-     * newest first).
-     * 
- */ - public void listDeviceStates( - com.google.cloud.iot.v1.ListDeviceStatesRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getListDeviceStatesMethod(), responseObserver); - } - - /** - * - * - *
-     * Sets the access control policy on the specified resource. Replaces any
-     * existing policy.
-     * 
- */ - public void setIamPolicy( - com.google.iam.v1.SetIamPolicyRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getSetIamPolicyMethod(), responseObserver); - } - - /** - * - * - *
-     * Gets the access control policy for a resource.
-     * Returns an empty policy if the resource exists and does not have a policy
-     * set.
-     * 
- */ - public void getIamPolicy( - com.google.iam.v1.GetIamPolicyRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getGetIamPolicyMethod(), responseObserver); - } - - /** - * - * - *
-     * Returns permissions that a caller has on the specified resource.
-     * If the resource does not exist, this will return an empty set of
-     * permissions, not a NOT_FOUND error.
-     * 
- */ - public void testIamPermissions( - com.google.iam.v1.TestIamPermissionsRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getTestIamPermissionsMethod(), responseObserver); - } - - /** - * - * - *
-     * Sends a command to the specified device. In order for a device to be able
-     * to receive commands, it must:
-     * 1) be connected to Cloud IoT Core using the MQTT protocol, and
-     * 2) be subscribed to the group of MQTT topics specified by
-     *    /devices/{device-id}/commands/#. This subscription will receive commands
-     *    at the top-level topic /devices/{device-id}/commands as well as commands
-     *    for subfolders, like /devices/{device-id}/commands/subfolder.
-     *    Note that subscribing to specific subfolders is not supported.
-     * If the command could not be delivered to the device, this method will
-     * return an error; in particular, if the device is not subscribed, this
-     * method will return FAILED_PRECONDITION. Otherwise, this method will
-     * return OK. If the subscription is QoS 1, at least once delivery will be
-     * guaranteed; for QoS 0, no acknowledgment will be expected from the device.
-     * 
- */ - public void sendCommandToDevice( - com.google.cloud.iot.v1.SendCommandToDeviceRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getSendCommandToDeviceMethod(), responseObserver); - } - - /** - * - * - *
-     * Associates the device with the gateway.
-     * 
- */ - public void bindDeviceToGateway( - com.google.cloud.iot.v1.BindDeviceToGatewayRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getBindDeviceToGatewayMethod(), responseObserver); - } - - /** - * - * - *
-     * Deletes the association between the device and the gateway.
-     * 
- */ - public void unbindDeviceFromGateway( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( - getUnbindDeviceFromGatewayMethod(), responseObserver); - } - - @java.lang.Override - public final io.grpc.ServerServiceDefinition bindService() { - return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) - .addMethod( - getCreateDeviceRegistryMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.CreateDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry>( - this, METHODID_CREATE_DEVICE_REGISTRY))) - .addMethod( - getGetDeviceRegistryMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.GetDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry>(this, METHODID_GET_DEVICE_REGISTRY))) - .addMethod( - getUpdateDeviceRegistryMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest, - com.google.cloud.iot.v1.DeviceRegistry>( - this, METHODID_UPDATE_DEVICE_REGISTRY))) - .addMethod( - getDeleteDeviceRegistryMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest, - com.google.protobuf.Empty>(this, METHODID_DELETE_DEVICE_REGISTRY))) - .addMethod( - getListDeviceRegistriesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.ListDeviceRegistriesRequest, - com.google.cloud.iot.v1.ListDeviceRegistriesResponse>( - this, METHODID_LIST_DEVICE_REGISTRIES))) - .addMethod( - getCreateDeviceMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.CreateDeviceRequest, com.google.cloud.iot.v1.Device>( - this, METHODID_CREATE_DEVICE))) - .addMethod( - getGetDeviceMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.GetDeviceRequest, com.google.cloud.iot.v1.Device>( - this, METHODID_GET_DEVICE))) - .addMethod( - getUpdateDeviceMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.UpdateDeviceRequest, com.google.cloud.iot.v1.Device>( - this, METHODID_UPDATE_DEVICE))) - .addMethod( - getDeleteDeviceMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.DeleteDeviceRequest, com.google.protobuf.Empty>( - this, METHODID_DELETE_DEVICE))) - .addMethod( - getListDevicesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.ListDevicesRequest, - com.google.cloud.iot.v1.ListDevicesResponse>(this, METHODID_LIST_DEVICES))) - .addMethod( - getModifyCloudToDeviceConfigMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest, - com.google.cloud.iot.v1.DeviceConfig>( - this, METHODID_MODIFY_CLOUD_TO_DEVICE_CONFIG))) - .addMethod( - getListDeviceConfigVersionsMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest, - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse>( - this, METHODID_LIST_DEVICE_CONFIG_VERSIONS))) - .addMethod( - getListDeviceStatesMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.ListDeviceStatesRequest, - com.google.cloud.iot.v1.ListDeviceStatesResponse>( - this, METHODID_LIST_DEVICE_STATES))) - .addMethod( - getSetIamPolicyMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>( - this, METHODID_SET_IAM_POLICY))) - .addMethod( - getGetIamPolicyMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>( - this, METHODID_GET_IAM_POLICY))) - .addMethod( - getTestIamPermissionsMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.iam.v1.TestIamPermissionsRequest, - com.google.iam.v1.TestIamPermissionsResponse>( - this, METHODID_TEST_IAM_PERMISSIONS))) - .addMethod( - getSendCommandToDeviceMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.SendCommandToDeviceRequest, - com.google.cloud.iot.v1.SendCommandToDeviceResponse>( - this, METHODID_SEND_COMMAND_TO_DEVICE))) - .addMethod( - getBindDeviceToGatewayMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.BindDeviceToGatewayRequest, - com.google.cloud.iot.v1.BindDeviceToGatewayResponse>( - this, METHODID_BIND_DEVICE_TO_GATEWAY))) - .addMethod( - getUnbindDeviceFromGatewayMethod(), - io.grpc.stub.ServerCalls.asyncUnaryCall( - new MethodHandlers< - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest, - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse>( - this, METHODID_UNBIND_DEVICE_FROM_GATEWAY))) - .build(); - } - } - - /** - * - * - *
-   * Internet of Things (IoT) service. Securely connect and manage IoT devices.
-   * 
- */ - public static final class DeviceManagerStub - extends io.grpc.stub.AbstractAsyncStub { - private DeviceManagerStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DeviceManagerStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DeviceManagerStub(channel, callOptions); - } - - /** - * - * - *
-     * Creates a device registry that contains devices.
-     * 
- */ - public void createDeviceRegistry( - com.google.cloud.iot.v1.CreateDeviceRegistryRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getCreateDeviceRegistryMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Gets a device registry configuration.
-     * 
- */ - public void getDeviceRegistry( - com.google.cloud.iot.v1.GetDeviceRegistryRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetDeviceRegistryMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Updates a device registry configuration.
-     * 
- */ - public void updateDeviceRegistry( - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getUpdateDeviceRegistryMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Deletes a device registry configuration.
-     * 
- */ - public void deleteDeviceRegistry( - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getDeleteDeviceRegistryMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Lists device registries.
-     * 
- */ - public void listDeviceRegistries( - com.google.cloud.iot.v1.ListDeviceRegistriesRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getListDeviceRegistriesMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Creates a device in a device registry.
-     * 
- */ - public void createDevice( - com.google.cloud.iot.v1.CreateDeviceRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getCreateDeviceMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Gets details about a device.
-     * 
- */ - public void getDevice( - com.google.cloud.iot.v1.GetDeviceRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetDeviceMethod(), getCallOptions()), request, responseObserver); - } - - /** - * - * - *
-     * Updates a device.
-     * 
- */ - public void updateDevice( - com.google.cloud.iot.v1.UpdateDeviceRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getUpdateDeviceMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Deletes a device.
-     * 
- */ - public void deleteDevice( - com.google.cloud.iot.v1.DeleteDeviceRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getDeleteDeviceMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * List devices in a device registry.
-     * 
- */ - public void listDevices( - com.google.cloud.iot.v1.ListDevicesRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getListDevicesMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Modifies the configuration for the device, which is eventually sent from
-     * the Cloud IoT Core servers. Returns the modified configuration version and
-     * its metadata.
-     * 
- */ - public void modifyCloudToDeviceConfig( - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getModifyCloudToDeviceConfigMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Lists the last few versions of the device configuration in descending
-     * order (i.e.: newest first).
-     * 
- */ - public void listDeviceConfigVersions( - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getListDeviceConfigVersionsMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Lists the last few versions of the device state in descending order (i.e.:
-     * newest first).
-     * 
- */ - public void listDeviceStates( - com.google.cloud.iot.v1.ListDeviceStatesRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getListDeviceStatesMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Sets the access control policy on the specified resource. Replaces any
-     * existing policy.
-     * 
- */ - public void setIamPolicy( - com.google.iam.v1.SetIamPolicyRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Gets the access control policy for a resource.
-     * Returns an empty policy if the resource exists and does not have a policy
-     * set.
-     * 
- */ - public void getIamPolicy( - com.google.iam.v1.GetIamPolicyRequest request, - io.grpc.stub.StreamObserver responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Returns permissions that a caller has on the specified resource.
-     * If the resource does not exist, this will return an empty set of
-     * permissions, not a NOT_FOUND error.
-     * 
- */ - public void testIamPermissions( - com.google.iam.v1.TestIamPermissionsRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Sends a command to the specified device. In order for a device to be able
-     * to receive commands, it must:
-     * 1) be connected to Cloud IoT Core using the MQTT protocol, and
-     * 2) be subscribed to the group of MQTT topics specified by
-     *    /devices/{device-id}/commands/#. This subscription will receive commands
-     *    at the top-level topic /devices/{device-id}/commands as well as commands
-     *    for subfolders, like /devices/{device-id}/commands/subfolder.
-     *    Note that subscribing to specific subfolders is not supported.
-     * If the command could not be delivered to the device, this method will
-     * return an error; in particular, if the device is not subscribed, this
-     * method will return FAILED_PRECONDITION. Otherwise, this method will
-     * return OK. If the subscription is QoS 1, at least once delivery will be
-     * guaranteed; for QoS 0, no acknowledgment will be expected from the device.
-     * 
- */ - public void sendCommandToDevice( - com.google.cloud.iot.v1.SendCommandToDeviceRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getSendCommandToDeviceMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Associates the device with the gateway.
-     * 
- */ - public void bindDeviceToGateway( - com.google.cloud.iot.v1.BindDeviceToGatewayRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getBindDeviceToGatewayMethod(), getCallOptions()), - request, - responseObserver); - } - - /** - * - * - *
-     * Deletes the association between the device and the gateway.
-     * 
- */ - public void unbindDeviceFromGateway( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest request, - io.grpc.stub.StreamObserver - responseObserver) { - io.grpc.stub.ClientCalls.asyncUnaryCall( - getChannel().newCall(getUnbindDeviceFromGatewayMethod(), getCallOptions()), - request, - responseObserver); - } - } - - /** - * - * - *
-   * Internet of Things (IoT) service. Securely connect and manage IoT devices.
-   * 
- */ - public static final class DeviceManagerBlockingStub - extends io.grpc.stub.AbstractBlockingStub { - private DeviceManagerBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DeviceManagerBlockingStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DeviceManagerBlockingStub(channel, callOptions); - } - - /** - * - * - *
-     * Creates a device registry that contains devices.
-     * 
- */ - public com.google.cloud.iot.v1.DeviceRegistry createDeviceRegistry( - com.google.cloud.iot.v1.CreateDeviceRegistryRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getCreateDeviceRegistryMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Gets a device registry configuration.
-     * 
- */ - public com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistry( - com.google.cloud.iot.v1.GetDeviceRegistryRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetDeviceRegistryMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Updates a device registry configuration.
-     * 
- */ - public com.google.cloud.iot.v1.DeviceRegistry updateDeviceRegistry( - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getUpdateDeviceRegistryMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Deletes a device registry configuration.
-     * 
- */ - public com.google.protobuf.Empty deleteDeviceRegistry( - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getDeleteDeviceRegistryMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Lists device registries.
-     * 
- */ - public com.google.cloud.iot.v1.ListDeviceRegistriesResponse listDeviceRegistries( - com.google.cloud.iot.v1.ListDeviceRegistriesRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getListDeviceRegistriesMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Creates a device in a device registry.
-     * 
- */ - public com.google.cloud.iot.v1.Device createDevice( - com.google.cloud.iot.v1.CreateDeviceRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getCreateDeviceMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Gets details about a device.
-     * 
- */ - public com.google.cloud.iot.v1.Device getDevice( - com.google.cloud.iot.v1.GetDeviceRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetDeviceMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Updates a device.
-     * 
- */ - public com.google.cloud.iot.v1.Device updateDevice( - com.google.cloud.iot.v1.UpdateDeviceRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getUpdateDeviceMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Deletes a device.
-     * 
- */ - public com.google.protobuf.Empty deleteDevice( - com.google.cloud.iot.v1.DeleteDeviceRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getDeleteDeviceMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * List devices in a device registry.
-     * 
- */ - public com.google.cloud.iot.v1.ListDevicesResponse listDevices( - com.google.cloud.iot.v1.ListDevicesRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getListDevicesMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Modifies the configuration for the device, which is eventually sent from
-     * the Cloud IoT Core servers. Returns the modified configuration version and
-     * its metadata.
-     * 
- */ - public com.google.cloud.iot.v1.DeviceConfig modifyCloudToDeviceConfig( - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getModifyCloudToDeviceConfigMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Lists the last few versions of the device configuration in descending
-     * order (i.e.: newest first).
-     * 
- */ - public com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse listDeviceConfigVersions( - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getListDeviceConfigVersionsMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Lists the last few versions of the device state in descending order (i.e.:
-     * newest first).
-     * 
- */ - public com.google.cloud.iot.v1.ListDeviceStatesResponse listDeviceStates( - com.google.cloud.iot.v1.ListDeviceStatesRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getListDeviceStatesMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Sets the access control policy on the specified resource. Replaces any
-     * existing policy.
-     * 
- */ - public com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getSetIamPolicyMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Gets the access control policy for a resource.
-     * Returns an empty policy if the resource exists and does not have a policy
-     * set.
-     * 
- */ - public com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getGetIamPolicyMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Returns permissions that a caller has on the specified resource.
-     * If the resource does not exist, this will return an empty set of
-     * permissions, not a NOT_FOUND error.
-     * 
- */ - public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions( - com.google.iam.v1.TestIamPermissionsRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getTestIamPermissionsMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Sends a command to the specified device. In order for a device to be able
-     * to receive commands, it must:
-     * 1) be connected to Cloud IoT Core using the MQTT protocol, and
-     * 2) be subscribed to the group of MQTT topics specified by
-     *    /devices/{device-id}/commands/#. This subscription will receive commands
-     *    at the top-level topic /devices/{device-id}/commands as well as commands
-     *    for subfolders, like /devices/{device-id}/commands/subfolder.
-     *    Note that subscribing to specific subfolders is not supported.
-     * If the command could not be delivered to the device, this method will
-     * return an error; in particular, if the device is not subscribed, this
-     * method will return FAILED_PRECONDITION. Otherwise, this method will
-     * return OK. If the subscription is QoS 1, at least once delivery will be
-     * guaranteed; for QoS 0, no acknowledgment will be expected from the device.
-     * 
- */ - public com.google.cloud.iot.v1.SendCommandToDeviceResponse sendCommandToDevice( - com.google.cloud.iot.v1.SendCommandToDeviceRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getSendCommandToDeviceMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Associates the device with the gateway.
-     * 
- */ - public com.google.cloud.iot.v1.BindDeviceToGatewayResponse bindDeviceToGateway( - com.google.cloud.iot.v1.BindDeviceToGatewayRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getBindDeviceToGatewayMethod(), getCallOptions(), request); - } - - /** - * - * - *
-     * Deletes the association between the device and the gateway.
-     * 
- */ - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse unbindDeviceFromGateway( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest request) { - return io.grpc.stub.ClientCalls.blockingUnaryCall( - getChannel(), getUnbindDeviceFromGatewayMethod(), getCallOptions(), request); - } - } - - /** - * - * - *
-   * Internet of Things (IoT) service. Securely connect and manage IoT devices.
-   * 
- */ - public static final class DeviceManagerFutureStub - extends io.grpc.stub.AbstractFutureStub { - private DeviceManagerFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - super(channel, callOptions); - } - - @java.lang.Override - protected DeviceManagerFutureStub build( - io.grpc.Channel channel, io.grpc.CallOptions callOptions) { - return new DeviceManagerFutureStub(channel, callOptions); - } - - /** - * - * - *
-     * Creates a device registry that contains devices.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.DeviceRegistry> - createDeviceRegistry(com.google.cloud.iot.v1.CreateDeviceRegistryRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getCreateDeviceRegistryMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Gets a device registry configuration.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.DeviceRegistry> - getDeviceRegistry(com.google.cloud.iot.v1.GetDeviceRegistryRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetDeviceRegistryMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Updates a device registry configuration.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.DeviceRegistry> - updateDeviceRegistry(com.google.cloud.iot.v1.UpdateDeviceRegistryRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getUpdateDeviceRegistryMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Deletes a device registry configuration.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - deleteDeviceRegistry(com.google.cloud.iot.v1.DeleteDeviceRegistryRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getDeleteDeviceRegistryMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Lists device registries.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.ListDeviceRegistriesResponse> - listDeviceRegistries(com.google.cloud.iot.v1.ListDeviceRegistriesRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getListDeviceRegistriesMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Creates a device in a device registry.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - createDevice(com.google.cloud.iot.v1.CreateDeviceRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getCreateDeviceMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Gets details about a device.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - getDevice(com.google.cloud.iot.v1.GetDeviceRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetDeviceMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Updates a device.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - updateDevice(com.google.cloud.iot.v1.UpdateDeviceRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getUpdateDeviceMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Deletes a device.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - deleteDevice(com.google.cloud.iot.v1.DeleteDeviceRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getDeleteDeviceMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * List devices in a device registry.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.ListDevicesResponse> - listDevices(com.google.cloud.iot.v1.ListDevicesRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getListDevicesMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Modifies the configuration for the device, which is eventually sent from
-     * the Cloud IoT Core servers. Returns the modified configuration version and
-     * its metadata.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - modifyCloudToDeviceConfig( - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getModifyCloudToDeviceConfigMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Lists the last few versions of the device configuration in descending
-     * order (i.e.: newest first).
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse> - listDeviceConfigVersions(com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getListDeviceConfigVersionsMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Lists the last few versions of the device state in descending order (i.e.:
-     * newest first).
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.ListDeviceStatesResponse> - listDeviceStates(com.google.cloud.iot.v1.ListDeviceStatesRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getListDeviceStatesMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Sets the access control policy on the specified resource. Replaces any
-     * existing policy.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Gets the access control policy for a resource.
-     * Returns an empty policy if the resource exists and does not have a policy
-     * set.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture - getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Returns permissions that a caller has on the specified resource.
-     * If the resource does not exist, this will return an empty set of
-     * permissions, not a NOT_FOUND error.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.iam.v1.TestIamPermissionsResponse> - testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Sends a command to the specified device. In order for a device to be able
-     * to receive commands, it must:
-     * 1) be connected to Cloud IoT Core using the MQTT protocol, and
-     * 2) be subscribed to the group of MQTT topics specified by
-     *    /devices/{device-id}/commands/#. This subscription will receive commands
-     *    at the top-level topic /devices/{device-id}/commands as well as commands
-     *    for subfolders, like /devices/{device-id}/commands/subfolder.
-     *    Note that subscribing to specific subfolders is not supported.
-     * If the command could not be delivered to the device, this method will
-     * return an error; in particular, if the device is not subscribed, this
-     * method will return FAILED_PRECONDITION. Otherwise, this method will
-     * return OK. If the subscription is QoS 1, at least once delivery will be
-     * guaranteed; for QoS 0, no acknowledgment will be expected from the device.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.SendCommandToDeviceResponse> - sendCommandToDevice(com.google.cloud.iot.v1.SendCommandToDeviceRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getSendCommandToDeviceMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Associates the device with the gateway.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.BindDeviceToGatewayResponse> - bindDeviceToGateway(com.google.cloud.iot.v1.BindDeviceToGatewayRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getBindDeviceToGatewayMethod(), getCallOptions()), request); - } - - /** - * - * - *
-     * Deletes the association between the device and the gateway.
-     * 
- */ - public com.google.common.util.concurrent.ListenableFuture< - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse> - unbindDeviceFromGateway(com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest request) { - return io.grpc.stub.ClientCalls.futureUnaryCall( - getChannel().newCall(getUnbindDeviceFromGatewayMethod(), getCallOptions()), request); - } - } - - private static final int METHODID_CREATE_DEVICE_REGISTRY = 0; - private static final int METHODID_GET_DEVICE_REGISTRY = 1; - private static final int METHODID_UPDATE_DEVICE_REGISTRY = 2; - private static final int METHODID_DELETE_DEVICE_REGISTRY = 3; - private static final int METHODID_LIST_DEVICE_REGISTRIES = 4; - private static final int METHODID_CREATE_DEVICE = 5; - private static final int METHODID_GET_DEVICE = 6; - private static final int METHODID_UPDATE_DEVICE = 7; - private static final int METHODID_DELETE_DEVICE = 8; - private static final int METHODID_LIST_DEVICES = 9; - private static final int METHODID_MODIFY_CLOUD_TO_DEVICE_CONFIG = 10; - private static final int METHODID_LIST_DEVICE_CONFIG_VERSIONS = 11; - private static final int METHODID_LIST_DEVICE_STATES = 12; - private static final int METHODID_SET_IAM_POLICY = 13; - private static final int METHODID_GET_IAM_POLICY = 14; - private static final int METHODID_TEST_IAM_PERMISSIONS = 15; - private static final int METHODID_SEND_COMMAND_TO_DEVICE = 16; - private static final int METHODID_BIND_DEVICE_TO_GATEWAY = 17; - private static final int METHODID_UNBIND_DEVICE_FROM_GATEWAY = 18; - - 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 DeviceManagerImplBase serviceImpl; - private final int methodId; - - MethodHandlers(DeviceManagerImplBase serviceImpl, int methodId) { - this.serviceImpl = serviceImpl; - this.methodId = methodId; - } - - @java.lang.Override - @java.lang.SuppressWarnings("unchecked") - public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { - switch (methodId) { - case METHODID_CREATE_DEVICE_REGISTRY: - serviceImpl.createDeviceRegistry( - (com.google.cloud.iot.v1.CreateDeviceRegistryRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_GET_DEVICE_REGISTRY: - serviceImpl.getDeviceRegistry( - (com.google.cloud.iot.v1.GetDeviceRegistryRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_UPDATE_DEVICE_REGISTRY: - serviceImpl.updateDeviceRegistry( - (com.google.cloud.iot.v1.UpdateDeviceRegistryRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_DELETE_DEVICE_REGISTRY: - serviceImpl.deleteDeviceRegistry( - (com.google.cloud.iot.v1.DeleteDeviceRegistryRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_LIST_DEVICE_REGISTRIES: - serviceImpl.listDeviceRegistries( - (com.google.cloud.iot.v1.ListDeviceRegistriesRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_CREATE_DEVICE: - serviceImpl.createDevice( - (com.google.cloud.iot.v1.CreateDeviceRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_GET_DEVICE: - serviceImpl.getDevice( - (com.google.cloud.iot.v1.GetDeviceRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_UPDATE_DEVICE: - serviceImpl.updateDevice( - (com.google.cloud.iot.v1.UpdateDeviceRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_DELETE_DEVICE: - serviceImpl.deleteDevice( - (com.google.cloud.iot.v1.DeleteDeviceRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_LIST_DEVICES: - serviceImpl.listDevices( - (com.google.cloud.iot.v1.ListDevicesRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_MODIFY_CLOUD_TO_DEVICE_CONFIG: - serviceImpl.modifyCloudToDeviceConfig( - (com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_LIST_DEVICE_CONFIG_VERSIONS: - serviceImpl.listDeviceConfigVersions( - (com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest) request, - (io.grpc.stub.StreamObserver< - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse>) - responseObserver); - break; - case METHODID_LIST_DEVICE_STATES: - serviceImpl.listDeviceStates( - (com.google.cloud.iot.v1.ListDeviceStatesRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_SET_IAM_POLICY: - serviceImpl.setIamPolicy( - (com.google.iam.v1.SetIamPolicyRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_GET_IAM_POLICY: - serviceImpl.getIamPolicy( - (com.google.iam.v1.GetIamPolicyRequest) request, - (io.grpc.stub.StreamObserver) responseObserver); - break; - case METHODID_TEST_IAM_PERMISSIONS: - serviceImpl.testIamPermissions( - (com.google.iam.v1.TestIamPermissionsRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_SEND_COMMAND_TO_DEVICE: - serviceImpl.sendCommandToDevice( - (com.google.cloud.iot.v1.SendCommandToDeviceRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_BIND_DEVICE_TO_GATEWAY: - serviceImpl.bindDeviceToGateway( - (com.google.cloud.iot.v1.BindDeviceToGatewayRequest) request, - (io.grpc.stub.StreamObserver) - responseObserver); - break; - case METHODID_UNBIND_DEVICE_FROM_GATEWAY: - serviceImpl.unbindDeviceFromGateway( - (com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest) 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 DeviceManagerBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoFileDescriptorSupplier, - io.grpc.protobuf.ProtoServiceDescriptorSupplier { - DeviceManagerBaseDescriptorSupplier() {} - - @java.lang.Override - public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto.getDescriptor(); - } - - @java.lang.Override - public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { - return getFileDescriptor().findServiceByName("DeviceManager"); - } - } - - private static final class DeviceManagerFileDescriptorSupplier - extends DeviceManagerBaseDescriptorSupplier { - DeviceManagerFileDescriptorSupplier() {} - } - - private static final class DeviceManagerMethodDescriptorSupplier - extends DeviceManagerBaseDescriptorSupplier - implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { - private final String methodName; - - DeviceManagerMethodDescriptorSupplier(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 (DeviceManagerGrpc.class) { - result = serviceDescriptor; - if (result == null) { - serviceDescriptor = - result = - io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) - .setSchemaDescriptor(new DeviceManagerFileDescriptorSupplier()) - .addMethod(getCreateDeviceRegistryMethod()) - .addMethod(getGetDeviceRegistryMethod()) - .addMethod(getUpdateDeviceRegistryMethod()) - .addMethod(getDeleteDeviceRegistryMethod()) - .addMethod(getListDeviceRegistriesMethod()) - .addMethod(getCreateDeviceMethod()) - .addMethod(getGetDeviceMethod()) - .addMethod(getUpdateDeviceMethod()) - .addMethod(getDeleteDeviceMethod()) - .addMethod(getListDevicesMethod()) - .addMethod(getModifyCloudToDeviceConfigMethod()) - .addMethod(getListDeviceConfigVersionsMethod()) - .addMethod(getListDeviceStatesMethod()) - .addMethod(getSetIamPolicyMethod()) - .addMethod(getGetIamPolicyMethod()) - .addMethod(getTestIamPermissionsMethod()) - .addMethod(getSendCommandToDeviceMethod()) - .addMethod(getBindDeviceToGatewayMethod()) - .addMethod(getUnbindDeviceFromGatewayMethod()) - .build(); - } - } - } - return result; - } -} diff --git a/java.header b/java.header deleted file mode 100644 index d0970ba7..00000000 --- a/java.header +++ /dev/null @@ -1,15 +0,0 @@ -^/\*$ -^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)$ -^ \*$ -^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$ -^ \* you may not use this file except in compliance with the License\.$ -^ \* You may obtain a copy of the License at$ -^ \*$ -^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$ -^ \*$ -^ \* Unless required by applicable law or agreed to in writing, software$ -^ \* distributed under the License is distributed on an "AS IS" BASIS,$ -^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$ -^ \* See the License for the specific language governing permissions and$ -^ \* limitations under the License\.$ -^ \*/$ diff --git a/license-checks.xml b/license-checks.xml deleted file mode 100644 index 6597fced..00000000 --- a/license-checks.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/owlbot.py b/owlbot.py deleted file mode 100644 index dbd07138..00000000 --- a/owlbot.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2021 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import synthtool as s -from synthtool.languages import java - - -for library in s.get_staging_dirs(): - # put any special-case replacements here - s.move(library) - -s.remove_staging_dirs() -java.common_templates(excludes=[".github/blunderbuss.yml"]) diff --git a/pom.xml b/pom.xml deleted file mode 100644 index 29828aa8..00000000 --- a/pom.xml +++ /dev/null @@ -1,187 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-iot-parent - pom - 2.3.5 - Google Cloud IoT Core Parent - https://github.com/googleapis/java-iot - - Java idiomatic client for Google Cloud Platform services. - - - - com.google.cloud - google-cloud-shared-config - 1.5.3 - - - - - chingor - Jeff Ching - chingor@google.com - Google - - Developer - - - - - Google LLC - - - scm:git:git@github.com:googleapis/java-iot.git - scm:git:git@github.com:googleapis/java-iot.git - https://github.com/googleapis/java-iot - HEAD - - - https://github.com/googleapis/java-iot/issues - GitHub Issues - - - - - Apache-2.0 - https://www.apache.org/licenses/LICENSE-2.0.txt - - - - - UTF-8 - UTF-8 - github - google-cloud-iot-parent - - - - - - com.google.api.grpc - proto-google-cloud-iot-v1 - 2.3.5 - - - com.google.api.grpc - grpc-google-cloud-iot-v1 - 2.3.5 - - - com.google.cloud - google-cloud-iot - 2.3.5 - - - - com.google.cloud - google-cloud-shared-dependencies - 3.0.4 - pom - import - - - - junit - junit - 4.13.2 - test - - - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - org.objenesis:objenesis - javax.annotation:javax.annotation-api - - - - - - - - - google-cloud-iot - grpc-google-cloud-iot-v1 - proto-google-cloud-iot-v1 - google-cloud-iot-bom - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 3.4.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.4.1 - - - 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/ - - - - - - diff --git a/proto-google-cloud-iot-v1/clirr-ignored-differences.xml b/proto-google-cloud-iot-v1/clirr-ignored-differences.xml deleted file mode 100644 index 74f44694..00000000 --- a/proto-google-cloud-iot-v1/clirr-ignored-differences.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - 7012 - com/google/cloud/iot/v1/*OrBuilder - * get*(*) - - - 7012 - com/google/cloud/iot/v1/*OrBuilder - boolean contains*(*) - - - 7012 - com/google/cloud/iot/v1/*OrBuilder - boolean has*(*) - - diff --git a/proto-google-cloud-iot-v1/pom.xml b/proto-google-cloud-iot-v1/pom.xml deleted file mode 100644 index b9a41024..00000000 --- a/proto-google-cloud-iot-v1/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - 4.0.0 - com.google.api.grpc - proto-google-cloud-iot-v1 - 2.3.5 - proto-google-cloud-iot-v1 - PROTO library for proto-google-cloud-iot-v1 - - com.google.cloud - google-cloud-iot-parent - 2.3.5 - - - - 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 - - - - \ No newline at end of file diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayRequest.java deleted file mode 100644 index d1c9eb8a..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayRequest.java +++ /dev/null @@ -1,1013 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `BindDeviceToGateway`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.BindDeviceToGatewayRequest} - */ -public final class BindDeviceToGatewayRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.BindDeviceToGatewayRequest) - BindDeviceToGatewayRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use BindDeviceToGatewayRequest.newBuilder() to construct. - private BindDeviceToGatewayRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private BindDeviceToGatewayRequest() { - parent_ = ""; - gatewayId_ = ""; - deviceId_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new BindDeviceToGatewayRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.BindDeviceToGatewayRequest.class, - com.google.cloud.iot.v1.BindDeviceToGatewayRequest.Builder.class); - } - - public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; - /** - * - * - *
-   * Required. The name of the registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - @java.lang.Override - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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 GATEWAY_ID_FIELD_NUMBER = 2; - private volatile java.lang.Object gatewayId_; - /** - * - * - *
-   * Required. The value of `gateway_id` can be either the device numeric ID or the
-   * user-defined device identifier.
-   * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The gatewayId. - */ - @java.lang.Override - public java.lang.String getGatewayId() { - java.lang.Object ref = gatewayId_; - 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(); - gatewayId_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The value of `gateway_id` can be either the device numeric ID or the
-   * user-defined device identifier.
-   * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for gatewayId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getGatewayIdBytes() { - java.lang.Object ref = gatewayId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - gatewayId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int DEVICE_ID_FIELD_NUMBER = 3; - private volatile java.lang.Object deviceId_; - /** - * - * - *
-   * Required. The device to associate with the specified gateway. The value of
-   * `device_id` can be either the device numeric ID or the user-defined device
-   * identifier.
-   * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The deviceId. - */ - @java.lang.Override - public java.lang.String getDeviceId() { - java.lang.Object ref = deviceId_; - 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(); - deviceId_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The device to associate with the specified gateway. The value of
-   * `device_id` can be either the device numeric ID or the user-defined device
-   * identifier.
-   * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for deviceId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getDeviceIdBytes() { - java.lang.Object ref = deviceId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - deviceId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(gatewayId_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, gatewayId_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deviceId_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, deviceId_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(gatewayId_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, gatewayId_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deviceId_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, deviceId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.BindDeviceToGatewayRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.BindDeviceToGatewayRequest other = - (com.google.cloud.iot.v1.BindDeviceToGatewayRequest) obj; - - if (!getParent().equals(other.getParent())) return false; - if (!getGatewayId().equals(other.getGatewayId())) return false; - if (!getDeviceId().equals(other.getDeviceId())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + PARENT_FIELD_NUMBER; - hash = (53 * hash) + getParent().hashCode(); - hash = (37 * hash) + GATEWAY_ID_FIELD_NUMBER; - hash = (53 * hash) + getGatewayId().hashCode(); - hash = (37 * hash) + DEVICE_ID_FIELD_NUMBER; - hash = (53 * hash) + getDeviceId().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest 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.iot.v1.BindDeviceToGatewayRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest 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.iot.v1.BindDeviceToGatewayRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest 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.iot.v1.BindDeviceToGatewayRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest 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.iot.v1.BindDeviceToGatewayRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest 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.iot.v1.BindDeviceToGatewayRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `BindDeviceToGateway`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.BindDeviceToGatewayRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.BindDeviceToGatewayRequest) - com.google.cloud.iot.v1.BindDeviceToGatewayRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.BindDeviceToGatewayRequest.class, - com.google.cloud.iot.v1.BindDeviceToGatewayRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.BindDeviceToGatewayRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - parent_ = ""; - - gatewayId_ = ""; - - deviceId_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.BindDeviceToGatewayRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.BindDeviceToGatewayRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.BindDeviceToGatewayRequest build() { - com.google.cloud.iot.v1.BindDeviceToGatewayRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.BindDeviceToGatewayRequest buildPartial() { - com.google.cloud.iot.v1.BindDeviceToGatewayRequest result = - new com.google.cloud.iot.v1.BindDeviceToGatewayRequest(this); - result.parent_ = parent_; - result.gatewayId_ = gatewayId_; - result.deviceId_ = deviceId_; - 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.iot.v1.BindDeviceToGatewayRequest) { - return mergeFrom((com.google.cloud.iot.v1.BindDeviceToGatewayRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.BindDeviceToGatewayRequest other) { - if (other == com.google.cloud.iot.v1.BindDeviceToGatewayRequest.getDefaultInstance()) - return this; - if (!other.getParent().isEmpty()) { - parent_ = other.parent_; - onChanged(); - } - if (!other.getGatewayId().isEmpty()) { - gatewayId_ = other.gatewayId_; - onChanged(); - } - if (!other.getDeviceId().isEmpty()) { - deviceId_ = other.deviceId_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - parent_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - gatewayId_ = input.readStringRequireUtf8(); - - break; - } // case 18 - case 26: - { - deviceId_ = input.readStringRequireUtf8(); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object parent_ = ""; - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - public com.google.protobuf.ByteString getParentBytes() { - java.lang.Object ref = parent_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - parent_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The parent to set. - * @return This builder for chaining. - */ - public Builder setParent(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - parent_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearParent() { - - parent_ = getDefaultInstance().getParent(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The bytes for parent to set. - * @return This builder for chaining. - */ - public Builder setParentBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - parent_ = value; - onChanged(); - return this; - } - - private java.lang.Object gatewayId_ = ""; - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The gatewayId. - */ - public java.lang.String getGatewayId() { - java.lang.Object ref = gatewayId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - gatewayId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for gatewayId. - */ - public com.google.protobuf.ByteString getGatewayIdBytes() { - java.lang.Object ref = gatewayId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - gatewayId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The gatewayId to set. - * @return This builder for chaining. - */ - public Builder setGatewayId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - gatewayId_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return This builder for chaining. - */ - public Builder clearGatewayId() { - - gatewayId_ = getDefaultInstance().getGatewayId(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The bytes for gatewayId to set. - * @return This builder for chaining. - */ - public Builder setGatewayIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - gatewayId_ = value; - onChanged(); - return this; - } - - private java.lang.Object deviceId_ = ""; - /** - * - * - *
-     * Required. The device to associate with the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The deviceId. - */ - public java.lang.String getDeviceId() { - java.lang.Object ref = deviceId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - deviceId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The device to associate with the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for deviceId. - */ - public com.google.protobuf.ByteString getDeviceIdBytes() { - java.lang.Object ref = deviceId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - deviceId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The device to associate with the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The deviceId to set. - * @return This builder for chaining. - */ - public Builder setDeviceId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - deviceId_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The device to associate with the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return This builder for chaining. - */ - public Builder clearDeviceId() { - - deviceId_ = getDefaultInstance().getDeviceId(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The device to associate with the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The bytes for deviceId to set. - * @return This builder for chaining. - */ - public Builder setDeviceIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - deviceId_ = 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.iot.v1.BindDeviceToGatewayRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.BindDeviceToGatewayRequest) - private static final com.google.cloud.iot.v1.BindDeviceToGatewayRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.BindDeviceToGatewayRequest(); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public BindDeviceToGatewayRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.BindDeviceToGatewayRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayRequestOrBuilder.java deleted file mode 100644 index 4476be56..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayRequestOrBuilder.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface BindDeviceToGatewayRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.BindDeviceToGatewayRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - java.lang.String getParent(); - /** - * - * - *
-   * Required. The name of the registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - com.google.protobuf.ByteString getParentBytes(); - - /** - * - * - *
-   * Required. The value of `gateway_id` can be either the device numeric ID or the
-   * user-defined device identifier.
-   * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The gatewayId. - */ - java.lang.String getGatewayId(); - /** - * - * - *
-   * Required. The value of `gateway_id` can be either the device numeric ID or the
-   * user-defined device identifier.
-   * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for gatewayId. - */ - com.google.protobuf.ByteString getGatewayIdBytes(); - - /** - * - * - *
-   * Required. The device to associate with the specified gateway. The value of
-   * `device_id` can be either the device numeric ID or the user-defined device
-   * identifier.
-   * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The deviceId. - */ - java.lang.String getDeviceId(); - /** - * - * - *
-   * Required. The device to associate with the specified gateway. The value of
-   * `device_id` can be either the device numeric ID or the user-defined device
-   * identifier.
-   * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for deviceId. - */ - com.google.protobuf.ByteString getDeviceIdBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayResponse.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayResponse.java deleted file mode 100644 index 1702fecd..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayResponse.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Response for `BindDeviceToGateway`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.BindDeviceToGatewayResponse} - */ -public final class BindDeviceToGatewayResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.BindDeviceToGatewayResponse) - BindDeviceToGatewayResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use BindDeviceToGatewayResponse.newBuilder() to construct. - private BindDeviceToGatewayResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private BindDeviceToGatewayResponse() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new BindDeviceToGatewayResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.BindDeviceToGatewayResponse.class, - com.google.cloud.iot.v1.BindDeviceToGatewayResponse.Builder.class); - } - - 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 { - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.BindDeviceToGatewayResponse)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.BindDeviceToGatewayResponse other = - (com.google.cloud.iot.v1.BindDeviceToGatewayResponse) obj; - - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse 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.iot.v1.BindDeviceToGatewayResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse 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.iot.v1.BindDeviceToGatewayResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse 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.iot.v1.BindDeviceToGatewayResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse 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.iot.v1.BindDeviceToGatewayResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse 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.iot.v1.BindDeviceToGatewayResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Response for `BindDeviceToGateway`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.BindDeviceToGatewayResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.BindDeviceToGatewayResponse) - com.google.cloud.iot.v1.BindDeviceToGatewayResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.BindDeviceToGatewayResponse.class, - com.google.cloud.iot.v1.BindDeviceToGatewayResponse.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.BindDeviceToGatewayResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.BindDeviceToGatewayResponse getDefaultInstanceForType() { - return com.google.cloud.iot.v1.BindDeviceToGatewayResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.BindDeviceToGatewayResponse build() { - com.google.cloud.iot.v1.BindDeviceToGatewayResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.BindDeviceToGatewayResponse buildPartial() { - com.google.cloud.iot.v1.BindDeviceToGatewayResponse result = - new com.google.cloud.iot.v1.BindDeviceToGatewayResponse(this); - 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.iot.v1.BindDeviceToGatewayResponse) { - return mergeFrom((com.google.cloud.iot.v1.BindDeviceToGatewayResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.BindDeviceToGatewayResponse other) { - if (other == com.google.cloud.iot.v1.BindDeviceToGatewayResponse.getDefaultInstance()) - return this; - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - @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.iot.v1.BindDeviceToGatewayResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.BindDeviceToGatewayResponse) - private static final com.google.cloud.iot.v1.BindDeviceToGatewayResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.BindDeviceToGatewayResponse(); - } - - public static com.google.cloud.iot.v1.BindDeviceToGatewayResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public BindDeviceToGatewayResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.BindDeviceToGatewayResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayResponseOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayResponseOrBuilder.java deleted file mode 100644 index a5011d31..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayResponseOrBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface BindDeviceToGatewayResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.BindDeviceToGatewayResponse) - com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRegistryRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRegistryRequest.java deleted file mode 100644 index 04602b03..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRegistryRequest.java +++ /dev/null @@ -1,952 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `CreateDeviceRegistry`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.CreateDeviceRegistryRequest} - */ -public final class CreateDeviceRegistryRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.CreateDeviceRegistryRequest) - CreateDeviceRegistryRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use CreateDeviceRegistryRequest.newBuilder() to construct. - private CreateDeviceRegistryRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private CreateDeviceRegistryRequest() { - parent_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new CreateDeviceRegistryRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.CreateDeviceRegistryRequest.class, - com.google.cloud.iot.v1.CreateDeviceRegistryRequest.Builder.class); - } - - public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; - /** - * - * - *
-   * Required. The project and cloud region where this device registry must be created.
-   * For example, `projects/example-project/locations/us-central1`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - @java.lang.Override - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The project and cloud region where this device registry must be created.
-   * For example, `projects/example-project/locations/us-central1`.
-   * 
- * - * - * 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 DEVICE_REGISTRY_FIELD_NUMBER = 2; - private com.google.cloud.iot.v1.DeviceRegistry deviceRegistry_; - /** - * - * - *
-   * Required. The device registry. The field `name` must be empty. The server will
-   * generate that field from the device registry `id` provided and the
-   * `parent` field.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the deviceRegistry field is set. - */ - @java.lang.Override - public boolean hasDeviceRegistry() { - return deviceRegistry_ != null; - } - /** - * - * - *
-   * Required. The device registry. The field `name` must be empty. The server will
-   * generate that field from the device registry `id` provided and the
-   * `parent` field.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The deviceRegistry. - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistry() { - return deviceRegistry_ == null - ? com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance() - : deviceRegistry_; - } - /** - * - * - *
-   * Required. The device registry. The field `name` must be empty. The server will
-   * generate that field from the device registry `id` provided and the
-   * `parent` field.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistryOrBuilder() { - return getDeviceRegistry(); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); - } - if (deviceRegistry_ != null) { - output.writeMessage(2, getDeviceRegistry()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); - } - if (deviceRegistry_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDeviceRegistry()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.CreateDeviceRegistryRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.CreateDeviceRegistryRequest other = - (com.google.cloud.iot.v1.CreateDeviceRegistryRequest) obj; - - if (!getParent().equals(other.getParent())) return false; - if (hasDeviceRegistry() != other.hasDeviceRegistry()) return false; - if (hasDeviceRegistry()) { - if (!getDeviceRegistry().equals(other.getDeviceRegistry())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + PARENT_FIELD_NUMBER; - hash = (53 * hash) + getParent().hashCode(); - if (hasDeviceRegistry()) { - hash = (37 * hash) + DEVICE_REGISTRY_FIELD_NUMBER; - hash = (53 * hash) + getDeviceRegistry().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest 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.iot.v1.CreateDeviceRegistryRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest 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.iot.v1.CreateDeviceRegistryRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest 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.iot.v1.CreateDeviceRegistryRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest 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.iot.v1.CreateDeviceRegistryRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest 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.iot.v1.CreateDeviceRegistryRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `CreateDeviceRegistry`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.CreateDeviceRegistryRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.CreateDeviceRegistryRequest) - com.google.cloud.iot.v1.CreateDeviceRegistryRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.CreateDeviceRegistryRequest.class, - com.google.cloud.iot.v1.CreateDeviceRegistryRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.CreateDeviceRegistryRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - parent_ = ""; - - if (deviceRegistryBuilder_ == null) { - deviceRegistry_ = null; - } else { - deviceRegistry_ = null; - deviceRegistryBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.CreateDeviceRegistryRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.CreateDeviceRegistryRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.CreateDeviceRegistryRequest build() { - com.google.cloud.iot.v1.CreateDeviceRegistryRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.CreateDeviceRegistryRequest buildPartial() { - com.google.cloud.iot.v1.CreateDeviceRegistryRequest result = - new com.google.cloud.iot.v1.CreateDeviceRegistryRequest(this); - result.parent_ = parent_; - if (deviceRegistryBuilder_ == null) { - result.deviceRegistry_ = deviceRegistry_; - } else { - result.deviceRegistry_ = deviceRegistryBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.CreateDeviceRegistryRequest) { - return mergeFrom((com.google.cloud.iot.v1.CreateDeviceRegistryRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.CreateDeviceRegistryRequest other) { - if (other == com.google.cloud.iot.v1.CreateDeviceRegistryRequest.getDefaultInstance()) - return this; - if (!other.getParent().isEmpty()) { - parent_ = other.parent_; - onChanged(); - } - if (other.hasDeviceRegistry()) { - mergeDeviceRegistry(other.getDeviceRegistry()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - parent_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - input.readMessage(getDeviceRegistryFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object parent_ = ""; - /** - * - * - *
-     * Required. The project and cloud region where this device registry must be created.
-     * For example, `projects/example-project/locations/us-central1`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The project and cloud region where this device registry must be created.
-     * For example, `projects/example-project/locations/us-central1`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - public com.google.protobuf.ByteString getParentBytes() { - java.lang.Object ref = parent_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - parent_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The project and cloud region where this device registry must be created.
-     * For example, `projects/example-project/locations/us-central1`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The parent to set. - * @return This builder for chaining. - */ - public Builder setParent(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - parent_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The project and cloud region where this device registry must be created.
-     * For example, `projects/example-project/locations/us-central1`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearParent() { - - parent_ = getDefaultInstance().getParent(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The project and cloud region where this device registry must be created.
-     * For example, `projects/example-project/locations/us-central1`.
-     * 
- * - * - * 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.iot.v1.DeviceRegistry deviceRegistry_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder> - deviceRegistryBuilder_; - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the deviceRegistry field is set. - */ - public boolean hasDeviceRegistry() { - return deviceRegistryBuilder_ != null || deviceRegistry_ != null; - } - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The deviceRegistry. - */ - public com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistry() { - if (deviceRegistryBuilder_ == null) { - return deviceRegistry_ == null - ? com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance() - : deviceRegistry_; - } else { - return deviceRegistryBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDeviceRegistry(com.google.cloud.iot.v1.DeviceRegistry value) { - if (deviceRegistryBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - deviceRegistry_ = value; - onChanged(); - } else { - deviceRegistryBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDeviceRegistry( - com.google.cloud.iot.v1.DeviceRegistry.Builder builderForValue) { - if (deviceRegistryBuilder_ == null) { - deviceRegistry_ = builderForValue.build(); - onChanged(); - } else { - deviceRegistryBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDeviceRegistry(com.google.cloud.iot.v1.DeviceRegistry value) { - if (deviceRegistryBuilder_ == null) { - if (deviceRegistry_ != null) { - deviceRegistry_ = - com.google.cloud.iot.v1.DeviceRegistry.newBuilder(deviceRegistry_) - .mergeFrom(value) - .buildPartial(); - } else { - deviceRegistry_ = value; - } - onChanged(); - } else { - deviceRegistryBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDeviceRegistry() { - if (deviceRegistryBuilder_ == null) { - deviceRegistry_ = null; - onChanged(); - } else { - deviceRegistry_ = null; - deviceRegistryBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.iot.v1.DeviceRegistry.Builder getDeviceRegistryBuilder() { - - onChanged(); - return getDeviceRegistryFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistryOrBuilder() { - if (deviceRegistryBuilder_ != null) { - return deviceRegistryBuilder_.getMessageOrBuilder(); - } else { - return deviceRegistry_ == null - ? com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance() - : deviceRegistry_; - } - } - /** - * - * - *
-     * Required. The device registry. The field `name` must be empty. The server will
-     * generate that field from the device registry `id` provided and the
-     * `parent` field.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder> - getDeviceRegistryFieldBuilder() { - if (deviceRegistryBuilder_ == null) { - deviceRegistryBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder>( - getDeviceRegistry(), getParentForChildren(), isClean()); - deviceRegistry_ = null; - } - return deviceRegistryBuilder_; - } - - @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.iot.v1.CreateDeviceRegistryRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.CreateDeviceRegistryRequest) - private static final com.google.cloud.iot.v1.CreateDeviceRegistryRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.CreateDeviceRegistryRequest(); - } - - public static com.google.cloud.iot.v1.CreateDeviceRegistryRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public CreateDeviceRegistryRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.CreateDeviceRegistryRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRegistryRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRegistryRequestOrBuilder.java deleted file mode 100644 index 260d95a0..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRegistryRequestOrBuilder.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface CreateDeviceRegistryRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.CreateDeviceRegistryRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The project and cloud region where this device registry must be created.
-   * For example, `projects/example-project/locations/us-central1`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - java.lang.String getParent(); - /** - * - * - *
-   * Required. The project and cloud region where this device registry must be created.
-   * For example, `projects/example-project/locations/us-central1`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - com.google.protobuf.ByteString getParentBytes(); - - /** - * - * - *
-   * Required. The device registry. The field `name` must be empty. The server will
-   * generate that field from the device registry `id` provided and the
-   * `parent` field.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the deviceRegistry field is set. - */ - boolean hasDeviceRegistry(); - /** - * - * - *
-   * Required. The device registry. The field `name` must be empty. The server will
-   * generate that field from the device registry `id` provided and the
-   * `parent` field.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The deviceRegistry. - */ - com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistry(); - /** - * - * - *
-   * Required. The device registry. The field `name` must be empty. The server will
-   * generate that field from the device registry `id` provided and the
-   * `parent` field.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistryOrBuilder(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRequest.java deleted file mode 100644 index 6a16af62..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRequest.java +++ /dev/null @@ -1,934 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `CreateDevice`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.CreateDeviceRequest} - */ -public final class CreateDeviceRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.CreateDeviceRequest) - CreateDeviceRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use CreateDeviceRequest.newBuilder() to construct. - private CreateDeviceRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private CreateDeviceRequest() { - parent_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new CreateDeviceRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.CreateDeviceRequest.class, - com.google.cloud.iot.v1.CreateDeviceRequest.Builder.class); - } - - public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; - /** - * - * - *
-   * Required. The name of the device registry where this device should be created.
-   * For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - @java.lang.Override - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the device registry where this device should be created.
-   * For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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 DEVICE_FIELD_NUMBER = 2; - private com.google.cloud.iot.v1.Device device_; - /** - * - * - *
-   * Required. The device registration details. The field `name` must be empty. The server
-   * generates `name` from the device registry `id` and the
-   * `parent` field.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return Whether the device field is set. - */ - @java.lang.Override - public boolean hasDevice() { - return device_ != null; - } - /** - * - * - *
-   * Required. The device registration details. The field `name` must be empty. The server
-   * generates `name` from the device registry `id` and the
-   * `parent` field.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The device. - */ - @java.lang.Override - public com.google.cloud.iot.v1.Device getDevice() { - return device_ == null ? com.google.cloud.iot.v1.Device.getDefaultInstance() : device_; - } - /** - * - * - *
-   * Required. The device registration details. The field `name` must be empty. The server
-   * generates `name` from the device registry `id` and the
-   * `parent` field.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceOrBuilder getDeviceOrBuilder() { - return getDevice(); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); - } - if (device_ != null) { - output.writeMessage(2, getDevice()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); - } - if (device_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDevice()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.CreateDeviceRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.CreateDeviceRequest other = - (com.google.cloud.iot.v1.CreateDeviceRequest) obj; - - if (!getParent().equals(other.getParent())) return false; - if (hasDevice() != other.hasDevice()) return false; - if (hasDevice()) { - if (!getDevice().equals(other.getDevice())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + PARENT_FIELD_NUMBER; - hash = (53 * hash) + getParent().hashCode(); - if (hasDevice()) { - hash = (37 * hash) + DEVICE_FIELD_NUMBER; - hash = (53 * hash) + getDevice().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest 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.iot.v1.CreateDeviceRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest 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.iot.v1.CreateDeviceRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest 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.iot.v1.CreateDeviceRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest 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.iot.v1.CreateDeviceRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest 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.iot.v1.CreateDeviceRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `CreateDevice`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.CreateDeviceRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.CreateDeviceRequest) - com.google.cloud.iot.v1.CreateDeviceRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.CreateDeviceRequest.class, - com.google.cloud.iot.v1.CreateDeviceRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.CreateDeviceRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - parent_ = ""; - - if (deviceBuilder_ == null) { - device_ = null; - } else { - device_ = null; - deviceBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_CreateDeviceRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.CreateDeviceRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.CreateDeviceRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.CreateDeviceRequest build() { - com.google.cloud.iot.v1.CreateDeviceRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.CreateDeviceRequest buildPartial() { - com.google.cloud.iot.v1.CreateDeviceRequest result = - new com.google.cloud.iot.v1.CreateDeviceRequest(this); - result.parent_ = parent_; - if (deviceBuilder_ == null) { - result.device_ = device_; - } else { - result.device_ = deviceBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.CreateDeviceRequest) { - return mergeFrom((com.google.cloud.iot.v1.CreateDeviceRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.CreateDeviceRequest other) { - if (other == com.google.cloud.iot.v1.CreateDeviceRequest.getDefaultInstance()) return this; - if (!other.getParent().isEmpty()) { - parent_ = other.parent_; - onChanged(); - } - if (other.hasDevice()) { - mergeDevice(other.getDevice()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - parent_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - input.readMessage(getDeviceFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object parent_ = ""; - /** - * - * - *
-     * Required. The name of the device registry where this device should be created.
-     * For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the device registry where this device should be created.
-     * For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - public com.google.protobuf.ByteString getParentBytes() { - java.lang.Object ref = parent_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - parent_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the device registry where this device should be created.
-     * For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The parent to set. - * @return This builder for chaining. - */ - public Builder setParent(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - parent_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device registry where this device should be created.
-     * For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearParent() { - - parent_ = getDefaultInstance().getParent(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device registry where this device should be created.
-     * For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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.iot.v1.Device device_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder> - deviceBuilder_; - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the device field is set. - */ - public boolean hasDevice() { - return deviceBuilder_ != null || device_ != null; - } - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The device. - */ - public com.google.cloud.iot.v1.Device getDevice() { - if (deviceBuilder_ == null) { - return device_ == null ? com.google.cloud.iot.v1.Device.getDefaultInstance() : device_; - } else { - return deviceBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDevice(com.google.cloud.iot.v1.Device value) { - if (deviceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - device_ = value; - onChanged(); - } else { - deviceBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDevice(com.google.cloud.iot.v1.Device.Builder builderForValue) { - if (deviceBuilder_ == null) { - device_ = builderForValue.build(); - onChanged(); - } else { - deviceBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDevice(com.google.cloud.iot.v1.Device value) { - if (deviceBuilder_ == null) { - if (device_ != null) { - device_ = - com.google.cloud.iot.v1.Device.newBuilder(device_).mergeFrom(value).buildPartial(); - } else { - device_ = value; - } - onChanged(); - } else { - deviceBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDevice() { - if (deviceBuilder_ == null) { - device_ = null; - onChanged(); - } else { - device_ = null; - deviceBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.iot.v1.Device.Builder getDeviceBuilder() { - - onChanged(); - return getDeviceFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.iot.v1.DeviceOrBuilder getDeviceOrBuilder() { - if (deviceBuilder_ != null) { - return deviceBuilder_.getMessageOrBuilder(); - } else { - return device_ == null ? com.google.cloud.iot.v1.Device.getDefaultInstance() : device_; - } - } - /** - * - * - *
-     * Required. The device registration details. The field `name` must be empty. The server
-     * generates `name` from the device registry `id` and the
-     * `parent` field.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder> - getDeviceFieldBuilder() { - if (deviceBuilder_ == null) { - deviceBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder>( - getDevice(), getParentForChildren(), isClean()); - device_ = null; - } - return deviceBuilder_; - } - - @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.iot.v1.CreateDeviceRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.CreateDeviceRequest) - private static final com.google.cloud.iot.v1.CreateDeviceRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.CreateDeviceRequest(); - } - - public static com.google.cloud.iot.v1.CreateDeviceRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public CreateDeviceRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.CreateDeviceRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRequestOrBuilder.java deleted file mode 100644 index 764d45cf..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRequestOrBuilder.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface CreateDeviceRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.CreateDeviceRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device registry where this device should be created.
-   * For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - java.lang.String getParent(); - /** - * - * - *
-   * Required. The name of the device registry where this device should be created.
-   * For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - com.google.protobuf.ByteString getParentBytes(); - - /** - * - * - *
-   * Required. The device registration details. The field `name` must be empty. The server
-   * generates `name` from the device registry `id` and the
-   * `parent` field.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return Whether the device field is set. - */ - boolean hasDevice(); - /** - * - * - *
-   * Required. The device registration details. The field `name` must be empty. The server
-   * generates `name` from the device registry `id` and the
-   * `parent` field.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The device. - */ - com.google.cloud.iot.v1.Device getDevice(); - /** - * - * - *
-   * Required. The device registration details. The field `name` must be empty. The server
-   * generates `name` from the device registry `id` and the
-   * `parent` field.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - com.google.cloud.iot.v1.DeviceOrBuilder getDeviceOrBuilder(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRegistryRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRegistryRequest.java deleted file mode 100644 index 12901f23..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRegistryRequest.java +++ /dev/null @@ -1,636 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `DeleteDeviceRegistry`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeleteDeviceRegistryRequest} - */ -public final class DeleteDeviceRegistryRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.DeleteDeviceRegistryRequest) - DeleteDeviceRegistryRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use DeleteDeviceRegistryRequest.newBuilder() to construct. - private DeleteDeviceRegistryRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private DeleteDeviceRegistryRequest() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeleteDeviceRegistryRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest.class, - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * Required. The name of the device registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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 device registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.DeleteDeviceRegistryRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest other = - (com.google.cloud.iot.v1.DeleteDeviceRegistryRequest) obj; - - if (!getName().equals(other.getName())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest 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.iot.v1.DeleteDeviceRegistryRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest 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.iot.v1.DeleteDeviceRegistryRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest 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.iot.v1.DeleteDeviceRegistryRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest 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.iot.v1.DeleteDeviceRegistryRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest 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.iot.v1.DeleteDeviceRegistryRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `DeleteDeviceRegistry`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeleteDeviceRegistryRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.DeleteDeviceRegistryRequest) - com.google.cloud.iot.v1.DeleteDeviceRegistryRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest.class, - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.DeleteDeviceRegistryRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeleteDeviceRegistryRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.DeleteDeviceRegistryRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeleteDeviceRegistryRequest build() { - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeleteDeviceRegistryRequest buildPartial() { - com.google.cloud.iot.v1.DeleteDeviceRegistryRequest result = - new com.google.cloud.iot.v1.DeleteDeviceRegistryRequest(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.iot.v1.DeleteDeviceRegistryRequest) { - return mergeFrom((com.google.cloud.iot.v1.DeleteDeviceRegistryRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.DeleteDeviceRegistryRequest other) { - if (other == com.google.cloud.iot.v1.DeleteDeviceRegistryRequest.getDefaultInstance()) - return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * Required. The name of the device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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.iot.v1.DeleteDeviceRegistryRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.DeleteDeviceRegistryRequest) - private static final com.google.cloud.iot.v1.DeleteDeviceRegistryRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.DeleteDeviceRegistryRequest(); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRegistryRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public DeleteDeviceRegistryRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeleteDeviceRegistryRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRegistryRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRegistryRequestOrBuilder.java deleted file mode 100644 index 17946cf9..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRegistryRequestOrBuilder.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface DeleteDeviceRegistryRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.DeleteDeviceRegistryRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * Required. The name of the device registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRequest.java deleted file mode 100644 index 33a078fc..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRequest.java +++ /dev/null @@ -1,642 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `DeleteDevice`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeleteDeviceRequest} - */ -public final class DeleteDeviceRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.DeleteDeviceRequest) - DeleteDeviceRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use DeleteDeviceRequest.newBuilder() to construct. - private DeleteDeviceRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private DeleteDeviceRequest() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeleteDeviceRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeleteDeviceRequest.class, - com.google.cloud.iot.v1.DeleteDeviceRequest.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.DeleteDeviceRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.DeleteDeviceRequest other = - (com.google.cloud.iot.v1.DeleteDeviceRequest) obj; - - if (!getName().equals(other.getName())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest 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.iot.v1.DeleteDeviceRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest 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.iot.v1.DeleteDeviceRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest 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.iot.v1.DeleteDeviceRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest 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.iot.v1.DeleteDeviceRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest 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.iot.v1.DeleteDeviceRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `DeleteDevice`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeleteDeviceRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.DeleteDeviceRequest) - com.google.cloud.iot.v1.DeleteDeviceRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeleteDeviceRequest.class, - com.google.cloud.iot.v1.DeleteDeviceRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.DeleteDeviceRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_DeleteDeviceRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeleteDeviceRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.DeleteDeviceRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeleteDeviceRequest build() { - com.google.cloud.iot.v1.DeleteDeviceRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeleteDeviceRequest buildPartial() { - com.google.cloud.iot.v1.DeleteDeviceRequest result = - new com.google.cloud.iot.v1.DeleteDeviceRequest(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.iot.v1.DeleteDeviceRequest) { - return mergeFrom((com.google.cloud.iot.v1.DeleteDeviceRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.DeleteDeviceRequest other) { - if (other == com.google.cloud.iot.v1.DeleteDeviceRequest.getDefaultInstance()) return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.DeleteDeviceRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.DeleteDeviceRequest) - private static final com.google.cloud.iot.v1.DeleteDeviceRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.DeleteDeviceRequest(); - } - - public static com.google.cloud.iot.v1.DeleteDeviceRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public DeleteDeviceRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeleteDeviceRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRequestOrBuilder.java deleted file mode 100644 index 86313705..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRequestOrBuilder.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface DeleteDeviceRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.DeleteDeviceRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/Device.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/Device.java deleted file mode 100644 index 1d37e7c2..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/Device.java +++ /dev/null @@ -1,5113 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The device resource.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.Device} - */ -public final class Device extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.Device) - DeviceOrBuilder { - private static final long serialVersionUID = 0L; - // Use Device.newBuilder() to construct. - private Device(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private Device() { - id_ = ""; - name_ = ""; - credentials_ = java.util.Collections.emptyList(); - logLevel_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new Device(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_Device_descriptor; - } - - @SuppressWarnings({"rawtypes"}) - @java.lang.Override - protected com.google.protobuf.MapField internalGetMapField(int number) { - switch (number) { - case 17: - return internalGetMetadata(); - default: - throw new RuntimeException("Invalid map field number: " + number); - } - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_Device_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.Device.class, com.google.cloud.iot.v1.Device.Builder.class); - } - - public static final int ID_FIELD_NUMBER = 1; - private volatile java.lang.Object id_; - /** - * - * - *
-   * The user-defined device identifier. The device ID must be unique
-   * within a device registry.
-   * 
- * - * string id = 1; - * - * @return The id. - */ - @java.lang.Override - public java.lang.String getId() { - java.lang.Object ref = id_; - 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(); - id_ = s; - return s; - } - } - /** - * - * - *
-   * The user-defined device identifier. The device ID must be unique
-   * within a device registry.
-   * 
- * - * string id = 1; - * - * @return The bytes for id. - */ - @java.lang.Override - public com.google.protobuf.ByteString getIdBytes() { - java.lang.Object ref = id_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - id_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int NAME_FIELD_NUMBER = 2; - private volatile java.lang.Object name_; - /** - * - * - *
-   * The resource path name. For example,
-   * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-   * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * When `name` is populated as a response from the service, it always ends
-   * in the device numeric ID.
-   * 
- * - * string name = 2; - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * The resource path name. For example,
-   * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-   * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * When `name` is populated as a response from the service, it always ends
-   * in the device numeric ID.
-   * 
- * - * string name = 2; - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int NUM_ID_FIELD_NUMBER = 3; - private long numId_; - /** - * - * - *
-   * [Output only] A server-defined unique numeric ID for the device. This is a
-   * more compact way to identify devices, and it is globally unique.
-   * 
- * - * uint64 num_id = 3; - * - * @return The numId. - */ - @java.lang.Override - public long getNumId() { - return numId_; - } - - public static final int CREDENTIALS_FIELD_NUMBER = 12; - private java.util.List credentials_; - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - @java.lang.Override - public java.util.List getCredentialsList() { - return credentials_; - } - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - @java.lang.Override - public java.util.List - getCredentialsOrBuilderList() { - return credentials_; - } - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - @java.lang.Override - public int getCredentialsCount() { - return credentials_.size(); - } - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceCredential getCredentials(int index) { - return credentials_.get(index); - } - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceCredentialOrBuilder getCredentialsOrBuilder(int index) { - return credentials_.get(index); - } - - public static final int LAST_HEARTBEAT_TIME_FIELD_NUMBER = 7; - private com.google.protobuf.Timestamp lastHeartbeatTime_; - /** - * - * - *
-   * [Output only] The last time an MQTT `PINGREQ` was received. This field
-   * applies only to devices connecting through MQTT. MQTT clients usually only
-   * send `PINGREQ` messages if the connection is idle, and no other messages
-   * have been sent. Timestamps are periodically collected and written to
-   * storage; they may be stale by a few minutes.
-   * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - * - * @return Whether the lastHeartbeatTime field is set. - */ - @java.lang.Override - public boolean hasLastHeartbeatTime() { - return lastHeartbeatTime_ != null; - } - /** - * - * - *
-   * [Output only] The last time an MQTT `PINGREQ` was received. This field
-   * applies only to devices connecting through MQTT. MQTT clients usually only
-   * send `PINGREQ` messages if the connection is idle, and no other messages
-   * have been sent. Timestamps are periodically collected and written to
-   * storage; they may be stale by a few minutes.
-   * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - * - * @return The lastHeartbeatTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getLastHeartbeatTime() { - return lastHeartbeatTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastHeartbeatTime_; - } - /** - * - * - *
-   * [Output only] The last time an MQTT `PINGREQ` was received. This field
-   * applies only to devices connecting through MQTT. MQTT clients usually only
-   * send `PINGREQ` messages if the connection is idle, and no other messages
-   * have been sent. Timestamps are periodically collected and written to
-   * storage; they may be stale by a few minutes.
-   * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getLastHeartbeatTimeOrBuilder() { - return getLastHeartbeatTime(); - } - - public static final int LAST_EVENT_TIME_FIELD_NUMBER = 8; - private com.google.protobuf.Timestamp lastEventTime_; - /** - * - * - *
-   * [Output only] The last time a telemetry event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - * - * @return Whether the lastEventTime field is set. - */ - @java.lang.Override - public boolean hasLastEventTime() { - return lastEventTime_ != null; - } - /** - * - * - *
-   * [Output only] The last time a telemetry event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - * - * @return The lastEventTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getLastEventTime() { - return lastEventTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastEventTime_; - } - /** - * - * - *
-   * [Output only] The last time a telemetry event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getLastEventTimeOrBuilder() { - return getLastEventTime(); - } - - public static final int LAST_STATE_TIME_FIELD_NUMBER = 20; - private com.google.protobuf.Timestamp lastStateTime_; - /** - * - * - *
-   * [Output only] The last time a state event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - * - * @return Whether the lastStateTime field is set. - */ - @java.lang.Override - public boolean hasLastStateTime() { - return lastStateTime_ != null; - } - /** - * - * - *
-   * [Output only] The last time a state event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - * - * @return The lastStateTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getLastStateTime() { - return lastStateTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastStateTime_; - } - /** - * - * - *
-   * [Output only] The last time a state event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getLastStateTimeOrBuilder() { - return getLastStateTime(); - } - - public static final int LAST_CONFIG_ACK_TIME_FIELD_NUMBER = 14; - private com.google.protobuf.Timestamp lastConfigAckTime_; - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version acknowledgment
-   * was received from the device. This field is only for configurations
-   * sent through MQTT.
-   * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - * - * @return Whether the lastConfigAckTime field is set. - */ - @java.lang.Override - public boolean hasLastConfigAckTime() { - return lastConfigAckTime_ != null; - } - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version acknowledgment
-   * was received from the device. This field is only for configurations
-   * sent through MQTT.
-   * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - * - * @return The lastConfigAckTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getLastConfigAckTime() { - return lastConfigAckTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastConfigAckTime_; - } - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version acknowledgment
-   * was received from the device. This field is only for configurations
-   * sent through MQTT.
-   * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getLastConfigAckTimeOrBuilder() { - return getLastConfigAckTime(); - } - - public static final int LAST_CONFIG_SEND_TIME_FIELD_NUMBER = 18; - private com.google.protobuf.Timestamp lastConfigSendTime_; - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version was sent to
-   * the device.
-   * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - * - * @return Whether the lastConfigSendTime field is set. - */ - @java.lang.Override - public boolean hasLastConfigSendTime() { - return lastConfigSendTime_ != null; - } - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version was sent to
-   * the device.
-   * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - * - * @return The lastConfigSendTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getLastConfigSendTime() { - return lastConfigSendTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastConfigSendTime_; - } - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version was sent to
-   * the device.
-   * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getLastConfigSendTimeOrBuilder() { - return getLastConfigSendTime(); - } - - public static final int BLOCKED_FIELD_NUMBER = 19; - private boolean blocked_; - /** - * - * - *
-   * If a device is blocked, connections or requests from this device will fail.
-   * Can be used to temporarily prevent the device from connecting if, for
-   * example, the sensor is generating bad data and needs maintenance.
-   * 
- * - * bool blocked = 19; - * - * @return The blocked. - */ - @java.lang.Override - public boolean getBlocked() { - return blocked_; - } - - public static final int LAST_ERROR_TIME_FIELD_NUMBER = 10; - private com.google.protobuf.Timestamp lastErrorTime_; - /** - * - * - *
-   * [Output only] The time the most recent error occurred, such as a failure to
-   * publish to Cloud Pub/Sub. This field is the timestamp of
-   * 'last_error_status'.
-   * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - * - * @return Whether the lastErrorTime field is set. - */ - @java.lang.Override - public boolean hasLastErrorTime() { - return lastErrorTime_ != null; - } - /** - * - * - *
-   * [Output only] The time the most recent error occurred, such as a failure to
-   * publish to Cloud Pub/Sub. This field is the timestamp of
-   * 'last_error_status'.
-   * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - * - * @return The lastErrorTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getLastErrorTime() { - return lastErrorTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastErrorTime_; - } - /** - * - * - *
-   * [Output only] The time the most recent error occurred, such as a failure to
-   * publish to Cloud Pub/Sub. This field is the timestamp of
-   * 'last_error_status'.
-   * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getLastErrorTimeOrBuilder() { - return getLastErrorTime(); - } - - public static final int LAST_ERROR_STATUS_FIELD_NUMBER = 11; - private com.google.rpc.Status lastErrorStatus_; - /** - * - * - *
-   * [Output only] The error message of the most recent error, such as a failure
-   * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-   * field. If no errors have occurred, this field has an empty message
-   * and the status code 0 == OK. Otherwise, this field is expected to have a
-   * status code other than OK.
-   * 
- * - * .google.rpc.Status last_error_status = 11; - * - * @return Whether the lastErrorStatus field is set. - */ - @java.lang.Override - public boolean hasLastErrorStatus() { - return lastErrorStatus_ != null; - } - /** - * - * - *
-   * [Output only] The error message of the most recent error, such as a failure
-   * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-   * field. If no errors have occurred, this field has an empty message
-   * and the status code 0 == OK. Otherwise, this field is expected to have a
-   * status code other than OK.
-   * 
- * - * .google.rpc.Status last_error_status = 11; - * - * @return The lastErrorStatus. - */ - @java.lang.Override - public com.google.rpc.Status getLastErrorStatus() { - return lastErrorStatus_ == null ? com.google.rpc.Status.getDefaultInstance() : lastErrorStatus_; - } - /** - * - * - *
-   * [Output only] The error message of the most recent error, such as a failure
-   * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-   * field. If no errors have occurred, this field has an empty message
-   * and the status code 0 == OK. Otherwise, this field is expected to have a
-   * status code other than OK.
-   * 
- * - * .google.rpc.Status last_error_status = 11; - */ - @java.lang.Override - public com.google.rpc.StatusOrBuilder getLastErrorStatusOrBuilder() { - return getLastErrorStatus(); - } - - public static final int CONFIG_FIELD_NUMBER = 13; - private com.google.cloud.iot.v1.DeviceConfig config_; - /** - * - * - *
-   * The most recent device configuration, which is eventually sent from
-   * Cloud IoT Core to the device. If not present on creation, the
-   * configuration will be initialized with an empty payload and version value
-   * of `1`. To update this field after creation, use the
-   * `DeviceManager.ModifyCloudToDeviceConfig` method.
-   * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - * - * @return Whether the config field is set. - */ - @java.lang.Override - public boolean hasConfig() { - return config_ != null; - } - /** - * - * - *
-   * The most recent device configuration, which is eventually sent from
-   * Cloud IoT Core to the device. If not present on creation, the
-   * configuration will be initialized with an empty payload and version value
-   * of `1`. To update this field after creation, use the
-   * `DeviceManager.ModifyCloudToDeviceConfig` method.
-   * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - * - * @return The config. - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceConfig getConfig() { - return config_ == null ? com.google.cloud.iot.v1.DeviceConfig.getDefaultInstance() : config_; - } - /** - * - * - *
-   * The most recent device configuration, which is eventually sent from
-   * Cloud IoT Core to the device. If not present on creation, the
-   * configuration will be initialized with an empty payload and version value
-   * of `1`. To update this field after creation, use the
-   * `DeviceManager.ModifyCloudToDeviceConfig` method.
-   * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceConfigOrBuilder getConfigOrBuilder() { - return getConfig(); - } - - public static final int STATE_FIELD_NUMBER = 16; - private com.google.cloud.iot.v1.DeviceState state_; - /** - * - * - *
-   * [Output only] The state most recently received from the device. If no state
-   * has been reported, this field is not present.
-   * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - * - * @return Whether the state field is set. - */ - @java.lang.Override - public boolean hasState() { - return state_ != null; - } - /** - * - * - *
-   * [Output only] The state most recently received from the device. If no state
-   * has been reported, this field is not present.
-   * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - * - * @return The state. - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceState getState() { - return state_ == null ? com.google.cloud.iot.v1.DeviceState.getDefaultInstance() : state_; - } - /** - * - * - *
-   * [Output only] The state most recently received from the device. If no state
-   * has been reported, this field is not present.
-   * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceStateOrBuilder getStateOrBuilder() { - return getState(); - } - - public static final int LOG_LEVEL_FIELD_NUMBER = 21; - private int logLevel_; - /** - * - * - *
-   * **Beta Feature**
-   * The logging verbosity for device activity. If unspecified,
-   * DeviceRegistry.log_level will be used.
-   * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @return The enum numeric value on the wire for logLevel. - */ - @java.lang.Override - public int getLogLevelValue() { - return logLevel_; - } - /** - * - * - *
-   * **Beta Feature**
-   * The logging verbosity for device activity. If unspecified,
-   * DeviceRegistry.log_level will be used.
-   * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @return The logLevel. - */ - @java.lang.Override - public com.google.cloud.iot.v1.LogLevel getLogLevel() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.LogLevel result = com.google.cloud.iot.v1.LogLevel.valueOf(logLevel_); - return result == null ? com.google.cloud.iot.v1.LogLevel.UNRECOGNIZED : result; - } - - public static final int METADATA_FIELD_NUMBER = 17; - - private static final class MetadataDefaultEntryHolder { - static final com.google.protobuf.MapEntry defaultEntry = - com.google.protobuf.MapEntry.newDefaultInstance( - com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_Device_MetadataEntry_descriptor, - com.google.protobuf.WireFormat.FieldType.STRING, - "", - com.google.protobuf.WireFormat.FieldType.STRING, - ""); - } - - private com.google.protobuf.MapField metadata_; - - private com.google.protobuf.MapField internalGetMetadata() { - if (metadata_ == null) { - return com.google.protobuf.MapField.emptyMapField(MetadataDefaultEntryHolder.defaultEntry); - } - return metadata_; - } - - public int getMetadataCount() { - return internalGetMetadata().getMap().size(); - } - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - @java.lang.Override - public boolean containsMetadata(java.lang.String key) { - if (key == null) { - throw new NullPointerException("map key"); - } - return internalGetMetadata().getMap().containsKey(key); - } - /** Use {@link #getMetadataMap()} instead. */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getMetadata() { - return getMetadataMap(); - } - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - @java.lang.Override - public java.util.Map getMetadataMap() { - return internalGetMetadata().getMap(); - } - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - @java.lang.Override - public java.lang.String getMetadataOrDefault( - java.lang.String key, java.lang.String defaultValue) { - if (key == null) { - throw new NullPointerException("map key"); - } - java.util.Map map = internalGetMetadata().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - @java.lang.Override - public java.lang.String getMetadataOrThrow(java.lang.String key) { - if (key == null) { - throw new NullPointerException("map key"); - } - java.util.Map map = internalGetMetadata().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); - } - return map.get(key); - } - - public static final int GATEWAY_CONFIG_FIELD_NUMBER = 24; - private com.google.cloud.iot.v1.GatewayConfig gatewayConfig_; - /** - * - * - *
-   * Gateway-related configuration and state.
-   * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - * - * @return Whether the gatewayConfig field is set. - */ - @java.lang.Override - public boolean hasGatewayConfig() { - return gatewayConfig_ != null; - } - /** - * - * - *
-   * Gateway-related configuration and state.
-   * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - * - * @return The gatewayConfig. - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayConfig getGatewayConfig() { - return gatewayConfig_ == null - ? com.google.cloud.iot.v1.GatewayConfig.getDefaultInstance() - : gatewayConfig_; - } - /** - * - * - *
-   * Gateway-related configuration and state.
-   * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayConfigOrBuilder getGatewayConfigOrBuilder() { - return getGatewayConfig(); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_); - } - if (numId_ != 0L) { - output.writeUInt64(3, numId_); - } - if (lastHeartbeatTime_ != null) { - output.writeMessage(7, getLastHeartbeatTime()); - } - if (lastEventTime_ != null) { - output.writeMessage(8, getLastEventTime()); - } - if (lastErrorTime_ != null) { - output.writeMessage(10, getLastErrorTime()); - } - if (lastErrorStatus_ != null) { - output.writeMessage(11, getLastErrorStatus()); - } - for (int i = 0; i < credentials_.size(); i++) { - output.writeMessage(12, credentials_.get(i)); - } - if (config_ != null) { - output.writeMessage(13, getConfig()); - } - if (lastConfigAckTime_ != null) { - output.writeMessage(14, getLastConfigAckTime()); - } - if (state_ != null) { - output.writeMessage(16, getState()); - } - com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( - output, internalGetMetadata(), MetadataDefaultEntryHolder.defaultEntry, 17); - if (lastConfigSendTime_ != null) { - output.writeMessage(18, getLastConfigSendTime()); - } - if (blocked_ != false) { - output.writeBool(19, blocked_); - } - if (lastStateTime_ != null) { - output.writeMessage(20, getLastStateTime()); - } - if (logLevel_ != com.google.cloud.iot.v1.LogLevel.LOG_LEVEL_UNSPECIFIED.getNumber()) { - output.writeEnum(21, logLevel_); - } - if (gatewayConfig_ != null) { - output.writeMessage(24, getGatewayConfig()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_); - } - if (numId_ != 0L) { - size += com.google.protobuf.CodedOutputStream.computeUInt64Size(3, numId_); - } - if (lastHeartbeatTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, getLastHeartbeatTime()); - } - if (lastEventTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, getLastEventTime()); - } - if (lastErrorTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(10, getLastErrorTime()); - } - if (lastErrorStatus_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(11, getLastErrorStatus()); - } - for (int i = 0; i < credentials_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(12, credentials_.get(i)); - } - if (config_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(13, getConfig()); - } - if (lastConfigAckTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(14, getLastConfigAckTime()); - } - if (state_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(16, getState()); - } - for (java.util.Map.Entry entry : - internalGetMetadata().getMap().entrySet()) { - com.google.protobuf.MapEntry metadata__ = - MetadataDefaultEntryHolder.defaultEntry - .newBuilderForType() - .setKey(entry.getKey()) - .setValue(entry.getValue()) - .build(); - size += com.google.protobuf.CodedOutputStream.computeMessageSize(17, metadata__); - } - if (lastConfigSendTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(18, getLastConfigSendTime()); - } - if (blocked_ != false) { - size += com.google.protobuf.CodedOutputStream.computeBoolSize(19, blocked_); - } - if (lastStateTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(20, getLastStateTime()); - } - if (logLevel_ != com.google.cloud.iot.v1.LogLevel.LOG_LEVEL_UNSPECIFIED.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(21, logLevel_); - } - if (gatewayConfig_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(24, getGatewayConfig()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.Device)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.Device other = (com.google.cloud.iot.v1.Device) obj; - - if (!getId().equals(other.getId())) return false; - if (!getName().equals(other.getName())) return false; - if (getNumId() != other.getNumId()) return false; - if (!getCredentialsList().equals(other.getCredentialsList())) return false; - if (hasLastHeartbeatTime() != other.hasLastHeartbeatTime()) return false; - if (hasLastHeartbeatTime()) { - if (!getLastHeartbeatTime().equals(other.getLastHeartbeatTime())) return false; - } - if (hasLastEventTime() != other.hasLastEventTime()) return false; - if (hasLastEventTime()) { - if (!getLastEventTime().equals(other.getLastEventTime())) return false; - } - if (hasLastStateTime() != other.hasLastStateTime()) return false; - if (hasLastStateTime()) { - if (!getLastStateTime().equals(other.getLastStateTime())) return false; - } - if (hasLastConfigAckTime() != other.hasLastConfigAckTime()) return false; - if (hasLastConfigAckTime()) { - if (!getLastConfigAckTime().equals(other.getLastConfigAckTime())) return false; - } - if (hasLastConfigSendTime() != other.hasLastConfigSendTime()) return false; - if (hasLastConfigSendTime()) { - if (!getLastConfigSendTime().equals(other.getLastConfigSendTime())) return false; - } - if (getBlocked() != other.getBlocked()) return false; - if (hasLastErrorTime() != other.hasLastErrorTime()) return false; - if (hasLastErrorTime()) { - if (!getLastErrorTime().equals(other.getLastErrorTime())) return false; - } - if (hasLastErrorStatus() != other.hasLastErrorStatus()) return false; - if (hasLastErrorStatus()) { - if (!getLastErrorStatus().equals(other.getLastErrorStatus())) return false; - } - if (hasConfig() != other.hasConfig()) return false; - if (hasConfig()) { - if (!getConfig().equals(other.getConfig())) return false; - } - if (hasState() != other.hasState()) return false; - if (hasState()) { - if (!getState().equals(other.getState())) return false; - } - if (logLevel_ != other.logLevel_) return false; - if (!internalGetMetadata().equals(other.internalGetMetadata())) return false; - if (hasGatewayConfig() != other.hasGatewayConfig()) return false; - if (hasGatewayConfig()) { - if (!getGatewayConfig().equals(other.getGatewayConfig())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + ID_FIELD_NUMBER; - hash = (53 * hash) + getId().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + NUM_ID_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getNumId()); - if (getCredentialsCount() > 0) { - hash = (37 * hash) + CREDENTIALS_FIELD_NUMBER; - hash = (53 * hash) + getCredentialsList().hashCode(); - } - if (hasLastHeartbeatTime()) { - hash = (37 * hash) + LAST_HEARTBEAT_TIME_FIELD_NUMBER; - hash = (53 * hash) + getLastHeartbeatTime().hashCode(); - } - if (hasLastEventTime()) { - hash = (37 * hash) + LAST_EVENT_TIME_FIELD_NUMBER; - hash = (53 * hash) + getLastEventTime().hashCode(); - } - if (hasLastStateTime()) { - hash = (37 * hash) + LAST_STATE_TIME_FIELD_NUMBER; - hash = (53 * hash) + getLastStateTime().hashCode(); - } - if (hasLastConfigAckTime()) { - hash = (37 * hash) + LAST_CONFIG_ACK_TIME_FIELD_NUMBER; - hash = (53 * hash) + getLastConfigAckTime().hashCode(); - } - if (hasLastConfigSendTime()) { - hash = (37 * hash) + LAST_CONFIG_SEND_TIME_FIELD_NUMBER; - hash = (53 * hash) + getLastConfigSendTime().hashCode(); - } - hash = (37 * hash) + BLOCKED_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getBlocked()); - if (hasLastErrorTime()) { - hash = (37 * hash) + LAST_ERROR_TIME_FIELD_NUMBER; - hash = (53 * hash) + getLastErrorTime().hashCode(); - } - if (hasLastErrorStatus()) { - hash = (37 * hash) + LAST_ERROR_STATUS_FIELD_NUMBER; - hash = (53 * hash) + getLastErrorStatus().hashCode(); - } - if (hasConfig()) { - hash = (37 * hash) + CONFIG_FIELD_NUMBER; - hash = (53 * hash) + getConfig().hashCode(); - } - if (hasState()) { - hash = (37 * hash) + STATE_FIELD_NUMBER; - hash = (53 * hash) + getState().hashCode(); - } - hash = (37 * hash) + LOG_LEVEL_FIELD_NUMBER; - hash = (53 * hash) + logLevel_; - if (!internalGetMetadata().getMap().isEmpty()) { - hash = (37 * hash) + METADATA_FIELD_NUMBER; - hash = (53 * hash) + internalGetMetadata().hashCode(); - } - if (hasGatewayConfig()) { - hash = (37 * hash) + GATEWAY_CONFIG_FIELD_NUMBER; - hash = (53 * hash) + getGatewayConfig().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.Device parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.Device 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.iot.v1.Device parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.Device 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.iot.v1.Device parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.Device parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.Device parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.Device 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.iot.v1.Device parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.Device 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.iot.v1.Device parseFrom(com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.Device 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.iot.v1.Device 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 device resource.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.Device} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.Device) - com.google.cloud.iot.v1.DeviceOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_Device_descriptor; - } - - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMapField(int number) { - switch (number) { - case 17: - return internalGetMetadata(); - default: - throw new RuntimeException("Invalid map field number: " + number); - } - } - - @SuppressWarnings({"rawtypes"}) - protected com.google.protobuf.MapField internalGetMutableMapField(int number) { - switch (number) { - case 17: - return internalGetMutableMetadata(); - default: - throw new RuntimeException("Invalid map field number: " + number); - } - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_Device_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.Device.class, com.google.cloud.iot.v1.Device.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.Device.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - id_ = ""; - - name_ = ""; - - numId_ = 0L; - - if (credentialsBuilder_ == null) { - credentials_ = java.util.Collections.emptyList(); - } else { - credentials_ = null; - credentialsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (lastHeartbeatTimeBuilder_ == null) { - lastHeartbeatTime_ = null; - } else { - lastHeartbeatTime_ = null; - lastHeartbeatTimeBuilder_ = null; - } - if (lastEventTimeBuilder_ == null) { - lastEventTime_ = null; - } else { - lastEventTime_ = null; - lastEventTimeBuilder_ = null; - } - if (lastStateTimeBuilder_ == null) { - lastStateTime_ = null; - } else { - lastStateTime_ = null; - lastStateTimeBuilder_ = null; - } - if (lastConfigAckTimeBuilder_ == null) { - lastConfigAckTime_ = null; - } else { - lastConfigAckTime_ = null; - lastConfigAckTimeBuilder_ = null; - } - if (lastConfigSendTimeBuilder_ == null) { - lastConfigSendTime_ = null; - } else { - lastConfigSendTime_ = null; - lastConfigSendTimeBuilder_ = null; - } - blocked_ = false; - - if (lastErrorTimeBuilder_ == null) { - lastErrorTime_ = null; - } else { - lastErrorTime_ = null; - lastErrorTimeBuilder_ = null; - } - if (lastErrorStatusBuilder_ == null) { - lastErrorStatus_ = null; - } else { - lastErrorStatus_ = null; - lastErrorStatusBuilder_ = null; - } - if (configBuilder_ == null) { - config_ = null; - } else { - config_ = null; - configBuilder_ = null; - } - if (stateBuilder_ == null) { - state_ = null; - } else { - state_ = null; - stateBuilder_ = null; - } - logLevel_ = 0; - - internalGetMutableMetadata().clear(); - if (gatewayConfigBuilder_ == null) { - gatewayConfig_ = null; - } else { - gatewayConfig_ = null; - gatewayConfigBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_Device_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.Device getDefaultInstanceForType() { - return com.google.cloud.iot.v1.Device.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.Device build() { - com.google.cloud.iot.v1.Device result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.Device buildPartial() { - com.google.cloud.iot.v1.Device result = new com.google.cloud.iot.v1.Device(this); - int from_bitField0_ = bitField0_; - result.id_ = id_; - result.name_ = name_; - result.numId_ = numId_; - if (credentialsBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - credentials_ = java.util.Collections.unmodifiableList(credentials_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.credentials_ = credentials_; - } else { - result.credentials_ = credentialsBuilder_.build(); - } - if (lastHeartbeatTimeBuilder_ == null) { - result.lastHeartbeatTime_ = lastHeartbeatTime_; - } else { - result.lastHeartbeatTime_ = lastHeartbeatTimeBuilder_.build(); - } - if (lastEventTimeBuilder_ == null) { - result.lastEventTime_ = lastEventTime_; - } else { - result.lastEventTime_ = lastEventTimeBuilder_.build(); - } - if (lastStateTimeBuilder_ == null) { - result.lastStateTime_ = lastStateTime_; - } else { - result.lastStateTime_ = lastStateTimeBuilder_.build(); - } - if (lastConfigAckTimeBuilder_ == null) { - result.lastConfigAckTime_ = lastConfigAckTime_; - } else { - result.lastConfigAckTime_ = lastConfigAckTimeBuilder_.build(); - } - if (lastConfigSendTimeBuilder_ == null) { - result.lastConfigSendTime_ = lastConfigSendTime_; - } else { - result.lastConfigSendTime_ = lastConfigSendTimeBuilder_.build(); - } - result.blocked_ = blocked_; - if (lastErrorTimeBuilder_ == null) { - result.lastErrorTime_ = lastErrorTime_; - } else { - result.lastErrorTime_ = lastErrorTimeBuilder_.build(); - } - if (lastErrorStatusBuilder_ == null) { - result.lastErrorStatus_ = lastErrorStatus_; - } else { - result.lastErrorStatus_ = lastErrorStatusBuilder_.build(); - } - if (configBuilder_ == null) { - result.config_ = config_; - } else { - result.config_ = configBuilder_.build(); - } - if (stateBuilder_ == null) { - result.state_ = state_; - } else { - result.state_ = stateBuilder_.build(); - } - result.logLevel_ = logLevel_; - result.metadata_ = internalGetMetadata(); - result.metadata_.makeImmutable(); - if (gatewayConfigBuilder_ == null) { - result.gatewayConfig_ = gatewayConfig_; - } else { - result.gatewayConfig_ = gatewayConfigBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.Device) { - return mergeFrom((com.google.cloud.iot.v1.Device) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.Device other) { - if (other == com.google.cloud.iot.v1.Device.getDefaultInstance()) return this; - if (!other.getId().isEmpty()) { - id_ = other.id_; - onChanged(); - } - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (other.getNumId() != 0L) { - setNumId(other.getNumId()); - } - if (credentialsBuilder_ == null) { - if (!other.credentials_.isEmpty()) { - if (credentials_.isEmpty()) { - credentials_ = other.credentials_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureCredentialsIsMutable(); - credentials_.addAll(other.credentials_); - } - onChanged(); - } - } else { - if (!other.credentials_.isEmpty()) { - if (credentialsBuilder_.isEmpty()) { - credentialsBuilder_.dispose(); - credentialsBuilder_ = null; - credentials_ = other.credentials_; - bitField0_ = (bitField0_ & ~0x00000001); - credentialsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getCredentialsFieldBuilder() - : null; - } else { - credentialsBuilder_.addAllMessages(other.credentials_); - } - } - } - if (other.hasLastHeartbeatTime()) { - mergeLastHeartbeatTime(other.getLastHeartbeatTime()); - } - if (other.hasLastEventTime()) { - mergeLastEventTime(other.getLastEventTime()); - } - if (other.hasLastStateTime()) { - mergeLastStateTime(other.getLastStateTime()); - } - if (other.hasLastConfigAckTime()) { - mergeLastConfigAckTime(other.getLastConfigAckTime()); - } - if (other.hasLastConfigSendTime()) { - mergeLastConfigSendTime(other.getLastConfigSendTime()); - } - if (other.getBlocked() != false) { - setBlocked(other.getBlocked()); - } - if (other.hasLastErrorTime()) { - mergeLastErrorTime(other.getLastErrorTime()); - } - if (other.hasLastErrorStatus()) { - mergeLastErrorStatus(other.getLastErrorStatus()); - } - if (other.hasConfig()) { - mergeConfig(other.getConfig()); - } - if (other.hasState()) { - mergeState(other.getState()); - } - if (other.logLevel_ != 0) { - setLogLevelValue(other.getLogLevelValue()); - } - internalGetMutableMetadata().mergeFrom(other.internalGetMetadata()); - if (other.hasGatewayConfig()) { - mergeGatewayConfig(other.getGatewayConfig()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - id_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 18 - case 24: - { - numId_ = input.readUInt64(); - - break; - } // case 24 - case 58: - { - input.readMessage( - getLastHeartbeatTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 58 - case 66: - { - input.readMessage(getLastEventTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 66 - case 82: - { - input.readMessage(getLastErrorTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 82 - case 90: - { - input.readMessage(getLastErrorStatusFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 90 - case 98: - { - com.google.cloud.iot.v1.DeviceCredential m = - input.readMessage( - com.google.cloud.iot.v1.DeviceCredential.parser(), extensionRegistry); - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.add(m); - } else { - credentialsBuilder_.addMessage(m); - } - break; - } // case 98 - case 106: - { - input.readMessage(getConfigFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 106 - case 114: - { - input.readMessage( - getLastConfigAckTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 114 - case 130: - { - input.readMessage(getStateFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 130 - case 138: - { - com.google.protobuf.MapEntry metadata__ = - input.readMessage( - MetadataDefaultEntryHolder.defaultEntry.getParserForType(), - extensionRegistry); - internalGetMutableMetadata() - .getMutableMap() - .put(metadata__.getKey(), metadata__.getValue()); - break; - } // case 138 - case 146: - { - input.readMessage( - getLastConfigSendTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 146 - case 152: - { - blocked_ = input.readBool(); - - break; - } // case 152 - case 162: - { - input.readMessage(getLastStateTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 162 - case 168: - { - logLevel_ = input.readEnum(); - - break; - } // case 168 - case 194: - { - input.readMessage(getGatewayConfigFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 194 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.lang.Object id_ = ""; - /** - * - * - *
-     * The user-defined device identifier. The device ID must be unique
-     * within a device registry.
-     * 
- * - * string id = 1; - * - * @return The id. - */ - public java.lang.String getId() { - java.lang.Object ref = id_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - id_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The user-defined device identifier. The device ID must be unique
-     * within a device registry.
-     * 
- * - * string id = 1; - * - * @return The bytes for id. - */ - public com.google.protobuf.ByteString getIdBytes() { - java.lang.Object ref = id_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - id_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The user-defined device identifier. The device ID must be unique
-     * within a device registry.
-     * 
- * - * string id = 1; - * - * @param value The id to set. - * @return This builder for chaining. - */ - public Builder setId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - id_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The user-defined device identifier. The device ID must be unique
-     * within a device registry.
-     * 
- * - * string id = 1; - * - * @return This builder for chaining. - */ - public Builder clearId() { - - id_ = getDefaultInstance().getId(); - onChanged(); - return this; - } - /** - * - * - *
-     * The user-defined device identifier. The device ID must be unique
-     * within a device registry.
-     * 
- * - * string id = 1; - * - * @param value The bytes for id to set. - * @return This builder for chaining. - */ - public Builder setIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - id_ = value; - onChanged(); - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-     * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * When `name` is populated as a response from the service, it always ends
-     * in the device numeric ID.
-     * 
- * - * string name = 2; - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-     * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * When `name` is populated as a response from the service, it always ends
-     * in the device numeric ID.
-     * 
- * - * string name = 2; - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-     * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * When `name` is populated as a response from the service, it always ends
-     * in the device numeric ID.
-     * 
- * - * string name = 2; - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-     * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * When `name` is populated as a response from the service, it always ends
-     * in the device numeric ID.
-     * 
- * - * string name = 2; - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-     * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * When `name` is populated as a response from the service, it always ends
-     * in the device numeric ID.
-     * 
- * - * string name = 2; - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private long numId_; - /** - * - * - *
-     * [Output only] A server-defined unique numeric ID for the device. This is a
-     * more compact way to identify devices, and it is globally unique.
-     * 
- * - * uint64 num_id = 3; - * - * @return The numId. - */ - @java.lang.Override - public long getNumId() { - return numId_; - } - /** - * - * - *
-     * [Output only] A server-defined unique numeric ID for the device. This is a
-     * more compact way to identify devices, and it is globally unique.
-     * 
- * - * uint64 num_id = 3; - * - * @param value The numId to set. - * @return This builder for chaining. - */ - public Builder setNumId(long value) { - - numId_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * [Output only] A server-defined unique numeric ID for the device. This is a
-     * more compact way to identify devices, and it is globally unique.
-     * 
- * - * uint64 num_id = 3; - * - * @return This builder for chaining. - */ - public Builder clearNumId() { - - numId_ = 0L; - onChanged(); - return this; - } - - private java.util.List credentials_ = - java.util.Collections.emptyList(); - - private void ensureCredentialsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - credentials_ = - new java.util.ArrayList(credentials_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceCredential, - com.google.cloud.iot.v1.DeviceCredential.Builder, - com.google.cloud.iot.v1.DeviceCredentialOrBuilder> - credentialsBuilder_; - - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public java.util.List getCredentialsList() { - if (credentialsBuilder_ == null) { - return java.util.Collections.unmodifiableList(credentials_); - } else { - return credentialsBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public int getCredentialsCount() { - if (credentialsBuilder_ == null) { - return credentials_.size(); - } else { - return credentialsBuilder_.getCount(); - } - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public com.google.cloud.iot.v1.DeviceCredential getCredentials(int index) { - if (credentialsBuilder_ == null) { - return credentials_.get(index); - } else { - return credentialsBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder setCredentials(int index, com.google.cloud.iot.v1.DeviceCredential value) { - if (credentialsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCredentialsIsMutable(); - credentials_.set(index, value); - onChanged(); - } else { - credentialsBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder setCredentials( - int index, com.google.cloud.iot.v1.DeviceCredential.Builder builderForValue) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.set(index, builderForValue.build()); - onChanged(); - } else { - credentialsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder addCredentials(com.google.cloud.iot.v1.DeviceCredential value) { - if (credentialsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCredentialsIsMutable(); - credentials_.add(value); - onChanged(); - } else { - credentialsBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder addCredentials(int index, com.google.cloud.iot.v1.DeviceCredential value) { - if (credentialsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCredentialsIsMutable(); - credentials_.add(index, value); - onChanged(); - } else { - credentialsBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder addCredentials( - com.google.cloud.iot.v1.DeviceCredential.Builder builderForValue) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.add(builderForValue.build()); - onChanged(); - } else { - credentialsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder addCredentials( - int index, com.google.cloud.iot.v1.DeviceCredential.Builder builderForValue) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.add(index, builderForValue.build()); - onChanged(); - } else { - credentialsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder addAllCredentials( - java.lang.Iterable values) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, credentials_); - onChanged(); - } else { - credentialsBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder clearCredentials() { - if (credentialsBuilder_ == null) { - credentials_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - credentialsBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public Builder removeCredentials(int index) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.remove(index); - onChanged(); - } else { - credentialsBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public com.google.cloud.iot.v1.DeviceCredential.Builder getCredentialsBuilder(int index) { - return getCredentialsFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public com.google.cloud.iot.v1.DeviceCredentialOrBuilder getCredentialsOrBuilder(int index) { - if (credentialsBuilder_ == null) { - return credentials_.get(index); - } else { - return credentialsBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public java.util.List - getCredentialsOrBuilderList() { - if (credentialsBuilder_ != null) { - return credentialsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(credentials_); - } - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public com.google.cloud.iot.v1.DeviceCredential.Builder addCredentialsBuilder() { - return getCredentialsFieldBuilder() - .addBuilder(com.google.cloud.iot.v1.DeviceCredential.getDefaultInstance()); - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public com.google.cloud.iot.v1.DeviceCredential.Builder addCredentialsBuilder(int index) { - return getCredentialsFieldBuilder() - .addBuilder(index, com.google.cloud.iot.v1.DeviceCredential.getDefaultInstance()); - } - /** - * - * - *
-     * The credentials used to authenticate this device. To allow credential
-     * rotation without interruption, multiple device credentials can be bound to
-     * this device. No more than 3 credentials can be bound to a single device at
-     * a time. When new credentials are added to a device, they are verified
-     * against the registry credentials. For details, see the description of the
-     * `DeviceRegistry.credentials` field.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - public java.util.List - getCredentialsBuilderList() { - return getCredentialsFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceCredential, - com.google.cloud.iot.v1.DeviceCredential.Builder, - com.google.cloud.iot.v1.DeviceCredentialOrBuilder> - getCredentialsFieldBuilder() { - if (credentialsBuilder_ == null) { - credentialsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceCredential, - com.google.cloud.iot.v1.DeviceCredential.Builder, - com.google.cloud.iot.v1.DeviceCredentialOrBuilder>( - credentials_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - credentials_ = null; - } - return credentialsBuilder_; - } - - private com.google.protobuf.Timestamp lastHeartbeatTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - lastHeartbeatTimeBuilder_; - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - * - * @return Whether the lastHeartbeatTime field is set. - */ - public boolean hasLastHeartbeatTime() { - return lastHeartbeatTimeBuilder_ != null || lastHeartbeatTime_ != null; - } - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - * - * @return The lastHeartbeatTime. - */ - public com.google.protobuf.Timestamp getLastHeartbeatTime() { - if (lastHeartbeatTimeBuilder_ == null) { - return lastHeartbeatTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastHeartbeatTime_; - } else { - return lastHeartbeatTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - public Builder setLastHeartbeatTime(com.google.protobuf.Timestamp value) { - if (lastHeartbeatTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lastHeartbeatTime_ = value; - onChanged(); - } else { - lastHeartbeatTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - public Builder setLastHeartbeatTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (lastHeartbeatTimeBuilder_ == null) { - lastHeartbeatTime_ = builderForValue.build(); - onChanged(); - } else { - lastHeartbeatTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - public Builder mergeLastHeartbeatTime(com.google.protobuf.Timestamp value) { - if (lastHeartbeatTimeBuilder_ == null) { - if (lastHeartbeatTime_ != null) { - lastHeartbeatTime_ = - com.google.protobuf.Timestamp.newBuilder(lastHeartbeatTime_) - .mergeFrom(value) - .buildPartial(); - } else { - lastHeartbeatTime_ = value; - } - onChanged(); - } else { - lastHeartbeatTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - public Builder clearLastHeartbeatTime() { - if (lastHeartbeatTimeBuilder_ == null) { - lastHeartbeatTime_ = null; - onChanged(); - } else { - lastHeartbeatTime_ = null; - lastHeartbeatTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - public com.google.protobuf.Timestamp.Builder getLastHeartbeatTimeBuilder() { - - onChanged(); - return getLastHeartbeatTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - public com.google.protobuf.TimestampOrBuilder getLastHeartbeatTimeOrBuilder() { - if (lastHeartbeatTimeBuilder_ != null) { - return lastHeartbeatTimeBuilder_.getMessageOrBuilder(); - } else { - return lastHeartbeatTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastHeartbeatTime_; - } - } - /** - * - * - *
-     * [Output only] The last time an MQTT `PINGREQ` was received. This field
-     * applies only to devices connecting through MQTT. MQTT clients usually only
-     * send `PINGREQ` messages if the connection is idle, and no other messages
-     * have been sent. Timestamps are periodically collected and written to
-     * storage; they may be stale by a few minutes.
-     * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getLastHeartbeatTimeFieldBuilder() { - if (lastHeartbeatTimeBuilder_ == null) { - lastHeartbeatTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getLastHeartbeatTime(), getParentForChildren(), isClean()); - lastHeartbeatTime_ = null; - } - return lastHeartbeatTimeBuilder_; - } - - private com.google.protobuf.Timestamp lastEventTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - lastEventTimeBuilder_; - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - * - * @return Whether the lastEventTime field is set. - */ - public boolean hasLastEventTime() { - return lastEventTimeBuilder_ != null || lastEventTime_ != null; - } - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - * - * @return The lastEventTime. - */ - public com.google.protobuf.Timestamp getLastEventTime() { - if (lastEventTimeBuilder_ == null) { - return lastEventTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastEventTime_; - } else { - return lastEventTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - public Builder setLastEventTime(com.google.protobuf.Timestamp value) { - if (lastEventTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lastEventTime_ = value; - onChanged(); - } else { - lastEventTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - public Builder setLastEventTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (lastEventTimeBuilder_ == null) { - lastEventTime_ = builderForValue.build(); - onChanged(); - } else { - lastEventTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - public Builder mergeLastEventTime(com.google.protobuf.Timestamp value) { - if (lastEventTimeBuilder_ == null) { - if (lastEventTime_ != null) { - lastEventTime_ = - com.google.protobuf.Timestamp.newBuilder(lastEventTime_) - .mergeFrom(value) - .buildPartial(); - } else { - lastEventTime_ = value; - } - onChanged(); - } else { - lastEventTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - public Builder clearLastEventTime() { - if (lastEventTimeBuilder_ == null) { - lastEventTime_ = null; - onChanged(); - } else { - lastEventTime_ = null; - lastEventTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - public com.google.protobuf.Timestamp.Builder getLastEventTimeBuilder() { - - onChanged(); - return getLastEventTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - public com.google.protobuf.TimestampOrBuilder getLastEventTimeOrBuilder() { - if (lastEventTimeBuilder_ != null) { - return lastEventTimeBuilder_.getMessageOrBuilder(); - } else { - return lastEventTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastEventTime_; - } - } - /** - * - * - *
-     * [Output only] The last time a telemetry event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getLastEventTimeFieldBuilder() { - if (lastEventTimeBuilder_ == null) { - lastEventTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getLastEventTime(), getParentForChildren(), isClean()); - lastEventTime_ = null; - } - return lastEventTimeBuilder_; - } - - private com.google.protobuf.Timestamp lastStateTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - lastStateTimeBuilder_; - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - * - * @return Whether the lastStateTime field is set. - */ - public boolean hasLastStateTime() { - return lastStateTimeBuilder_ != null || lastStateTime_ != null; - } - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - * - * @return The lastStateTime. - */ - public com.google.protobuf.Timestamp getLastStateTime() { - if (lastStateTimeBuilder_ == null) { - return lastStateTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastStateTime_; - } else { - return lastStateTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - public Builder setLastStateTime(com.google.protobuf.Timestamp value) { - if (lastStateTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lastStateTime_ = value; - onChanged(); - } else { - lastStateTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - public Builder setLastStateTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (lastStateTimeBuilder_ == null) { - lastStateTime_ = builderForValue.build(); - onChanged(); - } else { - lastStateTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - public Builder mergeLastStateTime(com.google.protobuf.Timestamp value) { - if (lastStateTimeBuilder_ == null) { - if (lastStateTime_ != null) { - lastStateTime_ = - com.google.protobuf.Timestamp.newBuilder(lastStateTime_) - .mergeFrom(value) - .buildPartial(); - } else { - lastStateTime_ = value; - } - onChanged(); - } else { - lastStateTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - public Builder clearLastStateTime() { - if (lastStateTimeBuilder_ == null) { - lastStateTime_ = null; - onChanged(); - } else { - lastStateTime_ = null; - lastStateTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - public com.google.protobuf.Timestamp.Builder getLastStateTimeBuilder() { - - onChanged(); - return getLastStateTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - public com.google.protobuf.TimestampOrBuilder getLastStateTimeOrBuilder() { - if (lastStateTimeBuilder_ != null) { - return lastStateTimeBuilder_.getMessageOrBuilder(); - } else { - return lastStateTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastStateTime_; - } - } - /** - * - * - *
-     * [Output only] The last time a state event was received. Timestamps are
-     * periodically collected and written to storage; they may be stale by a few
-     * minutes.
-     * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getLastStateTimeFieldBuilder() { - if (lastStateTimeBuilder_ == null) { - lastStateTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getLastStateTime(), getParentForChildren(), isClean()); - lastStateTime_ = null; - } - return lastStateTimeBuilder_; - } - - private com.google.protobuf.Timestamp lastConfigAckTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - lastConfigAckTimeBuilder_; - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - * - * @return Whether the lastConfigAckTime field is set. - */ - public boolean hasLastConfigAckTime() { - return lastConfigAckTimeBuilder_ != null || lastConfigAckTime_ != null; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - * - * @return The lastConfigAckTime. - */ - public com.google.protobuf.Timestamp getLastConfigAckTime() { - if (lastConfigAckTimeBuilder_ == null) { - return lastConfigAckTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastConfigAckTime_; - } else { - return lastConfigAckTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - public Builder setLastConfigAckTime(com.google.protobuf.Timestamp value) { - if (lastConfigAckTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lastConfigAckTime_ = value; - onChanged(); - } else { - lastConfigAckTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - public Builder setLastConfigAckTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (lastConfigAckTimeBuilder_ == null) { - lastConfigAckTime_ = builderForValue.build(); - onChanged(); - } else { - lastConfigAckTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - public Builder mergeLastConfigAckTime(com.google.protobuf.Timestamp value) { - if (lastConfigAckTimeBuilder_ == null) { - if (lastConfigAckTime_ != null) { - lastConfigAckTime_ = - com.google.protobuf.Timestamp.newBuilder(lastConfigAckTime_) - .mergeFrom(value) - .buildPartial(); - } else { - lastConfigAckTime_ = value; - } - onChanged(); - } else { - lastConfigAckTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - public Builder clearLastConfigAckTime() { - if (lastConfigAckTimeBuilder_ == null) { - lastConfigAckTime_ = null; - onChanged(); - } else { - lastConfigAckTime_ = null; - lastConfigAckTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - public com.google.protobuf.Timestamp.Builder getLastConfigAckTimeBuilder() { - - onChanged(); - return getLastConfigAckTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - public com.google.protobuf.TimestampOrBuilder getLastConfigAckTimeOrBuilder() { - if (lastConfigAckTimeBuilder_ != null) { - return lastConfigAckTimeBuilder_.getMessageOrBuilder(); - } else { - return lastConfigAckTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastConfigAckTime_; - } - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version acknowledgment
-     * was received from the device. This field is only for configurations
-     * sent through MQTT.
-     * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getLastConfigAckTimeFieldBuilder() { - if (lastConfigAckTimeBuilder_ == null) { - lastConfigAckTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getLastConfigAckTime(), getParentForChildren(), isClean()); - lastConfigAckTime_ = null; - } - return lastConfigAckTimeBuilder_; - } - - private com.google.protobuf.Timestamp lastConfigSendTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - lastConfigSendTimeBuilder_; - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - * - * @return Whether the lastConfigSendTime field is set. - */ - public boolean hasLastConfigSendTime() { - return lastConfigSendTimeBuilder_ != null || lastConfigSendTime_ != null; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - * - * @return The lastConfigSendTime. - */ - public com.google.protobuf.Timestamp getLastConfigSendTime() { - if (lastConfigSendTimeBuilder_ == null) { - return lastConfigSendTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastConfigSendTime_; - } else { - return lastConfigSendTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - public Builder setLastConfigSendTime(com.google.protobuf.Timestamp value) { - if (lastConfigSendTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lastConfigSendTime_ = value; - onChanged(); - } else { - lastConfigSendTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - public Builder setLastConfigSendTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (lastConfigSendTimeBuilder_ == null) { - lastConfigSendTime_ = builderForValue.build(); - onChanged(); - } else { - lastConfigSendTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - public Builder mergeLastConfigSendTime(com.google.protobuf.Timestamp value) { - if (lastConfigSendTimeBuilder_ == null) { - if (lastConfigSendTime_ != null) { - lastConfigSendTime_ = - com.google.protobuf.Timestamp.newBuilder(lastConfigSendTime_) - .mergeFrom(value) - .buildPartial(); - } else { - lastConfigSendTime_ = value; - } - onChanged(); - } else { - lastConfigSendTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - public Builder clearLastConfigSendTime() { - if (lastConfigSendTimeBuilder_ == null) { - lastConfigSendTime_ = null; - onChanged(); - } else { - lastConfigSendTime_ = null; - lastConfigSendTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - public com.google.protobuf.Timestamp.Builder getLastConfigSendTimeBuilder() { - - onChanged(); - return getLastConfigSendTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - public com.google.protobuf.TimestampOrBuilder getLastConfigSendTimeOrBuilder() { - if (lastConfigSendTimeBuilder_ != null) { - return lastConfigSendTimeBuilder_.getMessageOrBuilder(); - } else { - return lastConfigSendTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastConfigSendTime_; - } - } - /** - * - * - *
-     * [Output only] The last time a cloud-to-device config version was sent to
-     * the device.
-     * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getLastConfigSendTimeFieldBuilder() { - if (lastConfigSendTimeBuilder_ == null) { - lastConfigSendTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getLastConfigSendTime(), getParentForChildren(), isClean()); - lastConfigSendTime_ = null; - } - return lastConfigSendTimeBuilder_; - } - - private boolean blocked_; - /** - * - * - *
-     * If a device is blocked, connections or requests from this device will fail.
-     * Can be used to temporarily prevent the device from connecting if, for
-     * example, the sensor is generating bad data and needs maintenance.
-     * 
- * - * bool blocked = 19; - * - * @return The blocked. - */ - @java.lang.Override - public boolean getBlocked() { - return blocked_; - } - /** - * - * - *
-     * If a device is blocked, connections or requests from this device will fail.
-     * Can be used to temporarily prevent the device from connecting if, for
-     * example, the sensor is generating bad data and needs maintenance.
-     * 
- * - * bool blocked = 19; - * - * @param value The blocked to set. - * @return This builder for chaining. - */ - public Builder setBlocked(boolean value) { - - blocked_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If a device is blocked, connections or requests from this device will fail.
-     * Can be used to temporarily prevent the device from connecting if, for
-     * example, the sensor is generating bad data and needs maintenance.
-     * 
- * - * bool blocked = 19; - * - * @return This builder for chaining. - */ - public Builder clearBlocked() { - - blocked_ = false; - onChanged(); - return this; - } - - private com.google.protobuf.Timestamp lastErrorTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - lastErrorTimeBuilder_; - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - * - * @return Whether the lastErrorTime field is set. - */ - public boolean hasLastErrorTime() { - return lastErrorTimeBuilder_ != null || lastErrorTime_ != null; - } - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - * - * @return The lastErrorTime. - */ - public com.google.protobuf.Timestamp getLastErrorTime() { - if (lastErrorTimeBuilder_ == null) { - return lastErrorTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastErrorTime_; - } else { - return lastErrorTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - public Builder setLastErrorTime(com.google.protobuf.Timestamp value) { - if (lastErrorTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lastErrorTime_ = value; - onChanged(); - } else { - lastErrorTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - public Builder setLastErrorTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (lastErrorTimeBuilder_ == null) { - lastErrorTime_ = builderForValue.build(); - onChanged(); - } else { - lastErrorTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - public Builder mergeLastErrorTime(com.google.protobuf.Timestamp value) { - if (lastErrorTimeBuilder_ == null) { - if (lastErrorTime_ != null) { - lastErrorTime_ = - com.google.protobuf.Timestamp.newBuilder(lastErrorTime_) - .mergeFrom(value) - .buildPartial(); - } else { - lastErrorTime_ = value; - } - onChanged(); - } else { - lastErrorTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - public Builder clearLastErrorTime() { - if (lastErrorTimeBuilder_ == null) { - lastErrorTime_ = null; - onChanged(); - } else { - lastErrorTime_ = null; - lastErrorTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - public com.google.protobuf.Timestamp.Builder getLastErrorTimeBuilder() { - - onChanged(); - return getLastErrorTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - public com.google.protobuf.TimestampOrBuilder getLastErrorTimeOrBuilder() { - if (lastErrorTimeBuilder_ != null) { - return lastErrorTimeBuilder_.getMessageOrBuilder(); - } else { - return lastErrorTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastErrorTime_; - } - } - /** - * - * - *
-     * [Output only] The time the most recent error occurred, such as a failure to
-     * publish to Cloud Pub/Sub. This field is the timestamp of
-     * 'last_error_status'.
-     * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getLastErrorTimeFieldBuilder() { - if (lastErrorTimeBuilder_ == null) { - lastErrorTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getLastErrorTime(), getParentForChildren(), isClean()); - lastErrorTime_ = null; - } - return lastErrorTimeBuilder_; - } - - private com.google.rpc.Status lastErrorStatus_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> - lastErrorStatusBuilder_; - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - * - * @return Whether the lastErrorStatus field is set. - */ - public boolean hasLastErrorStatus() { - return lastErrorStatusBuilder_ != null || lastErrorStatus_ != null; - } - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - * - * @return The lastErrorStatus. - */ - public com.google.rpc.Status getLastErrorStatus() { - if (lastErrorStatusBuilder_ == null) { - return lastErrorStatus_ == null - ? com.google.rpc.Status.getDefaultInstance() - : lastErrorStatus_; - } else { - return lastErrorStatusBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - */ - public Builder setLastErrorStatus(com.google.rpc.Status value) { - if (lastErrorStatusBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lastErrorStatus_ = value; - onChanged(); - } else { - lastErrorStatusBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - */ - public Builder setLastErrorStatus(com.google.rpc.Status.Builder builderForValue) { - if (lastErrorStatusBuilder_ == null) { - lastErrorStatus_ = builderForValue.build(); - onChanged(); - } else { - lastErrorStatusBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - */ - public Builder mergeLastErrorStatus(com.google.rpc.Status value) { - if (lastErrorStatusBuilder_ == null) { - if (lastErrorStatus_ != null) { - lastErrorStatus_ = - com.google.rpc.Status.newBuilder(lastErrorStatus_).mergeFrom(value).buildPartial(); - } else { - lastErrorStatus_ = value; - } - onChanged(); - } else { - lastErrorStatusBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - */ - public Builder clearLastErrorStatus() { - if (lastErrorStatusBuilder_ == null) { - lastErrorStatus_ = null; - onChanged(); - } else { - lastErrorStatus_ = null; - lastErrorStatusBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - */ - public com.google.rpc.Status.Builder getLastErrorStatusBuilder() { - - onChanged(); - return getLastErrorStatusFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - */ - public com.google.rpc.StatusOrBuilder getLastErrorStatusOrBuilder() { - if (lastErrorStatusBuilder_ != null) { - return lastErrorStatusBuilder_.getMessageOrBuilder(); - } else { - return lastErrorStatus_ == null - ? com.google.rpc.Status.getDefaultInstance() - : lastErrorStatus_; - } - } - /** - * - * - *
-     * [Output only] The error message of the most recent error, such as a failure
-     * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-     * field. If no errors have occurred, this field has an empty message
-     * and the status code 0 == OK. Otherwise, this field is expected to have a
-     * status code other than OK.
-     * 
- * - * .google.rpc.Status last_error_status = 11; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.rpc.Status, com.google.rpc.Status.Builder, com.google.rpc.StatusOrBuilder> - getLastErrorStatusFieldBuilder() { - if (lastErrorStatusBuilder_ == null) { - lastErrorStatusBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.rpc.Status, - com.google.rpc.Status.Builder, - com.google.rpc.StatusOrBuilder>( - getLastErrorStatus(), getParentForChildren(), isClean()); - lastErrorStatus_ = null; - } - return lastErrorStatusBuilder_; - } - - private com.google.cloud.iot.v1.DeviceConfig config_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceConfig, - com.google.cloud.iot.v1.DeviceConfig.Builder, - com.google.cloud.iot.v1.DeviceConfigOrBuilder> - configBuilder_; - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - * - * @return Whether the config field is set. - */ - public boolean hasConfig() { - return configBuilder_ != null || config_ != null; - } - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - * - * @return The config. - */ - public com.google.cloud.iot.v1.DeviceConfig getConfig() { - if (configBuilder_ == null) { - return config_ == null - ? com.google.cloud.iot.v1.DeviceConfig.getDefaultInstance() - : config_; - } else { - return configBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - public Builder setConfig(com.google.cloud.iot.v1.DeviceConfig value) { - if (configBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - config_ = value; - onChanged(); - } else { - configBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - public Builder setConfig(com.google.cloud.iot.v1.DeviceConfig.Builder builderForValue) { - if (configBuilder_ == null) { - config_ = builderForValue.build(); - onChanged(); - } else { - configBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - public Builder mergeConfig(com.google.cloud.iot.v1.DeviceConfig value) { - if (configBuilder_ == null) { - if (config_ != null) { - config_ = - com.google.cloud.iot.v1.DeviceConfig.newBuilder(config_) - .mergeFrom(value) - .buildPartial(); - } else { - config_ = value; - } - onChanged(); - } else { - configBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - public Builder clearConfig() { - if (configBuilder_ == null) { - config_ = null; - onChanged(); - } else { - config_ = null; - configBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - public com.google.cloud.iot.v1.DeviceConfig.Builder getConfigBuilder() { - - onChanged(); - return getConfigFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - public com.google.cloud.iot.v1.DeviceConfigOrBuilder getConfigOrBuilder() { - if (configBuilder_ != null) { - return configBuilder_.getMessageOrBuilder(); - } else { - return config_ == null - ? com.google.cloud.iot.v1.DeviceConfig.getDefaultInstance() - : config_; - } - } - /** - * - * - *
-     * The most recent device configuration, which is eventually sent from
-     * Cloud IoT Core to the device. If not present on creation, the
-     * configuration will be initialized with an empty payload and version value
-     * of `1`. To update this field after creation, use the
-     * `DeviceManager.ModifyCloudToDeviceConfig` method.
-     * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceConfig, - com.google.cloud.iot.v1.DeviceConfig.Builder, - com.google.cloud.iot.v1.DeviceConfigOrBuilder> - getConfigFieldBuilder() { - if (configBuilder_ == null) { - configBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceConfig, - com.google.cloud.iot.v1.DeviceConfig.Builder, - com.google.cloud.iot.v1.DeviceConfigOrBuilder>( - getConfig(), getParentForChildren(), isClean()); - config_ = null; - } - return configBuilder_; - } - - private com.google.cloud.iot.v1.DeviceState state_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceState, - com.google.cloud.iot.v1.DeviceState.Builder, - com.google.cloud.iot.v1.DeviceStateOrBuilder> - stateBuilder_; - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - * - * @return Whether the state field is set. - */ - public boolean hasState() { - return stateBuilder_ != null || state_ != null; - } - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - * - * @return The state. - */ - public com.google.cloud.iot.v1.DeviceState getState() { - if (stateBuilder_ == null) { - return state_ == null ? com.google.cloud.iot.v1.DeviceState.getDefaultInstance() : state_; - } else { - return stateBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - public Builder setState(com.google.cloud.iot.v1.DeviceState value) { - if (stateBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - state_ = value; - onChanged(); - } else { - stateBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - public Builder setState(com.google.cloud.iot.v1.DeviceState.Builder builderForValue) { - if (stateBuilder_ == null) { - state_ = builderForValue.build(); - onChanged(); - } else { - stateBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - public Builder mergeState(com.google.cloud.iot.v1.DeviceState value) { - if (stateBuilder_ == null) { - if (state_ != null) { - state_ = - com.google.cloud.iot.v1.DeviceState.newBuilder(state_) - .mergeFrom(value) - .buildPartial(); - } else { - state_ = value; - } - onChanged(); - } else { - stateBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - public Builder clearState() { - if (stateBuilder_ == null) { - state_ = null; - onChanged(); - } else { - state_ = null; - stateBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - public com.google.cloud.iot.v1.DeviceState.Builder getStateBuilder() { - - onChanged(); - return getStateFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - public com.google.cloud.iot.v1.DeviceStateOrBuilder getStateOrBuilder() { - if (stateBuilder_ != null) { - return stateBuilder_.getMessageOrBuilder(); - } else { - return state_ == null ? com.google.cloud.iot.v1.DeviceState.getDefaultInstance() : state_; - } - } - /** - * - * - *
-     * [Output only] The state most recently received from the device. If no state
-     * has been reported, this field is not present.
-     * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceState, - com.google.cloud.iot.v1.DeviceState.Builder, - com.google.cloud.iot.v1.DeviceStateOrBuilder> - getStateFieldBuilder() { - if (stateBuilder_ == null) { - stateBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceState, - com.google.cloud.iot.v1.DeviceState.Builder, - com.google.cloud.iot.v1.DeviceStateOrBuilder>( - getState(), getParentForChildren(), isClean()); - state_ = null; - } - return stateBuilder_; - } - - private int logLevel_ = 0; - /** - * - * - *
-     * **Beta Feature**
-     * The logging verbosity for device activity. If unspecified,
-     * DeviceRegistry.log_level will be used.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @return The enum numeric value on the wire for logLevel. - */ - @java.lang.Override - public int getLogLevelValue() { - return logLevel_; - } - /** - * - * - *
-     * **Beta Feature**
-     * The logging verbosity for device activity. If unspecified,
-     * DeviceRegistry.log_level will be used.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @param value The enum numeric value on the wire for logLevel to set. - * @return This builder for chaining. - */ - public Builder setLogLevelValue(int value) { - - logLevel_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * **Beta Feature**
-     * The logging verbosity for device activity. If unspecified,
-     * DeviceRegistry.log_level will be used.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @return The logLevel. - */ - @java.lang.Override - public com.google.cloud.iot.v1.LogLevel getLogLevel() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.LogLevel result = com.google.cloud.iot.v1.LogLevel.valueOf(logLevel_); - return result == null ? com.google.cloud.iot.v1.LogLevel.UNRECOGNIZED : result; - } - /** - * - * - *
-     * **Beta Feature**
-     * The logging verbosity for device activity. If unspecified,
-     * DeviceRegistry.log_level will be used.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @param value The logLevel to set. - * @return This builder for chaining. - */ - public Builder setLogLevel(com.google.cloud.iot.v1.LogLevel value) { - if (value == null) { - throw new NullPointerException(); - } - - logLevel_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * **Beta Feature**
-     * The logging verbosity for device activity. If unspecified,
-     * DeviceRegistry.log_level will be used.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @return This builder for chaining. - */ - public Builder clearLogLevel() { - - logLevel_ = 0; - onChanged(); - return this; - } - - private com.google.protobuf.MapField metadata_; - - private com.google.protobuf.MapField internalGetMetadata() { - if (metadata_ == null) { - return com.google.protobuf.MapField.emptyMapField(MetadataDefaultEntryHolder.defaultEntry); - } - return metadata_; - } - - private com.google.protobuf.MapField - internalGetMutableMetadata() { - onChanged(); - ; - if (metadata_ == null) { - metadata_ = - com.google.protobuf.MapField.newMapField(MetadataDefaultEntryHolder.defaultEntry); - } - if (!metadata_.isMutable()) { - metadata_ = metadata_.copy(); - } - return metadata_; - } - - public int getMetadataCount() { - return internalGetMetadata().getMap().size(); - } - /** - * - * - *
-     * The metadata key-value pairs assigned to the device. This metadata is not
-     * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-     * information for the device.
-     * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-     * be less than 128 bytes in length.
-     * Values are free-form strings. Each value must be less than or equal to 32
-     * KB in size.
-     * The total size of all keys and values must be less than 256 KB, and the
-     * maximum number of key-value pairs is 500.
-     * 
- * - * map<string, string> metadata = 17; - */ - @java.lang.Override - public boolean containsMetadata(java.lang.String key) { - if (key == null) { - throw new NullPointerException("map key"); - } - return internalGetMetadata().getMap().containsKey(key); - } - /** Use {@link #getMetadataMap()} instead. */ - @java.lang.Override - @java.lang.Deprecated - public java.util.Map getMetadata() { - return getMetadataMap(); - } - /** - * - * - *
-     * The metadata key-value pairs assigned to the device. This metadata is not
-     * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-     * information for the device.
-     * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-     * be less than 128 bytes in length.
-     * Values are free-form strings. Each value must be less than or equal to 32
-     * KB in size.
-     * The total size of all keys and values must be less than 256 KB, and the
-     * maximum number of key-value pairs is 500.
-     * 
- * - * map<string, string> metadata = 17; - */ - @java.lang.Override - public java.util.Map getMetadataMap() { - return internalGetMetadata().getMap(); - } - /** - * - * - *
-     * The metadata key-value pairs assigned to the device. This metadata is not
-     * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-     * information for the device.
-     * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-     * be less than 128 bytes in length.
-     * Values are free-form strings. Each value must be less than or equal to 32
-     * KB in size.
-     * The total size of all keys and values must be less than 256 KB, and the
-     * maximum number of key-value pairs is 500.
-     * 
- * - * map<string, string> metadata = 17; - */ - @java.lang.Override - public java.lang.String getMetadataOrDefault( - java.lang.String key, java.lang.String defaultValue) { - if (key == null) { - throw new NullPointerException("map key"); - } - java.util.Map map = internalGetMetadata().getMap(); - return map.containsKey(key) ? map.get(key) : defaultValue; - } - /** - * - * - *
-     * The metadata key-value pairs assigned to the device. This metadata is not
-     * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-     * information for the device.
-     * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-     * be less than 128 bytes in length.
-     * Values are free-form strings. Each value must be less than or equal to 32
-     * KB in size.
-     * The total size of all keys and values must be less than 256 KB, and the
-     * maximum number of key-value pairs is 500.
-     * 
- * - * map<string, string> metadata = 17; - */ - @java.lang.Override - public java.lang.String getMetadataOrThrow(java.lang.String key) { - if (key == null) { - throw new NullPointerException("map key"); - } - java.util.Map map = internalGetMetadata().getMap(); - if (!map.containsKey(key)) { - throw new java.lang.IllegalArgumentException(); - } - return map.get(key); - } - - public Builder clearMetadata() { - internalGetMutableMetadata().getMutableMap().clear(); - return this; - } - /** - * - * - *
-     * The metadata key-value pairs assigned to the device. This metadata is not
-     * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-     * information for the device.
-     * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-     * be less than 128 bytes in length.
-     * Values are free-form strings. Each value must be less than or equal to 32
-     * KB in size.
-     * The total size of all keys and values must be less than 256 KB, and the
-     * maximum number of key-value pairs is 500.
-     * 
- * - * map<string, string> metadata = 17; - */ - public Builder removeMetadata(java.lang.String key) { - if (key == null) { - throw new NullPointerException("map key"); - } - internalGetMutableMetadata().getMutableMap().remove(key); - return this; - } - /** Use alternate mutation accessors instead. */ - @java.lang.Deprecated - public java.util.Map getMutableMetadata() { - return internalGetMutableMetadata().getMutableMap(); - } - /** - * - * - *
-     * The metadata key-value pairs assigned to the device. This metadata is not
-     * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-     * information for the device.
-     * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-     * be less than 128 bytes in length.
-     * Values are free-form strings. Each value must be less than or equal to 32
-     * KB in size.
-     * The total size of all keys and values must be less than 256 KB, and the
-     * maximum number of key-value pairs is 500.
-     * 
- * - * map<string, string> metadata = 17; - */ - public Builder putMetadata(java.lang.String key, java.lang.String value) { - if (key == null) { - throw new NullPointerException("map key"); - } - if (value == null) { - throw new NullPointerException("map value"); - } - - internalGetMutableMetadata().getMutableMap().put(key, value); - return this; - } - /** - * - * - *
-     * The metadata key-value pairs assigned to the device. This metadata is not
-     * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-     * information for the device.
-     * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-     * be less than 128 bytes in length.
-     * Values are free-form strings. Each value must be less than or equal to 32
-     * KB in size.
-     * The total size of all keys and values must be less than 256 KB, and the
-     * maximum number of key-value pairs is 500.
-     * 
- * - * map<string, string> metadata = 17; - */ - public Builder putAllMetadata(java.util.Map values) { - internalGetMutableMetadata().getMutableMap().putAll(values); - return this; - } - - private com.google.cloud.iot.v1.GatewayConfig gatewayConfig_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.GatewayConfig, - com.google.cloud.iot.v1.GatewayConfig.Builder, - com.google.cloud.iot.v1.GatewayConfigOrBuilder> - gatewayConfigBuilder_; - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - * - * @return Whether the gatewayConfig field is set. - */ - public boolean hasGatewayConfig() { - return gatewayConfigBuilder_ != null || gatewayConfig_ != null; - } - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - * - * @return The gatewayConfig. - */ - public com.google.cloud.iot.v1.GatewayConfig getGatewayConfig() { - if (gatewayConfigBuilder_ == null) { - return gatewayConfig_ == null - ? com.google.cloud.iot.v1.GatewayConfig.getDefaultInstance() - : gatewayConfig_; - } else { - return gatewayConfigBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - public Builder setGatewayConfig(com.google.cloud.iot.v1.GatewayConfig value) { - if (gatewayConfigBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - gatewayConfig_ = value; - onChanged(); - } else { - gatewayConfigBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - public Builder setGatewayConfig(com.google.cloud.iot.v1.GatewayConfig.Builder builderForValue) { - if (gatewayConfigBuilder_ == null) { - gatewayConfig_ = builderForValue.build(); - onChanged(); - } else { - gatewayConfigBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - public Builder mergeGatewayConfig(com.google.cloud.iot.v1.GatewayConfig value) { - if (gatewayConfigBuilder_ == null) { - if (gatewayConfig_ != null) { - gatewayConfig_ = - com.google.cloud.iot.v1.GatewayConfig.newBuilder(gatewayConfig_) - .mergeFrom(value) - .buildPartial(); - } else { - gatewayConfig_ = value; - } - onChanged(); - } else { - gatewayConfigBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - public Builder clearGatewayConfig() { - if (gatewayConfigBuilder_ == null) { - gatewayConfig_ = null; - onChanged(); - } else { - gatewayConfig_ = null; - gatewayConfigBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - public com.google.cloud.iot.v1.GatewayConfig.Builder getGatewayConfigBuilder() { - - onChanged(); - return getGatewayConfigFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - public com.google.cloud.iot.v1.GatewayConfigOrBuilder getGatewayConfigOrBuilder() { - if (gatewayConfigBuilder_ != null) { - return gatewayConfigBuilder_.getMessageOrBuilder(); - } else { - return gatewayConfig_ == null - ? com.google.cloud.iot.v1.GatewayConfig.getDefaultInstance() - : gatewayConfig_; - } - } - /** - * - * - *
-     * Gateway-related configuration and state.
-     * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.GatewayConfig, - com.google.cloud.iot.v1.GatewayConfig.Builder, - com.google.cloud.iot.v1.GatewayConfigOrBuilder> - getGatewayConfigFieldBuilder() { - if (gatewayConfigBuilder_ == null) { - gatewayConfigBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.GatewayConfig, - com.google.cloud.iot.v1.GatewayConfig.Builder, - com.google.cloud.iot.v1.GatewayConfigOrBuilder>( - getGatewayConfig(), getParentForChildren(), isClean()); - gatewayConfig_ = null; - } - return gatewayConfigBuilder_; - } - - @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.iot.v1.Device) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.Device) - private static final com.google.cloud.iot.v1.Device DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.Device(); - } - - public static com.google.cloud.iot.v1.Device getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public Device parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.Device getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceConfig.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceConfig.java deleted file mode 100644 index 5d440635..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceConfig.java +++ /dev/null @@ -1,1273 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The device configuration. Eventually delivered to devices.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeviceConfig} - */ -public final class DeviceConfig extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.DeviceConfig) - DeviceConfigOrBuilder { - private static final long serialVersionUID = 0L; - // Use DeviceConfig.newBuilder() to construct. - private DeviceConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private DeviceConfig() { - binaryData_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeviceConfig(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeviceConfig.class, - com.google.cloud.iot.v1.DeviceConfig.Builder.class); - } - - public static final int VERSION_FIELD_NUMBER = 1; - private long version_; - /** - * - * - *
-   * [Output only] The version of this update. The version number is assigned by
-   * the server, and is always greater than 0 after device creation. The
-   * version must be 0 on the `CreateDevice` request if a `config` is
-   * specified; the response of `CreateDevice` will always have a value of 1.
-   * 
- * - * int64 version = 1; - * - * @return The version. - */ - @java.lang.Override - public long getVersion() { - return version_; - } - - public static final int CLOUD_UPDATE_TIME_FIELD_NUMBER = 2; - private com.google.protobuf.Timestamp cloudUpdateTime_; - /** - * - * - *
-   * [Output only] The time at which this configuration version was updated in
-   * Cloud IoT Core. This timestamp is set by the server.
-   * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - * - * @return Whether the cloudUpdateTime field is set. - */ - @java.lang.Override - public boolean hasCloudUpdateTime() { - return cloudUpdateTime_ != null; - } - /** - * - * - *
-   * [Output only] The time at which this configuration version was updated in
-   * Cloud IoT Core. This timestamp is set by the server.
-   * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - * - * @return The cloudUpdateTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getCloudUpdateTime() { - return cloudUpdateTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : cloudUpdateTime_; - } - /** - * - * - *
-   * [Output only] The time at which this configuration version was updated in
-   * Cloud IoT Core. This timestamp is set by the server.
-   * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getCloudUpdateTimeOrBuilder() { - return getCloudUpdateTime(); - } - - public static final int DEVICE_ACK_TIME_FIELD_NUMBER = 3; - private com.google.protobuf.Timestamp deviceAckTime_; - /** - * - * - *
-   * [Output only] The time at which Cloud IoT Core received the
-   * acknowledgment from the device, indicating that the device has received
-   * this configuration version. If this field is not present, the device has
-   * not yet acknowledged that it received this version. Note that when
-   * the config was sent to the device, many config versions may have been
-   * available in Cloud IoT Core while the device was disconnected, and on
-   * connection, only the latest version is sent to the device. Some
-   * versions may never be sent to the device, and therefore are never
-   * acknowledged. This timestamp is set by Cloud IoT Core.
-   * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - * - * @return Whether the deviceAckTime field is set. - */ - @java.lang.Override - public boolean hasDeviceAckTime() { - return deviceAckTime_ != null; - } - /** - * - * - *
-   * [Output only] The time at which Cloud IoT Core received the
-   * acknowledgment from the device, indicating that the device has received
-   * this configuration version. If this field is not present, the device has
-   * not yet acknowledged that it received this version. Note that when
-   * the config was sent to the device, many config versions may have been
-   * available in Cloud IoT Core while the device was disconnected, and on
-   * connection, only the latest version is sent to the device. Some
-   * versions may never be sent to the device, and therefore are never
-   * acknowledged. This timestamp is set by Cloud IoT Core.
-   * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - * - * @return The deviceAckTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getDeviceAckTime() { - return deviceAckTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : deviceAckTime_; - } - /** - * - * - *
-   * [Output only] The time at which Cloud IoT Core received the
-   * acknowledgment from the device, indicating that the device has received
-   * this configuration version. If this field is not present, the device has
-   * not yet acknowledged that it received this version. Note that when
-   * the config was sent to the device, many config versions may have been
-   * available in Cloud IoT Core while the device was disconnected, and on
-   * connection, only the latest version is sent to the device. Some
-   * versions may never be sent to the device, and therefore are never
-   * acknowledged. This timestamp is set by Cloud IoT Core.
-   * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getDeviceAckTimeOrBuilder() { - return getDeviceAckTime(); - } - - public static final int BINARY_DATA_FIELD_NUMBER = 4; - private com.google.protobuf.ByteString binaryData_; - /** - * - * - *
-   * The device configuration data.
-   * 
- * - * bytes binary_data = 4; - * - * @return The binaryData. - */ - @java.lang.Override - public com.google.protobuf.ByteString getBinaryData() { - return binaryData_; - } - - 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 (version_ != 0L) { - output.writeInt64(1, version_); - } - if (cloudUpdateTime_ != null) { - output.writeMessage(2, getCloudUpdateTime()); - } - if (deviceAckTime_ != null) { - output.writeMessage(3, getDeviceAckTime()); - } - if (!binaryData_.isEmpty()) { - output.writeBytes(4, binaryData_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (version_ != 0L) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(1, version_); - } - if (cloudUpdateTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getCloudUpdateTime()); - } - if (deviceAckTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getDeviceAckTime()); - } - if (!binaryData_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(4, binaryData_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.DeviceConfig)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.DeviceConfig other = (com.google.cloud.iot.v1.DeviceConfig) obj; - - if (getVersion() != other.getVersion()) return false; - if (hasCloudUpdateTime() != other.hasCloudUpdateTime()) return false; - if (hasCloudUpdateTime()) { - if (!getCloudUpdateTime().equals(other.getCloudUpdateTime())) return false; - } - if (hasDeviceAckTime() != other.hasDeviceAckTime()) return false; - if (hasDeviceAckTime()) { - if (!getDeviceAckTime().equals(other.getDeviceAckTime())) return false; - } - if (!getBinaryData().equals(other.getBinaryData())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + VERSION_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getVersion()); - if (hasCloudUpdateTime()) { - hash = (37 * hash) + CLOUD_UPDATE_TIME_FIELD_NUMBER; - hash = (53 * hash) + getCloudUpdateTime().hashCode(); - } - if (hasDeviceAckTime()) { - hash = (37 * hash) + DEVICE_ACK_TIME_FIELD_NUMBER; - hash = (53 * hash) + getDeviceAckTime().hashCode(); - } - hash = (37 * hash) + BINARY_DATA_FIELD_NUMBER; - hash = (53 * hash) + getBinaryData().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.DeviceConfig parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceConfig 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.iot.v1.DeviceConfig parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceConfig 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.iot.v1.DeviceConfig parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceConfig parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.DeviceConfig parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceConfig 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.iot.v1.DeviceConfig parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceConfig 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.iot.v1.DeviceConfig parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceConfig 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.iot.v1.DeviceConfig 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 device configuration. Eventually delivered to devices.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeviceConfig} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.DeviceConfig) - com.google.cloud.iot.v1.DeviceConfigOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeviceConfig.class, - com.google.cloud.iot.v1.DeviceConfig.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.DeviceConfig.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - version_ = 0L; - - if (cloudUpdateTimeBuilder_ == null) { - cloudUpdateTime_ = null; - } else { - cloudUpdateTime_ = null; - cloudUpdateTimeBuilder_ = null; - } - if (deviceAckTimeBuilder_ == null) { - deviceAckTime_ = null; - } else { - deviceAckTime_ = null; - deviceAckTimeBuilder_ = null; - } - binaryData_ = com.google.protobuf.ByteString.EMPTY; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceConfig_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceConfig getDefaultInstanceForType() { - return com.google.cloud.iot.v1.DeviceConfig.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceConfig build() { - com.google.cloud.iot.v1.DeviceConfig result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceConfig buildPartial() { - com.google.cloud.iot.v1.DeviceConfig result = new com.google.cloud.iot.v1.DeviceConfig(this); - result.version_ = version_; - if (cloudUpdateTimeBuilder_ == null) { - result.cloudUpdateTime_ = cloudUpdateTime_; - } else { - result.cloudUpdateTime_ = cloudUpdateTimeBuilder_.build(); - } - if (deviceAckTimeBuilder_ == null) { - result.deviceAckTime_ = deviceAckTime_; - } else { - result.deviceAckTime_ = deviceAckTimeBuilder_.build(); - } - result.binaryData_ = binaryData_; - 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.iot.v1.DeviceConfig) { - return mergeFrom((com.google.cloud.iot.v1.DeviceConfig) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.DeviceConfig other) { - if (other == com.google.cloud.iot.v1.DeviceConfig.getDefaultInstance()) return this; - if (other.getVersion() != 0L) { - setVersion(other.getVersion()); - } - if (other.hasCloudUpdateTime()) { - mergeCloudUpdateTime(other.getCloudUpdateTime()); - } - if (other.hasDeviceAckTime()) { - mergeDeviceAckTime(other.getDeviceAckTime()); - } - if (other.getBinaryData() != com.google.protobuf.ByteString.EMPTY) { - setBinaryData(other.getBinaryData()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - version_ = input.readInt64(); - - break; - } // case 8 - case 18: - { - input.readMessage(getCloudUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 18 - case 26: - { - input.readMessage(getDeviceAckTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 26 - case 34: - { - binaryData_ = input.readBytes(); - - break; - } // case 34 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private long version_; - /** - * - * - *
-     * [Output only] The version of this update. The version number is assigned by
-     * the server, and is always greater than 0 after device creation. The
-     * version must be 0 on the `CreateDevice` request if a `config` is
-     * specified; the response of `CreateDevice` will always have a value of 1.
-     * 
- * - * int64 version = 1; - * - * @return The version. - */ - @java.lang.Override - public long getVersion() { - return version_; - } - /** - * - * - *
-     * [Output only] The version of this update. The version number is assigned by
-     * the server, and is always greater than 0 after device creation. The
-     * version must be 0 on the `CreateDevice` request if a `config` is
-     * specified; the response of `CreateDevice` will always have a value of 1.
-     * 
- * - * int64 version = 1; - * - * @param value The version to set. - * @return This builder for chaining. - */ - public Builder setVersion(long value) { - - version_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * [Output only] The version of this update. The version number is assigned by
-     * the server, and is always greater than 0 after device creation. The
-     * version must be 0 on the `CreateDevice` request if a `config` is
-     * specified; the response of `CreateDevice` will always have a value of 1.
-     * 
- * - * int64 version = 1; - * - * @return This builder for chaining. - */ - public Builder clearVersion() { - - version_ = 0L; - onChanged(); - return this; - } - - private com.google.protobuf.Timestamp cloudUpdateTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - cloudUpdateTimeBuilder_; - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - * - * @return Whether the cloudUpdateTime field is set. - */ - public boolean hasCloudUpdateTime() { - return cloudUpdateTimeBuilder_ != null || cloudUpdateTime_ != null; - } - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - * - * @return The cloudUpdateTime. - */ - public com.google.protobuf.Timestamp getCloudUpdateTime() { - if (cloudUpdateTimeBuilder_ == null) { - return cloudUpdateTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : cloudUpdateTime_; - } else { - return cloudUpdateTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - public Builder setCloudUpdateTime(com.google.protobuf.Timestamp value) { - if (cloudUpdateTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - cloudUpdateTime_ = value; - onChanged(); - } else { - cloudUpdateTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - public Builder setCloudUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (cloudUpdateTimeBuilder_ == null) { - cloudUpdateTime_ = builderForValue.build(); - onChanged(); - } else { - cloudUpdateTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - public Builder mergeCloudUpdateTime(com.google.protobuf.Timestamp value) { - if (cloudUpdateTimeBuilder_ == null) { - if (cloudUpdateTime_ != null) { - cloudUpdateTime_ = - com.google.protobuf.Timestamp.newBuilder(cloudUpdateTime_) - .mergeFrom(value) - .buildPartial(); - } else { - cloudUpdateTime_ = value; - } - onChanged(); - } else { - cloudUpdateTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - public Builder clearCloudUpdateTime() { - if (cloudUpdateTimeBuilder_ == null) { - cloudUpdateTime_ = null; - onChanged(); - } else { - cloudUpdateTime_ = null; - cloudUpdateTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - public com.google.protobuf.Timestamp.Builder getCloudUpdateTimeBuilder() { - - onChanged(); - return getCloudUpdateTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - public com.google.protobuf.TimestampOrBuilder getCloudUpdateTimeOrBuilder() { - if (cloudUpdateTimeBuilder_ != null) { - return cloudUpdateTimeBuilder_.getMessageOrBuilder(); - } else { - return cloudUpdateTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : cloudUpdateTime_; - } - } - /** - * - * - *
-     * [Output only] The time at which this configuration version was updated in
-     * Cloud IoT Core. This timestamp is set by the server.
-     * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getCloudUpdateTimeFieldBuilder() { - if (cloudUpdateTimeBuilder_ == null) { - cloudUpdateTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getCloudUpdateTime(), getParentForChildren(), isClean()); - cloudUpdateTime_ = null; - } - return cloudUpdateTimeBuilder_; - } - - private com.google.protobuf.Timestamp deviceAckTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - deviceAckTimeBuilder_; - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - * - * @return Whether the deviceAckTime field is set. - */ - public boolean hasDeviceAckTime() { - return deviceAckTimeBuilder_ != null || deviceAckTime_ != null; - } - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - * - * @return The deviceAckTime. - */ - public com.google.protobuf.Timestamp getDeviceAckTime() { - if (deviceAckTimeBuilder_ == null) { - return deviceAckTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : deviceAckTime_; - } else { - return deviceAckTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - public Builder setDeviceAckTime(com.google.protobuf.Timestamp value) { - if (deviceAckTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - deviceAckTime_ = value; - onChanged(); - } else { - deviceAckTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - public Builder setDeviceAckTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (deviceAckTimeBuilder_ == null) { - deviceAckTime_ = builderForValue.build(); - onChanged(); - } else { - deviceAckTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - public Builder mergeDeviceAckTime(com.google.protobuf.Timestamp value) { - if (deviceAckTimeBuilder_ == null) { - if (deviceAckTime_ != null) { - deviceAckTime_ = - com.google.protobuf.Timestamp.newBuilder(deviceAckTime_) - .mergeFrom(value) - .buildPartial(); - } else { - deviceAckTime_ = value; - } - onChanged(); - } else { - deviceAckTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - public Builder clearDeviceAckTime() { - if (deviceAckTimeBuilder_ == null) { - deviceAckTime_ = null; - onChanged(); - } else { - deviceAckTime_ = null; - deviceAckTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - public com.google.protobuf.Timestamp.Builder getDeviceAckTimeBuilder() { - - onChanged(); - return getDeviceAckTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - public com.google.protobuf.TimestampOrBuilder getDeviceAckTimeOrBuilder() { - if (deviceAckTimeBuilder_ != null) { - return deviceAckTimeBuilder_.getMessageOrBuilder(); - } else { - return deviceAckTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : deviceAckTime_; - } - } - /** - * - * - *
-     * [Output only] The time at which Cloud IoT Core received the
-     * acknowledgment from the device, indicating that the device has received
-     * this configuration version. If this field is not present, the device has
-     * not yet acknowledged that it received this version. Note that when
-     * the config was sent to the device, many config versions may have been
-     * available in Cloud IoT Core while the device was disconnected, and on
-     * connection, only the latest version is sent to the device. Some
-     * versions may never be sent to the device, and therefore are never
-     * acknowledged. This timestamp is set by Cloud IoT Core.
-     * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getDeviceAckTimeFieldBuilder() { - if (deviceAckTimeBuilder_ == null) { - deviceAckTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getDeviceAckTime(), getParentForChildren(), isClean()); - deviceAckTime_ = null; - } - return deviceAckTimeBuilder_; - } - - private com.google.protobuf.ByteString binaryData_ = com.google.protobuf.ByteString.EMPTY; - /** - * - * - *
-     * The device configuration data.
-     * 
- * - * bytes binary_data = 4; - * - * @return The binaryData. - */ - @java.lang.Override - public com.google.protobuf.ByteString getBinaryData() { - return binaryData_; - } - /** - * - * - *
-     * The device configuration data.
-     * 
- * - * bytes binary_data = 4; - * - * @param value The binaryData to set. - * @return This builder for chaining. - */ - public Builder setBinaryData(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - - binaryData_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The device configuration data.
-     * 
- * - * bytes binary_data = 4; - * - * @return This builder for chaining. - */ - public Builder clearBinaryData() { - - binaryData_ = getDefaultInstance().getBinaryData(); - 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.iot.v1.DeviceConfig) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.DeviceConfig) - private static final com.google.cloud.iot.v1.DeviceConfig DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.DeviceConfig(); - } - - public static com.google.cloud.iot.v1.DeviceConfig getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public DeviceConfig parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceConfig getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceConfigOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceConfigOrBuilder.java deleted file mode 100644 index 762a4f2d..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceConfigOrBuilder.java +++ /dev/null @@ -1,151 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface DeviceConfigOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.DeviceConfig) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * [Output only] The version of this update. The version number is assigned by
-   * the server, and is always greater than 0 after device creation. The
-   * version must be 0 on the `CreateDevice` request if a `config` is
-   * specified; the response of `CreateDevice` will always have a value of 1.
-   * 
- * - * int64 version = 1; - * - * @return The version. - */ - long getVersion(); - - /** - * - * - *
-   * [Output only] The time at which this configuration version was updated in
-   * Cloud IoT Core. This timestamp is set by the server.
-   * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - * - * @return Whether the cloudUpdateTime field is set. - */ - boolean hasCloudUpdateTime(); - /** - * - * - *
-   * [Output only] The time at which this configuration version was updated in
-   * Cloud IoT Core. This timestamp is set by the server.
-   * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - * - * @return The cloudUpdateTime. - */ - com.google.protobuf.Timestamp getCloudUpdateTime(); - /** - * - * - *
-   * [Output only] The time at which this configuration version was updated in
-   * Cloud IoT Core. This timestamp is set by the server.
-   * 
- * - * .google.protobuf.Timestamp cloud_update_time = 2; - */ - com.google.protobuf.TimestampOrBuilder getCloudUpdateTimeOrBuilder(); - - /** - * - * - *
-   * [Output only] The time at which Cloud IoT Core received the
-   * acknowledgment from the device, indicating that the device has received
-   * this configuration version. If this field is not present, the device has
-   * not yet acknowledged that it received this version. Note that when
-   * the config was sent to the device, many config versions may have been
-   * available in Cloud IoT Core while the device was disconnected, and on
-   * connection, only the latest version is sent to the device. Some
-   * versions may never be sent to the device, and therefore are never
-   * acknowledged. This timestamp is set by Cloud IoT Core.
-   * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - * - * @return Whether the deviceAckTime field is set. - */ - boolean hasDeviceAckTime(); - /** - * - * - *
-   * [Output only] The time at which Cloud IoT Core received the
-   * acknowledgment from the device, indicating that the device has received
-   * this configuration version. If this field is not present, the device has
-   * not yet acknowledged that it received this version. Note that when
-   * the config was sent to the device, many config versions may have been
-   * available in Cloud IoT Core while the device was disconnected, and on
-   * connection, only the latest version is sent to the device. Some
-   * versions may never be sent to the device, and therefore are never
-   * acknowledged. This timestamp is set by Cloud IoT Core.
-   * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - * - * @return The deviceAckTime. - */ - com.google.protobuf.Timestamp getDeviceAckTime(); - /** - * - * - *
-   * [Output only] The time at which Cloud IoT Core received the
-   * acknowledgment from the device, indicating that the device has received
-   * this configuration version. If this field is not present, the device has
-   * not yet acknowledged that it received this version. Note that when
-   * the config was sent to the device, many config versions may have been
-   * available in Cloud IoT Core while the device was disconnected, and on
-   * connection, only the latest version is sent to the device. Some
-   * versions may never be sent to the device, and therefore are never
-   * acknowledged. This timestamp is set by Cloud IoT Core.
-   * 
- * - * .google.protobuf.Timestamp device_ack_time = 3; - */ - com.google.protobuf.TimestampOrBuilder getDeviceAckTimeOrBuilder(); - - /** - * - * - *
-   * The device configuration data.
-   * 
- * - * bytes binary_data = 4; - * - * @return The binaryData. - */ - com.google.protobuf.ByteString getBinaryData(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceCredential.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceCredential.java deleted file mode 100644 index 34be7d7f..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceCredential.java +++ /dev/null @@ -1,1218 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * A server-stored device credential used for authentication.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeviceCredential} - */ -public final class DeviceCredential extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.DeviceCredential) - DeviceCredentialOrBuilder { - private static final long serialVersionUID = 0L; - // Use DeviceCredential.newBuilder() to construct. - private DeviceCredential(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private DeviceCredential() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeviceCredential(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceCredential_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceCredential_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeviceCredential.class, - com.google.cloud.iot.v1.DeviceCredential.Builder.class); - } - - private int credentialCase_ = 0; - private java.lang.Object credential_; - - public enum CredentialCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - PUBLIC_KEY(2), - CREDENTIAL_NOT_SET(0); - private final int value; - - private CredentialCase(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 CredentialCase valueOf(int value) { - return forNumber(value); - } - - public static CredentialCase forNumber(int value) { - switch (value) { - case 2: - return PUBLIC_KEY; - case 0: - return CREDENTIAL_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public CredentialCase getCredentialCase() { - return CredentialCase.forNumber(credentialCase_); - } - - public static final int PUBLIC_KEY_FIELD_NUMBER = 2; - /** - * - * - *
-   * A public key used to verify the signature of JSON Web Tokens (JWTs).
-   * When adding a new device credential, either via device creation or via
-   * modifications, this public key credential may be required to be signed by
-   * one of the registry level certificates. More specifically, if the
-   * registry contains at least one certificate, any new device credential
-   * must be signed by one of the registry certificates. As a result,
-   * when the registry contains certificates, only X.509 certificates are
-   * accepted as device credentials. However, if the registry does
-   * not contain a certificate, self-signed certificates and public keys will
-   * be accepted. New device credentials must be different from every
-   * registry-level certificate.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - * - * @return Whether the publicKey field is set. - */ - @java.lang.Override - public boolean hasPublicKey() { - return credentialCase_ == 2; - } - /** - * - * - *
-   * A public key used to verify the signature of JSON Web Tokens (JWTs).
-   * When adding a new device credential, either via device creation or via
-   * modifications, this public key credential may be required to be signed by
-   * one of the registry level certificates. More specifically, if the
-   * registry contains at least one certificate, any new device credential
-   * must be signed by one of the registry certificates. As a result,
-   * when the registry contains certificates, only X.509 certificates are
-   * accepted as device credentials. However, if the registry does
-   * not contain a certificate, self-signed certificates and public keys will
-   * be accepted. New device credentials must be different from every
-   * registry-level certificate.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - * - * @return The publicKey. - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCredential getPublicKey() { - if (credentialCase_ == 2) { - return (com.google.cloud.iot.v1.PublicKeyCredential) credential_; - } - return com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance(); - } - /** - * - * - *
-   * A public key used to verify the signature of JSON Web Tokens (JWTs).
-   * When adding a new device credential, either via device creation or via
-   * modifications, this public key credential may be required to be signed by
-   * one of the registry level certificates. More specifically, if the
-   * registry contains at least one certificate, any new device credential
-   * must be signed by one of the registry certificates. As a result,
-   * when the registry contains certificates, only X.509 certificates are
-   * accepted as device credentials. However, if the registry does
-   * not contain a certificate, self-signed certificates and public keys will
-   * be accepted. New device credentials must be different from every
-   * registry-level certificate.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCredentialOrBuilder getPublicKeyOrBuilder() { - if (credentialCase_ == 2) { - return (com.google.cloud.iot.v1.PublicKeyCredential) credential_; - } - return com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance(); - } - - public static final int EXPIRATION_TIME_FIELD_NUMBER = 6; - private com.google.protobuf.Timestamp expirationTime_; - /** - * - * - *
-   * [Optional] The time at which this credential becomes invalid. This
-   * credential will be ignored for new client authentication requests after
-   * this timestamp; however, it will not be automatically deleted.
-   * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - * - * @return Whether the expirationTime field is set. - */ - @java.lang.Override - public boolean hasExpirationTime() { - return expirationTime_ != null; - } - /** - * - * - *
-   * [Optional] The time at which this credential becomes invalid. This
-   * credential will be ignored for new client authentication requests after
-   * this timestamp; however, it will not be automatically deleted.
-   * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - * - * @return The expirationTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getExpirationTime() { - return expirationTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : expirationTime_; - } - /** - * - * - *
-   * [Optional] The time at which this credential becomes invalid. This
-   * credential will be ignored for new client authentication requests after
-   * this timestamp; however, it will not be automatically deleted.
-   * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getExpirationTimeOrBuilder() { - return getExpirationTime(); - } - - 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 (credentialCase_ == 2) { - output.writeMessage(2, (com.google.cloud.iot.v1.PublicKeyCredential) credential_); - } - if (expirationTime_ != null) { - output.writeMessage(6, getExpirationTime()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (credentialCase_ == 2) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 2, (com.google.cloud.iot.v1.PublicKeyCredential) credential_); - } - if (expirationTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getExpirationTime()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.DeviceCredential)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.DeviceCredential other = (com.google.cloud.iot.v1.DeviceCredential) obj; - - if (hasExpirationTime() != other.hasExpirationTime()) return false; - if (hasExpirationTime()) { - if (!getExpirationTime().equals(other.getExpirationTime())) return false; - } - if (!getCredentialCase().equals(other.getCredentialCase())) return false; - switch (credentialCase_) { - case 2: - if (!getPublicKey().equals(other.getPublicKey())) return false; - break; - case 0: - default: - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasExpirationTime()) { - hash = (37 * hash) + EXPIRATION_TIME_FIELD_NUMBER; - hash = (53 * hash) + getExpirationTime().hashCode(); - } - switch (credentialCase_) { - case 2: - hash = (37 * hash) + PUBLIC_KEY_FIELD_NUMBER; - hash = (53 * hash) + getPublicKey().hashCode(); - break; - case 0: - default: - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.DeviceCredential parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceCredential 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.iot.v1.DeviceCredential parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceCredential 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.iot.v1.DeviceCredential parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceCredential parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.DeviceCredential parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceCredential 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.iot.v1.DeviceCredential parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceCredential 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.iot.v1.DeviceCredential parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceCredential 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.iot.v1.DeviceCredential 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 server-stored device credential used for authentication.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeviceCredential} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.DeviceCredential) - com.google.cloud.iot.v1.DeviceCredentialOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceCredential_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceCredential_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeviceCredential.class, - com.google.cloud.iot.v1.DeviceCredential.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.DeviceCredential.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (publicKeyBuilder_ != null) { - publicKeyBuilder_.clear(); - } - if (expirationTimeBuilder_ == null) { - expirationTime_ = null; - } else { - expirationTime_ = null; - expirationTimeBuilder_ = null; - } - credentialCase_ = 0; - credential_ = null; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceCredential_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceCredential getDefaultInstanceForType() { - return com.google.cloud.iot.v1.DeviceCredential.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceCredential build() { - com.google.cloud.iot.v1.DeviceCredential result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceCredential buildPartial() { - com.google.cloud.iot.v1.DeviceCredential result = - new com.google.cloud.iot.v1.DeviceCredential(this); - if (credentialCase_ == 2) { - if (publicKeyBuilder_ == null) { - result.credential_ = credential_; - } else { - result.credential_ = publicKeyBuilder_.build(); - } - } - if (expirationTimeBuilder_ == null) { - result.expirationTime_ = expirationTime_; - } else { - result.expirationTime_ = expirationTimeBuilder_.build(); - } - result.credentialCase_ = credentialCase_; - 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.iot.v1.DeviceCredential) { - return mergeFrom((com.google.cloud.iot.v1.DeviceCredential) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.DeviceCredential other) { - if (other == com.google.cloud.iot.v1.DeviceCredential.getDefaultInstance()) return this; - if (other.hasExpirationTime()) { - mergeExpirationTime(other.getExpirationTime()); - } - switch (other.getCredentialCase()) { - case PUBLIC_KEY: - { - mergePublicKey(other.getPublicKey()); - break; - } - case CREDENTIAL_NOT_SET: - { - break; - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 18: - { - input.readMessage(getPublicKeyFieldBuilder().getBuilder(), extensionRegistry); - credentialCase_ = 2; - break; - } // case 18 - case 50: - { - input.readMessage(getExpirationTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 50 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int credentialCase_ = 0; - private java.lang.Object credential_; - - public CredentialCase getCredentialCase() { - return CredentialCase.forNumber(credentialCase_); - } - - public Builder clearCredential() { - credentialCase_ = 0; - credential_ = null; - onChanged(); - return this; - } - - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.PublicKeyCredential, - com.google.cloud.iot.v1.PublicKeyCredential.Builder, - com.google.cloud.iot.v1.PublicKeyCredentialOrBuilder> - publicKeyBuilder_; - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - * - * @return Whether the publicKey field is set. - */ - @java.lang.Override - public boolean hasPublicKey() { - return credentialCase_ == 2; - } - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - * - * @return The publicKey. - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCredential getPublicKey() { - if (publicKeyBuilder_ == null) { - if (credentialCase_ == 2) { - return (com.google.cloud.iot.v1.PublicKeyCredential) credential_; - } - return com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance(); - } else { - if (credentialCase_ == 2) { - return publicKeyBuilder_.getMessage(); - } - return com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance(); - } - } - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - public Builder setPublicKey(com.google.cloud.iot.v1.PublicKeyCredential value) { - if (publicKeyBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - credential_ = value; - onChanged(); - } else { - publicKeyBuilder_.setMessage(value); - } - credentialCase_ = 2; - return this; - } - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - public Builder setPublicKey( - com.google.cloud.iot.v1.PublicKeyCredential.Builder builderForValue) { - if (publicKeyBuilder_ == null) { - credential_ = builderForValue.build(); - onChanged(); - } else { - publicKeyBuilder_.setMessage(builderForValue.build()); - } - credentialCase_ = 2; - return this; - } - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - public Builder mergePublicKey(com.google.cloud.iot.v1.PublicKeyCredential value) { - if (publicKeyBuilder_ == null) { - if (credentialCase_ == 2 - && credential_ != com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance()) { - credential_ = - com.google.cloud.iot.v1.PublicKeyCredential.newBuilder( - (com.google.cloud.iot.v1.PublicKeyCredential) credential_) - .mergeFrom(value) - .buildPartial(); - } else { - credential_ = value; - } - onChanged(); - } else { - if (credentialCase_ == 2) { - publicKeyBuilder_.mergeFrom(value); - } else { - publicKeyBuilder_.setMessage(value); - } - } - credentialCase_ = 2; - return this; - } - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - public Builder clearPublicKey() { - if (publicKeyBuilder_ == null) { - if (credentialCase_ == 2) { - credentialCase_ = 0; - credential_ = null; - onChanged(); - } - } else { - if (credentialCase_ == 2) { - credentialCase_ = 0; - credential_ = null; - } - publicKeyBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - public com.google.cloud.iot.v1.PublicKeyCredential.Builder getPublicKeyBuilder() { - return getPublicKeyFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCredentialOrBuilder getPublicKeyOrBuilder() { - if ((credentialCase_ == 2) && (publicKeyBuilder_ != null)) { - return publicKeyBuilder_.getMessageOrBuilder(); - } else { - if (credentialCase_ == 2) { - return (com.google.cloud.iot.v1.PublicKeyCredential) credential_; - } - return com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance(); - } - } - /** - * - * - *
-     * A public key used to verify the signature of JSON Web Tokens (JWTs).
-     * When adding a new device credential, either via device creation or via
-     * modifications, this public key credential may be required to be signed by
-     * one of the registry level certificates. More specifically, if the
-     * registry contains at least one certificate, any new device credential
-     * must be signed by one of the registry certificates. As a result,
-     * when the registry contains certificates, only X.509 certificates are
-     * accepted as device credentials. However, if the registry does
-     * not contain a certificate, self-signed certificates and public keys will
-     * be accepted. New device credentials must be different from every
-     * registry-level certificate.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.PublicKeyCredential, - com.google.cloud.iot.v1.PublicKeyCredential.Builder, - com.google.cloud.iot.v1.PublicKeyCredentialOrBuilder> - getPublicKeyFieldBuilder() { - if (publicKeyBuilder_ == null) { - if (!(credentialCase_ == 2)) { - credential_ = com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance(); - } - publicKeyBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.PublicKeyCredential, - com.google.cloud.iot.v1.PublicKeyCredential.Builder, - com.google.cloud.iot.v1.PublicKeyCredentialOrBuilder>( - (com.google.cloud.iot.v1.PublicKeyCredential) credential_, - getParentForChildren(), - isClean()); - credential_ = null; - } - credentialCase_ = 2; - onChanged(); - ; - return publicKeyBuilder_; - } - - private com.google.protobuf.Timestamp expirationTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - expirationTimeBuilder_; - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - * - * @return Whether the expirationTime field is set. - */ - public boolean hasExpirationTime() { - return expirationTimeBuilder_ != null || expirationTime_ != null; - } - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - * - * @return The expirationTime. - */ - public com.google.protobuf.Timestamp getExpirationTime() { - if (expirationTimeBuilder_ == null) { - return expirationTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : expirationTime_; - } else { - return expirationTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - public Builder setExpirationTime(com.google.protobuf.Timestamp value) { - if (expirationTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - expirationTime_ = value; - onChanged(); - } else { - expirationTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - public Builder setExpirationTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (expirationTimeBuilder_ == null) { - expirationTime_ = builderForValue.build(); - onChanged(); - } else { - expirationTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - public Builder mergeExpirationTime(com.google.protobuf.Timestamp value) { - if (expirationTimeBuilder_ == null) { - if (expirationTime_ != null) { - expirationTime_ = - com.google.protobuf.Timestamp.newBuilder(expirationTime_) - .mergeFrom(value) - .buildPartial(); - } else { - expirationTime_ = value; - } - onChanged(); - } else { - expirationTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - public Builder clearExpirationTime() { - if (expirationTimeBuilder_ == null) { - expirationTime_ = null; - onChanged(); - } else { - expirationTime_ = null; - expirationTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - public com.google.protobuf.Timestamp.Builder getExpirationTimeBuilder() { - - onChanged(); - return getExpirationTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - public com.google.protobuf.TimestampOrBuilder getExpirationTimeOrBuilder() { - if (expirationTimeBuilder_ != null) { - return expirationTimeBuilder_.getMessageOrBuilder(); - } else { - return expirationTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : expirationTime_; - } - } - /** - * - * - *
-     * [Optional] The time at which this credential becomes invalid. This
-     * credential will be ignored for new client authentication requests after
-     * this timestamp; however, it will not be automatically deleted.
-     * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getExpirationTimeFieldBuilder() { - if (expirationTimeBuilder_ == null) { - expirationTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getExpirationTime(), getParentForChildren(), isClean()); - expirationTime_ = null; - } - return expirationTimeBuilder_; - } - - @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.iot.v1.DeviceCredential) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.DeviceCredential) - private static final com.google.cloud.iot.v1.DeviceCredential DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.DeviceCredential(); - } - - public static com.google.cloud.iot.v1.DeviceCredential getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public DeviceCredential parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceCredential getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceCredentialOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceCredentialOrBuilder.java deleted file mode 100644 index 6f59a8f7..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceCredentialOrBuilder.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface DeviceCredentialOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.DeviceCredential) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * A public key used to verify the signature of JSON Web Tokens (JWTs).
-   * When adding a new device credential, either via device creation or via
-   * modifications, this public key credential may be required to be signed by
-   * one of the registry level certificates. More specifically, if the
-   * registry contains at least one certificate, any new device credential
-   * must be signed by one of the registry certificates. As a result,
-   * when the registry contains certificates, only X.509 certificates are
-   * accepted as device credentials. However, if the registry does
-   * not contain a certificate, self-signed certificates and public keys will
-   * be accepted. New device credentials must be different from every
-   * registry-level certificate.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - * - * @return Whether the publicKey field is set. - */ - boolean hasPublicKey(); - /** - * - * - *
-   * A public key used to verify the signature of JSON Web Tokens (JWTs).
-   * When adding a new device credential, either via device creation or via
-   * modifications, this public key credential may be required to be signed by
-   * one of the registry level certificates. More specifically, if the
-   * registry contains at least one certificate, any new device credential
-   * must be signed by one of the registry certificates. As a result,
-   * when the registry contains certificates, only X.509 certificates are
-   * accepted as device credentials. However, if the registry does
-   * not contain a certificate, self-signed certificates and public keys will
-   * be accepted. New device credentials must be different from every
-   * registry-level certificate.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - * - * @return The publicKey. - */ - com.google.cloud.iot.v1.PublicKeyCredential getPublicKey(); - /** - * - * - *
-   * A public key used to verify the signature of JSON Web Tokens (JWTs).
-   * When adding a new device credential, either via device creation or via
-   * modifications, this public key credential may be required to be signed by
-   * one of the registry level certificates. More specifically, if the
-   * registry contains at least one certificate, any new device credential
-   * must be signed by one of the registry certificates. As a result,
-   * when the registry contains certificates, only X.509 certificates are
-   * accepted as device credentials. However, if the registry does
-   * not contain a certificate, self-signed certificates and public keys will
-   * be accepted. New device credentials must be different from every
-   * registry-level certificate.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCredential public_key = 2; - */ - com.google.cloud.iot.v1.PublicKeyCredentialOrBuilder getPublicKeyOrBuilder(); - - /** - * - * - *
-   * [Optional] The time at which this credential becomes invalid. This
-   * credential will be ignored for new client authentication requests after
-   * this timestamp; however, it will not be automatically deleted.
-   * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - * - * @return Whether the expirationTime field is set. - */ - boolean hasExpirationTime(); - /** - * - * - *
-   * [Optional] The time at which this credential becomes invalid. This
-   * credential will be ignored for new client authentication requests after
-   * this timestamp; however, it will not be automatically deleted.
-   * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - * - * @return The expirationTime. - */ - com.google.protobuf.Timestamp getExpirationTime(); - /** - * - * - *
-   * [Optional] The time at which this credential becomes invalid. This
-   * credential will be ignored for new client authentication requests after
-   * this timestamp; however, it will not be automatically deleted.
-   * 
- * - * .google.protobuf.Timestamp expiration_time = 6; - */ - com.google.protobuf.TimestampOrBuilder getExpirationTimeOrBuilder(); - - public com.google.cloud.iot.v1.DeviceCredential.CredentialCase getCredentialCase(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceManagerProto.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceManagerProto.java deleted file mode 100644 index 2a170d40..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceManagerProto.java +++ /dev/null @@ -1,568 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public final class DeviceManagerProto { - private DeviceManagerProto() {} - - 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_iot_v1_CreateDeviceRegistryRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_CreateDeviceRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_CreateDeviceRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_GetDeviceRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_GetDeviceRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_UpdateDeviceRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_UpdateDeviceRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_DeleteDeviceRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_DeleteDeviceRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ListDevicesRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ListDevicesRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_GatewayListOptions_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_GatewayListOptions_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ListDevicesResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ListDevicesResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_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/iot/v1/device_manager.pro" - + "to\022\023google.cloud.iot.v1\032\034google/api/anno" - + "tations.proto\032\027google/api/client.proto\032\037" - + "google/api/field_behavior.proto\032\031google/" - + "api/resource.proto\032#google/cloud/iot/v1/" - + "resources.proto\032\036google/iam/v1/iam_polic" - + "y.proto\032\032google/iam/v1/policy.proto\032\033goo" - + "gle/protobuf/empty.proto\032 google/protobu" - + "f/field_mask.proto\"\233\001\n\033CreateDeviceRegis" - + "tryRequest\0229\n\006parent\030\001 \001(\tB)\340A\002\372A#\n!loca" - + "tions.googleapis.com/Location\022A\n\017device_" - + "registry\030\002 \001(\0132#.google.cloud.iot.v1.Dev" - + "iceRegistryB\003\340A\002\"R\n\030GetDeviceRegistryReq" - + "uest\0226\n\004name\030\001 \001(\tB(\340A\002\372A\"\n cloudiot.goo" - + "gleapis.com/Registry\"U\n\033DeleteDeviceRegi" - + "stryRequest\0226\n\004name\030\001 \001(\tB(\340A\002\372A\"\n cloud" - + "iot.googleapis.com/Registry\"\226\001\n\033UpdateDe" - + "viceRegistryRequest\022A\n\017device_registry\030\001" - + " \001(\0132#.google.cloud.iot.v1.DeviceRegistr" - + "yB\003\340A\002\0224\n\013update_mask\030\002 \001(\0132\032.google.pro" - + "tobuf.FieldMaskB\003\340A\002\"\177\n\033ListDeviceRegist" - + "riesRequest\0229\n\006parent\030\001 \001(\tB)\340A\002\372A#\n!loc" - + "ations.googleapis.com/Location\022\021\n\tpage_s" - + "ize\030\002 \001(\005\022\022\n\npage_token\030\003 \001(\t\"w\n\034ListDev" - + "iceRegistriesResponse\022>\n\021device_registri" - + "es\030\001 \003(\0132#.google.cloud.iot.v1.DeviceReg" - + "istry\022\027\n\017next_page_token\030\002 \001(\t\"\201\001\n\023Creat" - + "eDeviceRequest\0228\n\006parent\030\001 \001(\tB(\340A\002\372A\"\n " - + "cloudiot.googleapis.com/Registry\0220\n\006devi" - + "ce\030\002 \001(\0132\033.google.cloud.iot.v1.DeviceB\003\340" - + "A\002\"x\n\020GetDeviceRequest\0224\n\004name\030\001 \001(\tB&\340A" - + "\002\372A \n\036cloudiot.googleapis.com/Device\022.\n\n" - + "field_mask\030\002 \001(\0132\032.google.protobuf.Field" - + "Mask\"}\n\023UpdateDeviceRequest\0220\n\006device\030\002 " - + "\001(\0132\033.google.cloud.iot.v1.DeviceB\003\340A\002\0224\n" - + "\013update_mask\030\003 \001(\0132\032.google.protobuf.Fie" - + "ldMaskB\003\340A\002\"K\n\023DeleteDeviceRequest\0224\n\004na" - + "me\030\001 \001(\tB&\340A\002\372A \n\036cloudiot.googleapis.co" - + "m/Device\"\230\002\n\022ListDevicesRequest\0228\n\006paren" - + "t\030\001 \001(\tB(\340A\002\372A\"\n cloudiot.googleapis.com" - + "/Registry\022\026\n\016device_num_ids\030\002 \003(\004\022\022\n\ndev" - + "ice_ids\030\003 \003(\t\022.\n\nfield_mask\030\004 \001(\0132\032.goog" - + "le.protobuf.FieldMask\022E\n\024gateway_list_op" - + "tions\030\006 \001(\0132\'.google.cloud.iot.v1.Gatewa" - + "yListOptions\022\021\n\tpage_size\030d \001(\005\022\022\n\npage_" - + "token\030e \001(\t\"\235\001\n\022GatewayListOptions\0228\n\014ga" - + "teway_type\030\001 \001(\0162 .google.cloud.iot.v1.G" - + "atewayTypeH\000\022!\n\027associations_gateway_id\030" - + "\002 \001(\tH\000\022 \n\026associations_device_id\030\003 \001(\tH" - + "\000B\010\n\006filter\"\\\n\023ListDevicesResponse\022,\n\007de" - + "vices\030\001 \003(\0132\033.google.cloud.iot.v1.Device" - + "\022\027\n\017next_page_token\030\002 \001(\t\"\215\001\n ModifyClou" - + "dToDeviceConfigRequest\0224\n\004name\030\001 \001(\tB&\340A" - + "\002\372A \n\036cloudiot.googleapis.com/Device\022\031\n\021" - + "version_to_update\030\002 \001(\003\022\030\n\013binary_data\030\003" - + " \001(\014B\003\340A\002\"m\n\037ListDeviceConfigVersionsReq" - + "uest\0224\n\004name\030\001 \001(\tB&\340A\002\372A \n\036cloudiot.goo" - + "gleapis.com/Device\022\024\n\014num_versions\030\002 \001(\005" - + "\"]\n ListDeviceConfigVersionsResponse\0229\n\016" - + "device_configs\030\001 \003(\0132!.google.cloud.iot." - + "v1.DeviceConfig\"c\n\027ListDeviceStatesReque" - + "st\0224\n\004name\030\001 \001(\tB&\340A\002\372A \n\036cloudiot.googl" - + "eapis.com/Device\022\022\n\nnum_states\030\002 \001(\005\"S\n\030" - + "ListDeviceStatesResponse\0227\n\rdevice_state" - + "s\030\001 \003(\0132 .google.cloud.iot.v1.DeviceStat" - + "e\"\177\n\032SendCommandToDeviceRequest\0224\n\004name\030" - + "\001 \001(\tB&\340A\002\372A \n\036cloudiot.googleapis.com/D" - + "evice\022\030\n\013binary_data\030\002 \001(\014B\003\340A\002\022\021\n\tsubfo" - + "lder\030\003 \001(\t\"\035\n\033SendCommandToDeviceRespons" - + "e\"\207\001\n\032BindDeviceToGatewayRequest\0228\n\006pare" - + "nt\030\001 \001(\tB(\340A\002\372A\"\n cloudiot.googleapis.co" - + "m/Registry\022\027\n\ngateway_id\030\002 \001(\tB\003\340A\002\022\026\n\td" - + "evice_id\030\003 \001(\tB\003\340A\002\"\035\n\033BindDeviceToGatew" - + "ayResponse\"\213\001\n\036UnbindDeviceFromGatewayRe" - + "quest\0228\n\006parent\030\001 \001(\tB(\340A\002\372A\"\n cloudiot." - + "googleapis.com/Registry\022\027\n\ngateway_id\030\002 " - + "\001(\tB\003\340A\002\022\026\n\tdevice_id\030\003 \001(\tB\003\340A\002\"!\n\037Unbi" - + "ndDeviceFromGatewayResponse2\246&\n\rDeviceMa" - + "nager\022\317\001\n\024CreateDeviceRegistry\0220.google." - + "cloud.iot.v1.CreateDeviceRegistryRequest" - + "\032#.google.cloud.iot.v1.DeviceRegistry\"`\202" - + "\323\344\223\002A\"./v1/{parent=projects/*/locations/" - + "*}/registries:\017device_registry\332A\026parent," - + "device_registry\022\246\001\n\021GetDeviceRegistry\022-." - + "google.cloud.iot.v1.GetDeviceRegistryReq" - + "uest\032#.google.cloud.iot.v1.DeviceRegistr" - + "y\"=\202\323\344\223\0020\022./v1/{name=projects/*/location" - + "s/*/registries/*}\332A\004name\022\344\001\n\024UpdateDevic" - + "eRegistry\0220.google.cloud.iot.v1.UpdateDe" - + "viceRegistryRequest\032#.google.cloud.iot.v" - + "1.DeviceRegistry\"u\202\323\344\223\002Q2>/v1/{device_re" - + "gistry.name=projects/*/locations/*/regis" - + "tries/*}:\017device_registry\332A\033device_regis" - + "try,update_mask\022\237\001\n\024DeleteDeviceRegistry" - + "\0220.google.cloud.iot.v1.DeleteDeviceRegis" - + "tryRequest\032\026.google.protobuf.Empty\"=\202\323\344\223" - + "\0020*./v1/{name=projects/*/locations/*/reg" - + "istries/*}\332A\004name\022\274\001\n\024ListDeviceRegistri" - + "es\0220.google.cloud.iot.v1.ListDeviceRegis" - + "triesRequest\0321.google.cloud.iot.v1.ListD" - + "eviceRegistriesResponse\"?\202\323\344\223\0020\022./v1/{pa" - + "rent=projects/*/locations/*}/registries\332" - + "A\006parent\022\257\001\n\014CreateDevice\022(.google.cloud" - + ".iot.v1.CreateDeviceRequest\032\033.google.clo" - + "ud.iot.v1.Device\"X\202\323\344\223\002B\"8/v1/{parent=pr" - + "ojects/*/locations/*/registries/*}/devic" - + "es:\006device\332A\rparent,device\022\336\001\n\tGetDevice" - + "\022%.google.cloud.iot.v1.GetDeviceRequest\032" - + "\033.google.cloud.iot.v1.Device\"\214\001\202\323\344\223\002\177\0228/" - + "v1/{name=projects/*/locations/*/registri" - + "es/*/devices/*}ZC\022A/v1/{name=projects/*/" - + "locations/*/registries/*/groups/*/device" - + "s/*}\332A\004name\022\221\002\n\014UpdateDevice\022(.google.cl" - + "oud.iot.v1.UpdateDeviceRequest\032\033.google." - + "cloud.iot.v1.Device\"\271\001\202\323\344\223\002\235\0012?/v1/{devi" - + "ce.name=projects/*/locations/*/registrie" - + "s/*/devices/*}:\006deviceZR2H/v1/{device.na" - + "me=projects/*/locations/*/registries/*/g" - + "roups/*/devices/*}:\006device\332A\022device,upda" - + "te_mask\022\231\001\n\014DeleteDevice\022(.google.cloud." - + "iot.v1.DeleteDeviceRequest\032\026.google.prot" - + "obuf.Empty\"G\202\323\344\223\002:*8/v1/{name=projects/*" - + "/locations/*/registries/*/devices/*}\332A\004n" - + "ame\022\361\001\n\013ListDevices\022\'.google.cloud.iot.v" - + "1.ListDevicesRequest\032(.google.cloud.iot." - + "v1.ListDevicesResponse\"\216\001\202\323\344\223\002\177\0228/v1/{pa" - + "rent=projects/*/locations/*/registries/*" - + "}/devicesZC\022A/v1/{parent=projects/*/loca" - + "tions/*/registries/*/groups/*}/devices\332A" - + "\006parent\022\313\002\n\031ModifyCloudToDeviceConfig\0225." - + "google.cloud.iot.v1.ModifyCloudToDeviceC" - + "onfigRequest\032!.google.cloud.iot.v1.Devic" - + "eConfig\"\323\001\202\323\344\223\002\271\001\"R/v1/{name=projects/*/" - + "locations/*/registries/*/devices/*}:modi" - + "fyCloudToDeviceConfig:\001*Z`\"[/v1/{name=pr" - + "ojects/*/locations/*/registries/*/groups" - + "/*/devices/*}:modifyCloudToDeviceConfig:" - + "\001*\332A\020name,binary_data\022\265\002\n\030ListDeviceConf" - + "igVersions\0224.google.cloud.iot.v1.ListDev" - + "iceConfigVersionsRequest\0325.google.cloud." - + "iot.v1.ListDeviceConfigVersionsResponse\"" - + "\253\001\202\323\344\223\002\235\001\022G/v1/{name=projects/*/location" - + "s/*/registries/*/devices/*}/configVersio" - + "nsZR\022P/v1/{name=projects/*/locations/*/r" - + "egistries/*/groups/*/devices/*}/configVe" - + "rsions\332A\004name\022\215\002\n\020ListDeviceStates\022,.goo" - + "gle.cloud.iot.v1.ListDeviceStatesRequest" - + "\032-.google.cloud.iot.v1.ListDeviceStatesR" - + "esponse\"\233\001\202\323\344\223\002\215\001\022?/v1/{name=projects/*/" - + "locations/*/registries/*/devices/*}/stat" - + "esZJ\022H/v1/{name=projects/*/locations/*/r" - + "egistries/*/groups/*/devices/*}/states\332A" - + "\004name\022\370\001\n\014SetIamPolicy\022\".google.iam.v1.S" - + "etIamPolicyRequest\032\025.google.iam.v1.Polic" - + "y\"\254\001\202\323\344\223\002\223\001\"?/v1/{resource=projects/*/lo" - + "cations/*/registries/*}:setIamPolicy:\001*Z" - + "M\"H/v1/{resource=projects/*/locations/*/" - + "registries/*/groups/*}:setIamPolicy:\001*\332A" - + "\017resource,policy\022\361\001\n\014GetIamPolicy\022\".goog" - + "le.iam.v1.GetIamPolicyRequest\032\025.google.i" - + "am.v1.Policy\"\245\001\202\323\344\223\002\223\001\"?/v1/{resource=pr" - + "ojects/*/locations/*/registries/*}:getIa" - + "mPolicy:\001*ZM\"H/v1/{resource=projects/*/l" - + "ocations/*/registries/*/groups/*}:getIam" - + "Policy:\001*\332A\010resource\022\251\002\n\022TestIamPermissi" - + "ons\022(.google.iam.v1.TestIamPermissionsRe" - + "quest\032).google.iam.v1.TestIamPermissions" - + "Response\"\275\001\202\323\344\223\002\237\001\"E/v1/{resource=projec" - + "ts/*/locations/*/registries/*}:testIamPe" - + "rmissions:\001*ZS\"N/v1/{resource=projects/*" - + "/locations/*/registries/*/groups/*}:test" - + "IamPermissions:\001*\332A\024resource,permissions" - + "\022\337\002\n\023SendCommandToDevice\022/.google.cloud." - + "iot.v1.SendCommandToDeviceRequest\0320.goog" - + "le.cloud.iot.v1.SendCommandToDeviceRespo" - + "nse\"\344\001\202\323\344\223\002\255\001\"L/v1/{name=projects/*/loca" - + "tions/*/registries/*/devices/*}:sendComm" - + "andToDevice:\001*ZZ\"U/v1/{name=projects/*/l" - + "ocations/*/registries/*/groups/*/devices" - + "/*}:sendCommandToDevice:\001*\332A\020name,binary" - + "_data\332A\032name,binary_data,subfolder\022\275\002\n\023B" - + "indDeviceToGateway\022/.google.cloud.iot.v1" - + ".BindDeviceToGatewayRequest\0320.google.clo" - + "ud.iot.v1.BindDeviceToGatewayResponse\"\302\001" - + "\202\323\344\223\002\235\001\"D/v1/{parent=projects/*/location" - + "s/*/registries/*}:bindDeviceToGateway:\001*" - + "ZR\"M/v1/{parent=projects/*/locations/*/r" - + "egistries/*/groups/*}:bindDeviceToGatewa" - + "y:\001*\332A\033parent,gateway_id,device_id\022\321\002\n\027U" - + "nbindDeviceFromGateway\0223.google.cloud.io" - + "t.v1.UnbindDeviceFromGatewayRequest\0324.go" - + "ogle.cloud.iot.v1.UnbindDeviceFromGatewa" - + "yResponse\"\312\001\202\323\344\223\002\245\001\"H/v1/{parent=project" - + "s/*/locations/*/registries/*}:unbindDevi" - + "ceFromGateway:\001*ZV\"Q/v1/{parent=projects" - + "/*/locations/*/registries/*/groups/*}:un" - + "bindDeviceFromGateway:\001*\332A\033parent,gatewa" - + "y_id,device_id\032t\312A\027cloudiot.googleapis.c" - + "om\322AWhttps://www.googleapis.com/auth/clo" - + "ud-platform,https://www.googleapis.com/a" - + "uth/cloudiotBj\n\027com.google.cloud.iot.v1B" - + "\022DeviceManagerProtoP\001Z6google.golang.org" - + "/genproto/googleapis/cloud/iot/v1;iot\370\001\001" - + "b\006proto3" - }; - descriptor = - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.api.AnnotationsProto.getDescriptor(), - com.google.api.ClientProto.getDescriptor(), - com.google.api.FieldBehaviorProto.getDescriptor(), - com.google.api.ResourceProto.getDescriptor(), - com.google.cloud.iot.v1.ResourcesProto.getDescriptor(), - com.google.iam.v1.IamPolicyProto.getDescriptor(), - com.google.iam.v1.PolicyProto.getDescriptor(), - com.google.protobuf.EmptyProto.getDescriptor(), - com.google.protobuf.FieldMaskProto.getDescriptor(), - }); - internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_CreateDeviceRegistryRequest_descriptor, - new java.lang.String[] { - "Parent", "DeviceRegistry", - }); - internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_descriptor, - new java.lang.String[] { - "Name", - }); - internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_DeleteDeviceRegistryRequest_descriptor, - new java.lang.String[] { - "Name", - }); - internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_descriptor, - new java.lang.String[] { - "DeviceRegistry", "UpdateMask", - }); - internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_descriptor, - new java.lang.String[] { - "Parent", "PageSize", "PageToken", - }); - internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_descriptor, - new java.lang.String[] { - "DeviceRegistries", "NextPageToken", - }); - internal_static_google_cloud_iot_v1_CreateDeviceRequest_descriptor = - getDescriptor().getMessageTypes().get(6); - internal_static_google_cloud_iot_v1_CreateDeviceRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_CreateDeviceRequest_descriptor, - new java.lang.String[] { - "Parent", "Device", - }); - internal_static_google_cloud_iot_v1_GetDeviceRequest_descriptor = - getDescriptor().getMessageTypes().get(7); - internal_static_google_cloud_iot_v1_GetDeviceRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_GetDeviceRequest_descriptor, - new java.lang.String[] { - "Name", "FieldMask", - }); - internal_static_google_cloud_iot_v1_UpdateDeviceRequest_descriptor = - getDescriptor().getMessageTypes().get(8); - internal_static_google_cloud_iot_v1_UpdateDeviceRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_UpdateDeviceRequest_descriptor, - new java.lang.String[] { - "Device", "UpdateMask", - }); - internal_static_google_cloud_iot_v1_DeleteDeviceRequest_descriptor = - getDescriptor().getMessageTypes().get(9); - internal_static_google_cloud_iot_v1_DeleteDeviceRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_DeleteDeviceRequest_descriptor, - new java.lang.String[] { - "Name", - }); - internal_static_google_cloud_iot_v1_ListDevicesRequest_descriptor = - getDescriptor().getMessageTypes().get(10); - internal_static_google_cloud_iot_v1_ListDevicesRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ListDevicesRequest_descriptor, - new java.lang.String[] { - "Parent", - "DeviceNumIds", - "DeviceIds", - "FieldMask", - "GatewayListOptions", - "PageSize", - "PageToken", - }); - internal_static_google_cloud_iot_v1_GatewayListOptions_descriptor = - getDescriptor().getMessageTypes().get(11); - internal_static_google_cloud_iot_v1_GatewayListOptions_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_GatewayListOptions_descriptor, - new java.lang.String[] { - "GatewayType", "AssociationsGatewayId", "AssociationsDeviceId", "Filter", - }); - internal_static_google_cloud_iot_v1_ListDevicesResponse_descriptor = - getDescriptor().getMessageTypes().get(12); - internal_static_google_cloud_iot_v1_ListDevicesResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ListDevicesResponse_descriptor, - new java.lang.String[] { - "Devices", "NextPageToken", - }); - internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_descriptor = - getDescriptor().getMessageTypes().get(13); - internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_descriptor, - new java.lang.String[] { - "Name", "VersionToUpdate", "BinaryData", - }); - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_descriptor = - getDescriptor().getMessageTypes().get(14); - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_descriptor, - new java.lang.String[] { - "Name", "NumVersions", - }); - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_descriptor = - getDescriptor().getMessageTypes().get(15); - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_descriptor, - new java.lang.String[] { - "DeviceConfigs", - }); - internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_descriptor = - getDescriptor().getMessageTypes().get(16); - internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_descriptor, - new java.lang.String[] { - "Name", "NumStates", - }); - internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_descriptor = - getDescriptor().getMessageTypes().get(17); - internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_descriptor, - new java.lang.String[] { - "DeviceStates", - }); - internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_descriptor = - getDescriptor().getMessageTypes().get(18); - internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_descriptor, - new java.lang.String[] { - "Name", "BinaryData", "Subfolder", - }); - internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_descriptor = - getDescriptor().getMessageTypes().get(19); - internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_descriptor, - new java.lang.String[] {}); - internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_descriptor = - getDescriptor().getMessageTypes().get(20); - internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_BindDeviceToGatewayRequest_descriptor, - new java.lang.String[] { - "Parent", "GatewayId", "DeviceId", - }); - internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_descriptor = - getDescriptor().getMessageTypes().get(21); - internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_BindDeviceToGatewayResponse_descriptor, - new java.lang.String[] {}); - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_descriptor = - getDescriptor().getMessageTypes().get(22); - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_descriptor, - new java.lang.String[] { - "Parent", "GatewayId", "DeviceId", - }); - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_descriptor = - getDescriptor().getMessageTypes().get(23); - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_descriptor, - new java.lang.String[] {}); - 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); - 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.iot.v1.ResourcesProto.getDescriptor(); - com.google.iam.v1.IamPolicyProto.getDescriptor(); - com.google.iam.v1.PolicyProto.getDescriptor(); - com.google.protobuf.EmptyProto.getDescriptor(); - com.google.protobuf.FieldMaskProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceName.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceName.java deleted file mode 100644 index 124201d6..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceName.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.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 DeviceName implements ResourceName { - private static final PathTemplate PROJECT_LOCATION_REGISTRY_DEVICE = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/registries/{registry}/devices/{device}"); - private volatile Map fieldValuesMap; - private final String project; - private final String location; - private final String registry; - private final String device; - - @Deprecated - protected DeviceName() { - project = null; - location = null; - registry = null; - device = null; - } - - private DeviceName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - registry = Preconditions.checkNotNull(builder.getRegistry()); - device = Preconditions.checkNotNull(builder.getDevice()); - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getRegistry() { - return registry; - } - - public String getDevice() { - return device; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static DeviceName of(String project, String location, String registry, String device) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setRegistry(registry) - .setDevice(device) - .build(); - } - - public static String format(String project, String location, String registry, String device) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setRegistry(registry) - .setDevice(device) - .build() - .toString(); - } - - public static DeviceName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_LOCATION_REGISTRY_DEVICE.validatedMatch( - formattedString, "DeviceName.parse: formattedString not in valid format"); - return of( - matchMap.get("project"), - matchMap.get("location"), - matchMap.get("registry"), - matchMap.get("device")); - } - - 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 (DeviceName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_REGISTRY_DEVICE.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 (registry != null) { - fieldMapBuilder.put("registry", registry); - } - if (device != null) { - fieldMapBuilder.put("device", device); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_LOCATION_REGISTRY_DEVICE.instantiate( - "project", project, "location", location, "registry", registry, "device", device); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - DeviceName that = ((DeviceName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.location, that.location) - && Objects.equals(this.registry, that.registry) - && Objects.equals(this.device, that.device); - } - 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(registry); - h *= 1000003; - h ^= Objects.hashCode(device); - return h; - } - - /** Builder for projects/{project}/locations/{location}/registries/{registry}/devices/{device}. */ - public static class Builder { - private String project; - private String location; - private String registry; - private String device; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getRegistry() { - return registry; - } - - public String getDevice() { - return device; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setRegistry(String registry) { - this.registry = registry; - return this; - } - - public Builder setDevice(String device) { - this.device = device; - return this; - } - - private Builder(DeviceName deviceName) { - this.project = deviceName.project; - this.location = deviceName.location; - this.registry = deviceName.registry; - this.device = deviceName.device; - } - - public DeviceName build() { - return new DeviceName(this); - } - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceOrBuilder.java deleted file mode 100644 index 7596ff3f..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceOrBuilder.java +++ /dev/null @@ -1,735 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface DeviceOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.Device) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The user-defined device identifier. The device ID must be unique
-   * within a device registry.
-   * 
- * - * string id = 1; - * - * @return The id. - */ - java.lang.String getId(); - /** - * - * - *
-   * The user-defined device identifier. The device ID must be unique
-   * within a device registry.
-   * 
- * - * string id = 1; - * - * @return The bytes for id. - */ - com.google.protobuf.ByteString getIdBytes(); - - /** - * - * - *
-   * The resource path name. For example,
-   * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-   * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * When `name` is populated as a response from the service, it always ends
-   * in the device numeric ID.
-   * 
- * - * string name = 2; - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * The resource path name. For example,
-   * `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or
-   * `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * When `name` is populated as a response from the service, it always ends
-   * in the device numeric ID.
-   * 
- * - * string name = 2; - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); - - /** - * - * - *
-   * [Output only] A server-defined unique numeric ID for the device. This is a
-   * more compact way to identify devices, and it is globally unique.
-   * 
- * - * uint64 num_id = 3; - * - * @return The numId. - */ - long getNumId(); - - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - java.util.List getCredentialsList(); - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - com.google.cloud.iot.v1.DeviceCredential getCredentials(int index); - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - int getCredentialsCount(); - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - java.util.List - getCredentialsOrBuilderList(); - /** - * - * - *
-   * The credentials used to authenticate this device. To allow credential
-   * rotation without interruption, multiple device credentials can be bound to
-   * this device. No more than 3 credentials can be bound to a single device at
-   * a time. When new credentials are added to a device, they are verified
-   * against the registry credentials. For details, see the description of the
-   * `DeviceRegistry.credentials` field.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceCredential credentials = 12; - */ - com.google.cloud.iot.v1.DeviceCredentialOrBuilder getCredentialsOrBuilder(int index); - - /** - * - * - *
-   * [Output only] The last time an MQTT `PINGREQ` was received. This field
-   * applies only to devices connecting through MQTT. MQTT clients usually only
-   * send `PINGREQ` messages if the connection is idle, and no other messages
-   * have been sent. Timestamps are periodically collected and written to
-   * storage; they may be stale by a few minutes.
-   * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - * - * @return Whether the lastHeartbeatTime field is set. - */ - boolean hasLastHeartbeatTime(); - /** - * - * - *
-   * [Output only] The last time an MQTT `PINGREQ` was received. This field
-   * applies only to devices connecting through MQTT. MQTT clients usually only
-   * send `PINGREQ` messages if the connection is idle, and no other messages
-   * have been sent. Timestamps are periodically collected and written to
-   * storage; they may be stale by a few minutes.
-   * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - * - * @return The lastHeartbeatTime. - */ - com.google.protobuf.Timestamp getLastHeartbeatTime(); - /** - * - * - *
-   * [Output only] The last time an MQTT `PINGREQ` was received. This field
-   * applies only to devices connecting through MQTT. MQTT clients usually only
-   * send `PINGREQ` messages if the connection is idle, and no other messages
-   * have been sent. Timestamps are periodically collected and written to
-   * storage; they may be stale by a few minutes.
-   * 
- * - * .google.protobuf.Timestamp last_heartbeat_time = 7; - */ - com.google.protobuf.TimestampOrBuilder getLastHeartbeatTimeOrBuilder(); - - /** - * - * - *
-   * [Output only] The last time a telemetry event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - * - * @return Whether the lastEventTime field is set. - */ - boolean hasLastEventTime(); - /** - * - * - *
-   * [Output only] The last time a telemetry event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - * - * @return The lastEventTime. - */ - com.google.protobuf.Timestamp getLastEventTime(); - /** - * - * - *
-   * [Output only] The last time a telemetry event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_event_time = 8; - */ - com.google.protobuf.TimestampOrBuilder getLastEventTimeOrBuilder(); - - /** - * - * - *
-   * [Output only] The last time a state event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - * - * @return Whether the lastStateTime field is set. - */ - boolean hasLastStateTime(); - /** - * - * - *
-   * [Output only] The last time a state event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - * - * @return The lastStateTime. - */ - com.google.protobuf.Timestamp getLastStateTime(); - /** - * - * - *
-   * [Output only] The last time a state event was received. Timestamps are
-   * periodically collected and written to storage; they may be stale by a few
-   * minutes.
-   * 
- * - * .google.protobuf.Timestamp last_state_time = 20; - */ - com.google.protobuf.TimestampOrBuilder getLastStateTimeOrBuilder(); - - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version acknowledgment
-   * was received from the device. This field is only for configurations
-   * sent through MQTT.
-   * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - * - * @return Whether the lastConfigAckTime field is set. - */ - boolean hasLastConfigAckTime(); - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version acknowledgment
-   * was received from the device. This field is only for configurations
-   * sent through MQTT.
-   * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - * - * @return The lastConfigAckTime. - */ - com.google.protobuf.Timestamp getLastConfigAckTime(); - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version acknowledgment
-   * was received from the device. This field is only for configurations
-   * sent through MQTT.
-   * 
- * - * .google.protobuf.Timestamp last_config_ack_time = 14; - */ - com.google.protobuf.TimestampOrBuilder getLastConfigAckTimeOrBuilder(); - - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version was sent to
-   * the device.
-   * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - * - * @return Whether the lastConfigSendTime field is set. - */ - boolean hasLastConfigSendTime(); - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version was sent to
-   * the device.
-   * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - * - * @return The lastConfigSendTime. - */ - com.google.protobuf.Timestamp getLastConfigSendTime(); - /** - * - * - *
-   * [Output only] The last time a cloud-to-device config version was sent to
-   * the device.
-   * 
- * - * .google.protobuf.Timestamp last_config_send_time = 18; - */ - com.google.protobuf.TimestampOrBuilder getLastConfigSendTimeOrBuilder(); - - /** - * - * - *
-   * If a device is blocked, connections or requests from this device will fail.
-   * Can be used to temporarily prevent the device from connecting if, for
-   * example, the sensor is generating bad data and needs maintenance.
-   * 
- * - * bool blocked = 19; - * - * @return The blocked. - */ - boolean getBlocked(); - - /** - * - * - *
-   * [Output only] The time the most recent error occurred, such as a failure to
-   * publish to Cloud Pub/Sub. This field is the timestamp of
-   * 'last_error_status'.
-   * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - * - * @return Whether the lastErrorTime field is set. - */ - boolean hasLastErrorTime(); - /** - * - * - *
-   * [Output only] The time the most recent error occurred, such as a failure to
-   * publish to Cloud Pub/Sub. This field is the timestamp of
-   * 'last_error_status'.
-   * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - * - * @return The lastErrorTime. - */ - com.google.protobuf.Timestamp getLastErrorTime(); - /** - * - * - *
-   * [Output only] The time the most recent error occurred, such as a failure to
-   * publish to Cloud Pub/Sub. This field is the timestamp of
-   * 'last_error_status'.
-   * 
- * - * .google.protobuf.Timestamp last_error_time = 10; - */ - com.google.protobuf.TimestampOrBuilder getLastErrorTimeOrBuilder(); - - /** - * - * - *
-   * [Output only] The error message of the most recent error, such as a failure
-   * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-   * field. If no errors have occurred, this field has an empty message
-   * and the status code 0 == OK. Otherwise, this field is expected to have a
-   * status code other than OK.
-   * 
- * - * .google.rpc.Status last_error_status = 11; - * - * @return Whether the lastErrorStatus field is set. - */ - boolean hasLastErrorStatus(); - /** - * - * - *
-   * [Output only] The error message of the most recent error, such as a failure
-   * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-   * field. If no errors have occurred, this field has an empty message
-   * and the status code 0 == OK. Otherwise, this field is expected to have a
-   * status code other than OK.
-   * 
- * - * .google.rpc.Status last_error_status = 11; - * - * @return The lastErrorStatus. - */ - com.google.rpc.Status getLastErrorStatus(); - /** - * - * - *
-   * [Output only] The error message of the most recent error, such as a failure
-   * to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this
-   * field. If no errors have occurred, this field has an empty message
-   * and the status code 0 == OK. Otherwise, this field is expected to have a
-   * status code other than OK.
-   * 
- * - * .google.rpc.Status last_error_status = 11; - */ - com.google.rpc.StatusOrBuilder getLastErrorStatusOrBuilder(); - - /** - * - * - *
-   * The most recent device configuration, which is eventually sent from
-   * Cloud IoT Core to the device. If not present on creation, the
-   * configuration will be initialized with an empty payload and version value
-   * of `1`. To update this field after creation, use the
-   * `DeviceManager.ModifyCloudToDeviceConfig` method.
-   * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - * - * @return Whether the config field is set. - */ - boolean hasConfig(); - /** - * - * - *
-   * The most recent device configuration, which is eventually sent from
-   * Cloud IoT Core to the device. If not present on creation, the
-   * configuration will be initialized with an empty payload and version value
-   * of `1`. To update this field after creation, use the
-   * `DeviceManager.ModifyCloudToDeviceConfig` method.
-   * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - * - * @return The config. - */ - com.google.cloud.iot.v1.DeviceConfig getConfig(); - /** - * - * - *
-   * The most recent device configuration, which is eventually sent from
-   * Cloud IoT Core to the device. If not present on creation, the
-   * configuration will be initialized with an empty payload and version value
-   * of `1`. To update this field after creation, use the
-   * `DeviceManager.ModifyCloudToDeviceConfig` method.
-   * 
- * - * .google.cloud.iot.v1.DeviceConfig config = 13; - */ - com.google.cloud.iot.v1.DeviceConfigOrBuilder getConfigOrBuilder(); - - /** - * - * - *
-   * [Output only] The state most recently received from the device. If no state
-   * has been reported, this field is not present.
-   * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - * - * @return Whether the state field is set. - */ - boolean hasState(); - /** - * - * - *
-   * [Output only] The state most recently received from the device. If no state
-   * has been reported, this field is not present.
-   * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - * - * @return The state. - */ - com.google.cloud.iot.v1.DeviceState getState(); - /** - * - * - *
-   * [Output only] The state most recently received from the device. If no state
-   * has been reported, this field is not present.
-   * 
- * - * .google.cloud.iot.v1.DeviceState state = 16; - */ - com.google.cloud.iot.v1.DeviceStateOrBuilder getStateOrBuilder(); - - /** - * - * - *
-   * **Beta Feature**
-   * The logging verbosity for device activity. If unspecified,
-   * DeviceRegistry.log_level will be used.
-   * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @return The enum numeric value on the wire for logLevel. - */ - int getLogLevelValue(); - /** - * - * - *
-   * **Beta Feature**
-   * The logging verbosity for device activity. If unspecified,
-   * DeviceRegistry.log_level will be used.
-   * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 21; - * - * @return The logLevel. - */ - com.google.cloud.iot.v1.LogLevel getLogLevel(); - - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - int getMetadataCount(); - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - boolean containsMetadata(java.lang.String key); - /** Use {@link #getMetadataMap()} instead. */ - @java.lang.Deprecated - java.util.Map getMetadata(); - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - java.util.Map getMetadataMap(); - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - - /* nullable */ - java.lang.String getMetadataOrDefault( - java.lang.String key, - /* nullable */ - java.lang.String defaultValue); - /** - * - * - *
-   * The metadata key-value pairs assigned to the device. This metadata is not
-   * interpreted or indexed by Cloud IoT Core. It can be used to add contextual
-   * information for the device.
-   * Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and
-   * be less than 128 bytes in length.
-   * Values are free-form strings. Each value must be less than or equal to 32
-   * KB in size.
-   * The total size of all keys and values must be less than 256 KB, and the
-   * maximum number of key-value pairs is 500.
-   * 
- * - * map<string, string> metadata = 17; - */ - java.lang.String getMetadataOrThrow(java.lang.String key); - - /** - * - * - *
-   * Gateway-related configuration and state.
-   * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - * - * @return Whether the gatewayConfig field is set. - */ - boolean hasGatewayConfig(); - /** - * - * - *
-   * Gateway-related configuration and state.
-   * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - * - * @return The gatewayConfig. - */ - com.google.cloud.iot.v1.GatewayConfig getGatewayConfig(); - /** - * - * - *
-   * Gateway-related configuration and state.
-   * 
- * - * .google.cloud.iot.v1.GatewayConfig gateway_config = 24; - */ - com.google.cloud.iot.v1.GatewayConfigOrBuilder getGatewayConfigOrBuilder(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceRegistry.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceRegistry.java deleted file mode 100644 index 734cab5f..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceRegistry.java +++ /dev/null @@ -1,3240 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * A container for a group of devices.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeviceRegistry} - */ -public final class DeviceRegistry extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.DeviceRegistry) - DeviceRegistryOrBuilder { - private static final long serialVersionUID = 0L; - // Use DeviceRegistry.newBuilder() to construct. - private DeviceRegistry(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private DeviceRegistry() { - id_ = ""; - name_ = ""; - eventNotificationConfigs_ = java.util.Collections.emptyList(); - logLevel_ = 0; - credentials_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeviceRegistry(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceRegistry_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeviceRegistry.class, - com.google.cloud.iot.v1.DeviceRegistry.Builder.class); - } - - public static final int ID_FIELD_NUMBER = 1; - private volatile java.lang.Object id_; - /** - * - * - *
-   * The identifier of this device registry. For example, `myRegistry`.
-   * 
- * - * string id = 1; - * - * @return The id. - */ - @java.lang.Override - public java.lang.String getId() { - java.lang.Object ref = id_; - 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(); - id_ = s; - return s; - } - } - /** - * - * - *
-   * The identifier of this device registry. For example, `myRegistry`.
-   * 
- * - * string id = 1; - * - * @return The bytes for id. - */ - @java.lang.Override - public com.google.protobuf.ByteString getIdBytes() { - java.lang.Object ref = id_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - id_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int NAME_FIELD_NUMBER = 2; - private volatile java.lang.Object name_; - /** - * - * - *
-   * The resource path name. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * string name = 2; - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * The resource path name. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * string name = 2; - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int EVENT_NOTIFICATION_CONFIGS_FIELD_NUMBER = 10; - private java.util.List eventNotificationConfigs_; - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - @java.lang.Override - public java.util.List - getEventNotificationConfigsList() { - return eventNotificationConfigs_; - } - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - @java.lang.Override - public java.util.List - getEventNotificationConfigsOrBuilderList() { - return eventNotificationConfigs_; - } - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - @java.lang.Override - public int getEventNotificationConfigsCount() { - return eventNotificationConfigs_.size(); - } - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - @java.lang.Override - public com.google.cloud.iot.v1.EventNotificationConfig getEventNotificationConfigs(int index) { - return eventNotificationConfigs_.get(index); - } - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - @java.lang.Override - public com.google.cloud.iot.v1.EventNotificationConfigOrBuilder - getEventNotificationConfigsOrBuilder(int index) { - return eventNotificationConfigs_.get(index); - } - - public static final int STATE_NOTIFICATION_CONFIG_FIELD_NUMBER = 7; - private com.google.cloud.iot.v1.StateNotificationConfig stateNotificationConfig_; - /** - * - * - *
-   * The configuration for notification of new states received from the device.
-   * State updates are guaranteed to be stored in the state history, but
-   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-   * permissions are misconfigured or the specified topic doesn't exist, no
-   * notification will be published but the state will still be stored in Cloud
-   * IoT Core.
-   * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - * - * @return Whether the stateNotificationConfig field is set. - */ - @java.lang.Override - public boolean hasStateNotificationConfig() { - return stateNotificationConfig_ != null; - } - /** - * - * - *
-   * The configuration for notification of new states received from the device.
-   * State updates are guaranteed to be stored in the state history, but
-   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-   * permissions are misconfigured or the specified topic doesn't exist, no
-   * notification will be published but the state will still be stored in Cloud
-   * IoT Core.
-   * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - * - * @return The stateNotificationConfig. - */ - @java.lang.Override - public com.google.cloud.iot.v1.StateNotificationConfig getStateNotificationConfig() { - return stateNotificationConfig_ == null - ? com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance() - : stateNotificationConfig_; - } - /** - * - * - *
-   * The configuration for notification of new states received from the device.
-   * State updates are guaranteed to be stored in the state history, but
-   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-   * permissions are misconfigured or the specified topic doesn't exist, no
-   * notification will be published but the state will still be stored in Cloud
-   * IoT Core.
-   * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - @java.lang.Override - public com.google.cloud.iot.v1.StateNotificationConfigOrBuilder - getStateNotificationConfigOrBuilder() { - return getStateNotificationConfig(); - } - - public static final int MQTT_CONFIG_FIELD_NUMBER = 4; - private com.google.cloud.iot.v1.MqttConfig mqttConfig_; - /** - * - * - *
-   * The MQTT configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - * - * @return Whether the mqttConfig field is set. - */ - @java.lang.Override - public boolean hasMqttConfig() { - return mqttConfig_ != null; - } - /** - * - * - *
-   * The MQTT configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - * - * @return The mqttConfig. - */ - @java.lang.Override - public com.google.cloud.iot.v1.MqttConfig getMqttConfig() { - return mqttConfig_ == null - ? com.google.cloud.iot.v1.MqttConfig.getDefaultInstance() - : mqttConfig_; - } - /** - * - * - *
-   * The MQTT configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - @java.lang.Override - public com.google.cloud.iot.v1.MqttConfigOrBuilder getMqttConfigOrBuilder() { - return getMqttConfig(); - } - - public static final int HTTP_CONFIG_FIELD_NUMBER = 9; - private com.google.cloud.iot.v1.HttpConfig httpConfig_; - /** - * - * - *
-   * The DeviceService (HTTP) configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - * - * @return Whether the httpConfig field is set. - */ - @java.lang.Override - public boolean hasHttpConfig() { - return httpConfig_ != null; - } - /** - * - * - *
-   * The DeviceService (HTTP) configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - * - * @return The httpConfig. - */ - @java.lang.Override - public com.google.cloud.iot.v1.HttpConfig getHttpConfig() { - return httpConfig_ == null - ? com.google.cloud.iot.v1.HttpConfig.getDefaultInstance() - : httpConfig_; - } - /** - * - * - *
-   * The DeviceService (HTTP) configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - @java.lang.Override - public com.google.cloud.iot.v1.HttpConfigOrBuilder getHttpConfigOrBuilder() { - return getHttpConfig(); - } - - public static final int LOG_LEVEL_FIELD_NUMBER = 11; - private int logLevel_; - /** - * - * - *
-   * **Beta Feature**
-   * The default logging verbosity for activity from devices in this registry.
-   * The verbosity level can be overridden by Device.log_level.
-   * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @return The enum numeric value on the wire for logLevel. - */ - @java.lang.Override - public int getLogLevelValue() { - return logLevel_; - } - /** - * - * - *
-   * **Beta Feature**
-   * The default logging verbosity for activity from devices in this registry.
-   * The verbosity level can be overridden by Device.log_level.
-   * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @return The logLevel. - */ - @java.lang.Override - public com.google.cloud.iot.v1.LogLevel getLogLevel() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.LogLevel result = com.google.cloud.iot.v1.LogLevel.valueOf(logLevel_); - return result == null ? com.google.cloud.iot.v1.LogLevel.UNRECOGNIZED : result; - } - - public static final int CREDENTIALS_FIELD_NUMBER = 8; - private java.util.List credentials_; - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - @java.lang.Override - public java.util.List getCredentialsList() { - return credentials_; - } - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - @java.lang.Override - public java.util.List - getCredentialsOrBuilderList() { - return credentials_; - } - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - @java.lang.Override - public int getCredentialsCount() { - return credentials_.size(); - } - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - @java.lang.Override - public com.google.cloud.iot.v1.RegistryCredential getCredentials(int index) { - return credentials_.get(index); - } - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - @java.lang.Override - public com.google.cloud.iot.v1.RegistryCredentialOrBuilder getCredentialsOrBuilder(int index) { - return credentials_.get(index); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, id_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, name_); - } - if (mqttConfig_ != null) { - output.writeMessage(4, getMqttConfig()); - } - if (stateNotificationConfig_ != null) { - output.writeMessage(7, getStateNotificationConfig()); - } - for (int i = 0; i < credentials_.size(); i++) { - output.writeMessage(8, credentials_.get(i)); - } - if (httpConfig_ != null) { - output.writeMessage(9, getHttpConfig()); - } - for (int i = 0; i < eventNotificationConfigs_.size(); i++) { - output.writeMessage(10, eventNotificationConfigs_.get(i)); - } - if (logLevel_ != com.google.cloud.iot.v1.LogLevel.LOG_LEVEL_UNSPECIFIED.getNumber()) { - output.writeEnum(11, logLevel_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(id_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, id_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, name_); - } - if (mqttConfig_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getMqttConfig()); - } - if (stateNotificationConfig_ != null) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize(7, getStateNotificationConfig()); - } - for (int i = 0; i < credentials_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, credentials_.get(i)); - } - if (httpConfig_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(9, getHttpConfig()); - } - for (int i = 0; i < eventNotificationConfigs_.size(); i++) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 10, eventNotificationConfigs_.get(i)); - } - if (logLevel_ != com.google.cloud.iot.v1.LogLevel.LOG_LEVEL_UNSPECIFIED.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(11, logLevel_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.DeviceRegistry)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.DeviceRegistry other = (com.google.cloud.iot.v1.DeviceRegistry) obj; - - if (!getId().equals(other.getId())) return false; - if (!getName().equals(other.getName())) return false; - if (!getEventNotificationConfigsList().equals(other.getEventNotificationConfigsList())) - return false; - if (hasStateNotificationConfig() != other.hasStateNotificationConfig()) return false; - if (hasStateNotificationConfig()) { - if (!getStateNotificationConfig().equals(other.getStateNotificationConfig())) return false; - } - if (hasMqttConfig() != other.hasMqttConfig()) return false; - if (hasMqttConfig()) { - if (!getMqttConfig().equals(other.getMqttConfig())) return false; - } - if (hasHttpConfig() != other.hasHttpConfig()) return false; - if (hasHttpConfig()) { - if (!getHttpConfig().equals(other.getHttpConfig())) return false; - } - if (logLevel_ != other.logLevel_) return false; - if (!getCredentialsList().equals(other.getCredentialsList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + ID_FIELD_NUMBER; - hash = (53 * hash) + getId().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - if (getEventNotificationConfigsCount() > 0) { - hash = (37 * hash) + EVENT_NOTIFICATION_CONFIGS_FIELD_NUMBER; - hash = (53 * hash) + getEventNotificationConfigsList().hashCode(); - } - if (hasStateNotificationConfig()) { - hash = (37 * hash) + STATE_NOTIFICATION_CONFIG_FIELD_NUMBER; - hash = (53 * hash) + getStateNotificationConfig().hashCode(); - } - if (hasMqttConfig()) { - hash = (37 * hash) + MQTT_CONFIG_FIELD_NUMBER; - hash = (53 * hash) + getMqttConfig().hashCode(); - } - if (hasHttpConfig()) { - hash = (37 * hash) + HTTP_CONFIG_FIELD_NUMBER; - hash = (53 * hash) + getHttpConfig().hashCode(); - } - hash = (37 * hash) + LOG_LEVEL_FIELD_NUMBER; - hash = (53 * hash) + logLevel_; - if (getCredentialsCount() > 0) { - hash = (37 * hash) + CREDENTIALS_FIELD_NUMBER; - hash = (53 * hash) + getCredentialsList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceRegistry 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.iot.v1.DeviceRegistry parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceRegistry 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.iot.v1.DeviceRegistry parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceRegistry parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.DeviceRegistry parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceRegistry 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.iot.v1.DeviceRegistry parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceRegistry 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.iot.v1.DeviceRegistry parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceRegistry 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.iot.v1.DeviceRegistry 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 container for a group of devices.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeviceRegistry} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.DeviceRegistry) - com.google.cloud.iot.v1.DeviceRegistryOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceRegistry_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeviceRegistry.class, - com.google.cloud.iot.v1.DeviceRegistry.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.DeviceRegistry.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - id_ = ""; - - name_ = ""; - - if (eventNotificationConfigsBuilder_ == null) { - eventNotificationConfigs_ = java.util.Collections.emptyList(); - } else { - eventNotificationConfigs_ = null; - eventNotificationConfigsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - if (stateNotificationConfigBuilder_ == null) { - stateNotificationConfig_ = null; - } else { - stateNotificationConfig_ = null; - stateNotificationConfigBuilder_ = null; - } - if (mqttConfigBuilder_ == null) { - mqttConfig_ = null; - } else { - mqttConfig_ = null; - mqttConfigBuilder_ = null; - } - if (httpConfigBuilder_ == null) { - httpConfig_ = null; - } else { - httpConfig_ = null; - httpConfigBuilder_ = null; - } - logLevel_ = 0; - - if (credentialsBuilder_ == null) { - credentials_ = java.util.Collections.emptyList(); - } else { - credentials_ = null; - credentialsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000002); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistry getDefaultInstanceForType() { - return com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistry build() { - com.google.cloud.iot.v1.DeviceRegistry result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistry buildPartial() { - com.google.cloud.iot.v1.DeviceRegistry result = - new com.google.cloud.iot.v1.DeviceRegistry(this); - int from_bitField0_ = bitField0_; - result.id_ = id_; - result.name_ = name_; - if (eventNotificationConfigsBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - eventNotificationConfigs_ = - java.util.Collections.unmodifiableList(eventNotificationConfigs_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.eventNotificationConfigs_ = eventNotificationConfigs_; - } else { - result.eventNotificationConfigs_ = eventNotificationConfigsBuilder_.build(); - } - if (stateNotificationConfigBuilder_ == null) { - result.stateNotificationConfig_ = stateNotificationConfig_; - } else { - result.stateNotificationConfig_ = stateNotificationConfigBuilder_.build(); - } - if (mqttConfigBuilder_ == null) { - result.mqttConfig_ = mqttConfig_; - } else { - result.mqttConfig_ = mqttConfigBuilder_.build(); - } - if (httpConfigBuilder_ == null) { - result.httpConfig_ = httpConfig_; - } else { - result.httpConfig_ = httpConfigBuilder_.build(); - } - result.logLevel_ = logLevel_; - if (credentialsBuilder_ == null) { - if (((bitField0_ & 0x00000002) != 0)) { - credentials_ = java.util.Collections.unmodifiableList(credentials_); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.credentials_ = credentials_; - } else { - result.credentials_ = credentialsBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.DeviceRegistry) { - return mergeFrom((com.google.cloud.iot.v1.DeviceRegistry) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.DeviceRegistry other) { - if (other == com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance()) return this; - if (!other.getId().isEmpty()) { - id_ = other.id_; - onChanged(); - } - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (eventNotificationConfigsBuilder_ == null) { - if (!other.eventNotificationConfigs_.isEmpty()) { - if (eventNotificationConfigs_.isEmpty()) { - eventNotificationConfigs_ = other.eventNotificationConfigs_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.addAll(other.eventNotificationConfigs_); - } - onChanged(); - } - } else { - if (!other.eventNotificationConfigs_.isEmpty()) { - if (eventNotificationConfigsBuilder_.isEmpty()) { - eventNotificationConfigsBuilder_.dispose(); - eventNotificationConfigsBuilder_ = null; - eventNotificationConfigs_ = other.eventNotificationConfigs_; - bitField0_ = (bitField0_ & ~0x00000001); - eventNotificationConfigsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getEventNotificationConfigsFieldBuilder() - : null; - } else { - eventNotificationConfigsBuilder_.addAllMessages(other.eventNotificationConfigs_); - } - } - } - if (other.hasStateNotificationConfig()) { - mergeStateNotificationConfig(other.getStateNotificationConfig()); - } - if (other.hasMqttConfig()) { - mergeMqttConfig(other.getMqttConfig()); - } - if (other.hasHttpConfig()) { - mergeHttpConfig(other.getHttpConfig()); - } - if (other.logLevel_ != 0) { - setLogLevelValue(other.getLogLevelValue()); - } - if (credentialsBuilder_ == null) { - if (!other.credentials_.isEmpty()) { - if (credentials_.isEmpty()) { - credentials_ = other.credentials_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureCredentialsIsMutable(); - credentials_.addAll(other.credentials_); - } - onChanged(); - } - } else { - if (!other.credentials_.isEmpty()) { - if (credentialsBuilder_.isEmpty()) { - credentialsBuilder_.dispose(); - credentialsBuilder_ = null; - credentials_ = other.credentials_; - bitField0_ = (bitField0_ & ~0x00000002); - credentialsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getCredentialsFieldBuilder() - : null; - } else { - credentialsBuilder_.addAllMessages(other.credentials_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - id_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 18 - case 34: - { - input.readMessage(getMqttConfigFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 34 - case 58: - { - input.readMessage( - getStateNotificationConfigFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 58 - case 66: - { - com.google.cloud.iot.v1.RegistryCredential m = - input.readMessage( - com.google.cloud.iot.v1.RegistryCredential.parser(), extensionRegistry); - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.add(m); - } else { - credentialsBuilder_.addMessage(m); - } - break; - } // case 66 - case 74: - { - input.readMessage(getHttpConfigFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 74 - case 82: - { - com.google.cloud.iot.v1.EventNotificationConfig m = - input.readMessage( - com.google.cloud.iot.v1.EventNotificationConfig.parser(), - extensionRegistry); - if (eventNotificationConfigsBuilder_ == null) { - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.add(m); - } else { - eventNotificationConfigsBuilder_.addMessage(m); - } - break; - } // case 82 - case 88: - { - logLevel_ = input.readEnum(); - - break; - } // case 88 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.lang.Object id_ = ""; - /** - * - * - *
-     * The identifier of this device registry. For example, `myRegistry`.
-     * 
- * - * string id = 1; - * - * @return The id. - */ - public java.lang.String getId() { - java.lang.Object ref = id_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - id_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The identifier of this device registry. For example, `myRegistry`.
-     * 
- * - * string id = 1; - * - * @return The bytes for id. - */ - public com.google.protobuf.ByteString getIdBytes() { - java.lang.Object ref = id_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - id_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The identifier of this device registry. For example, `myRegistry`.
-     * 
- * - * string id = 1; - * - * @param value The id to set. - * @return This builder for chaining. - */ - public Builder setId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - id_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The identifier of this device registry. For example, `myRegistry`.
-     * 
- * - * string id = 1; - * - * @return This builder for chaining. - */ - public Builder clearId() { - - id_ = getDefaultInstance().getId(); - onChanged(); - return this; - } - /** - * - * - *
-     * The identifier of this device registry. For example, `myRegistry`.
-     * 
- * - * string id = 1; - * - * @param value The bytes for id to set. - * @return This builder for chaining. - */ - public Builder setIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - id_ = value; - onChanged(); - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * string name = 2; - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * string name = 2; - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * string name = 2; - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * string name = 2; - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * The resource path name. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * string name = 2; - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private java.util.List - eventNotificationConfigs_ = java.util.Collections.emptyList(); - - private void ensureEventNotificationConfigsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - eventNotificationConfigs_ = - new java.util.ArrayList( - eventNotificationConfigs_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.EventNotificationConfig, - com.google.cloud.iot.v1.EventNotificationConfig.Builder, - com.google.cloud.iot.v1.EventNotificationConfigOrBuilder> - eventNotificationConfigsBuilder_; - - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public java.util.List - getEventNotificationConfigsList() { - if (eventNotificationConfigsBuilder_ == null) { - return java.util.Collections.unmodifiableList(eventNotificationConfigs_); - } else { - return eventNotificationConfigsBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public int getEventNotificationConfigsCount() { - if (eventNotificationConfigsBuilder_ == null) { - return eventNotificationConfigs_.size(); - } else { - return eventNotificationConfigsBuilder_.getCount(); - } - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public com.google.cloud.iot.v1.EventNotificationConfig getEventNotificationConfigs(int index) { - if (eventNotificationConfigsBuilder_ == null) { - return eventNotificationConfigs_.get(index); - } else { - return eventNotificationConfigsBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder setEventNotificationConfigs( - int index, com.google.cloud.iot.v1.EventNotificationConfig value) { - if (eventNotificationConfigsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.set(index, value); - onChanged(); - } else { - eventNotificationConfigsBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder setEventNotificationConfigs( - int index, com.google.cloud.iot.v1.EventNotificationConfig.Builder builderForValue) { - if (eventNotificationConfigsBuilder_ == null) { - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.set(index, builderForValue.build()); - onChanged(); - } else { - eventNotificationConfigsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder addEventNotificationConfigs( - com.google.cloud.iot.v1.EventNotificationConfig value) { - if (eventNotificationConfigsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.add(value); - onChanged(); - } else { - eventNotificationConfigsBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder addEventNotificationConfigs( - int index, com.google.cloud.iot.v1.EventNotificationConfig value) { - if (eventNotificationConfigsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.add(index, value); - onChanged(); - } else { - eventNotificationConfigsBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder addEventNotificationConfigs( - com.google.cloud.iot.v1.EventNotificationConfig.Builder builderForValue) { - if (eventNotificationConfigsBuilder_ == null) { - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.add(builderForValue.build()); - onChanged(); - } else { - eventNotificationConfigsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder addEventNotificationConfigs( - int index, com.google.cloud.iot.v1.EventNotificationConfig.Builder builderForValue) { - if (eventNotificationConfigsBuilder_ == null) { - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.add(index, builderForValue.build()); - onChanged(); - } else { - eventNotificationConfigsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder addAllEventNotificationConfigs( - java.lang.Iterable values) { - if (eventNotificationConfigsBuilder_ == null) { - ensureEventNotificationConfigsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, eventNotificationConfigs_); - onChanged(); - } else { - eventNotificationConfigsBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder clearEventNotificationConfigs() { - if (eventNotificationConfigsBuilder_ == null) { - eventNotificationConfigs_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - eventNotificationConfigsBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public Builder removeEventNotificationConfigs(int index) { - if (eventNotificationConfigsBuilder_ == null) { - ensureEventNotificationConfigsIsMutable(); - eventNotificationConfigs_.remove(index); - onChanged(); - } else { - eventNotificationConfigsBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public com.google.cloud.iot.v1.EventNotificationConfig.Builder - getEventNotificationConfigsBuilder(int index) { - return getEventNotificationConfigsFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public com.google.cloud.iot.v1.EventNotificationConfigOrBuilder - getEventNotificationConfigsOrBuilder(int index) { - if (eventNotificationConfigsBuilder_ == null) { - return eventNotificationConfigs_.get(index); - } else { - return eventNotificationConfigsBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public java.util.List - getEventNotificationConfigsOrBuilderList() { - if (eventNotificationConfigsBuilder_ != null) { - return eventNotificationConfigsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(eventNotificationConfigs_); - } - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public com.google.cloud.iot.v1.EventNotificationConfig.Builder - addEventNotificationConfigsBuilder() { - return getEventNotificationConfigsFieldBuilder() - .addBuilder(com.google.cloud.iot.v1.EventNotificationConfig.getDefaultInstance()); - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public com.google.cloud.iot.v1.EventNotificationConfig.Builder - addEventNotificationConfigsBuilder(int index) { - return getEventNotificationConfigsFieldBuilder() - .addBuilder(index, com.google.cloud.iot.v1.EventNotificationConfig.getDefaultInstance()); - } - /** - * - * - *
-     * The configuration for notification of telemetry events received from the
-     * device. All telemetry events that were successfully published by the
-     * device and acknowledged by Cloud IoT Core are guaranteed to be
-     * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-     * only the first matching configuration is used. If you try to publish a
-     * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-     * for the device's registry, the connection closes automatically. If you try
-     * to do so using an HTTP connection, an error is returned. Up to 10
-     * configurations may be provided.
-     * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - public java.util.List - getEventNotificationConfigsBuilderList() { - return getEventNotificationConfigsFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.EventNotificationConfig, - com.google.cloud.iot.v1.EventNotificationConfig.Builder, - com.google.cloud.iot.v1.EventNotificationConfigOrBuilder> - getEventNotificationConfigsFieldBuilder() { - if (eventNotificationConfigsBuilder_ == null) { - eventNotificationConfigsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.EventNotificationConfig, - com.google.cloud.iot.v1.EventNotificationConfig.Builder, - com.google.cloud.iot.v1.EventNotificationConfigOrBuilder>( - eventNotificationConfigs_, - ((bitField0_ & 0x00000001) != 0), - getParentForChildren(), - isClean()); - eventNotificationConfigs_ = null; - } - return eventNotificationConfigsBuilder_; - } - - private com.google.cloud.iot.v1.StateNotificationConfig stateNotificationConfig_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.StateNotificationConfig, - com.google.cloud.iot.v1.StateNotificationConfig.Builder, - com.google.cloud.iot.v1.StateNotificationConfigOrBuilder> - stateNotificationConfigBuilder_; - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - * - * @return Whether the stateNotificationConfig field is set. - */ - public boolean hasStateNotificationConfig() { - return stateNotificationConfigBuilder_ != null || stateNotificationConfig_ != null; - } - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - * - * @return The stateNotificationConfig. - */ - public com.google.cloud.iot.v1.StateNotificationConfig getStateNotificationConfig() { - if (stateNotificationConfigBuilder_ == null) { - return stateNotificationConfig_ == null - ? com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance() - : stateNotificationConfig_; - } else { - return stateNotificationConfigBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - public Builder setStateNotificationConfig( - com.google.cloud.iot.v1.StateNotificationConfig value) { - if (stateNotificationConfigBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - stateNotificationConfig_ = value; - onChanged(); - } else { - stateNotificationConfigBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - public Builder setStateNotificationConfig( - com.google.cloud.iot.v1.StateNotificationConfig.Builder builderForValue) { - if (stateNotificationConfigBuilder_ == null) { - stateNotificationConfig_ = builderForValue.build(); - onChanged(); - } else { - stateNotificationConfigBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - public Builder mergeStateNotificationConfig( - com.google.cloud.iot.v1.StateNotificationConfig value) { - if (stateNotificationConfigBuilder_ == null) { - if (stateNotificationConfig_ != null) { - stateNotificationConfig_ = - com.google.cloud.iot.v1.StateNotificationConfig.newBuilder(stateNotificationConfig_) - .mergeFrom(value) - .buildPartial(); - } else { - stateNotificationConfig_ = value; - } - onChanged(); - } else { - stateNotificationConfigBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - public Builder clearStateNotificationConfig() { - if (stateNotificationConfigBuilder_ == null) { - stateNotificationConfig_ = null; - onChanged(); - } else { - stateNotificationConfig_ = null; - stateNotificationConfigBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - public com.google.cloud.iot.v1.StateNotificationConfig.Builder - getStateNotificationConfigBuilder() { - - onChanged(); - return getStateNotificationConfigFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - public com.google.cloud.iot.v1.StateNotificationConfigOrBuilder - getStateNotificationConfigOrBuilder() { - if (stateNotificationConfigBuilder_ != null) { - return stateNotificationConfigBuilder_.getMessageOrBuilder(); - } else { - return stateNotificationConfig_ == null - ? com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance() - : stateNotificationConfig_; - } - } - /** - * - * - *
-     * The configuration for notification of new states received from the device.
-     * State updates are guaranteed to be stored in the state history, but
-     * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-     * permissions are misconfigured or the specified topic doesn't exist, no
-     * notification will be published but the state will still be stored in Cloud
-     * IoT Core.
-     * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.StateNotificationConfig, - com.google.cloud.iot.v1.StateNotificationConfig.Builder, - com.google.cloud.iot.v1.StateNotificationConfigOrBuilder> - getStateNotificationConfigFieldBuilder() { - if (stateNotificationConfigBuilder_ == null) { - stateNotificationConfigBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.StateNotificationConfig, - com.google.cloud.iot.v1.StateNotificationConfig.Builder, - com.google.cloud.iot.v1.StateNotificationConfigOrBuilder>( - getStateNotificationConfig(), getParentForChildren(), isClean()); - stateNotificationConfig_ = null; - } - return stateNotificationConfigBuilder_; - } - - private com.google.cloud.iot.v1.MqttConfig mqttConfig_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.MqttConfig, - com.google.cloud.iot.v1.MqttConfig.Builder, - com.google.cloud.iot.v1.MqttConfigOrBuilder> - mqttConfigBuilder_; - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - * - * @return Whether the mqttConfig field is set. - */ - public boolean hasMqttConfig() { - return mqttConfigBuilder_ != null || mqttConfig_ != null; - } - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - * - * @return The mqttConfig. - */ - public com.google.cloud.iot.v1.MqttConfig getMqttConfig() { - if (mqttConfigBuilder_ == null) { - return mqttConfig_ == null - ? com.google.cloud.iot.v1.MqttConfig.getDefaultInstance() - : mqttConfig_; - } else { - return mqttConfigBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - public Builder setMqttConfig(com.google.cloud.iot.v1.MqttConfig value) { - if (mqttConfigBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - mqttConfig_ = value; - onChanged(); - } else { - mqttConfigBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - public Builder setMqttConfig(com.google.cloud.iot.v1.MqttConfig.Builder builderForValue) { - if (mqttConfigBuilder_ == null) { - mqttConfig_ = builderForValue.build(); - onChanged(); - } else { - mqttConfigBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - public Builder mergeMqttConfig(com.google.cloud.iot.v1.MqttConfig value) { - if (mqttConfigBuilder_ == null) { - if (mqttConfig_ != null) { - mqttConfig_ = - com.google.cloud.iot.v1.MqttConfig.newBuilder(mqttConfig_) - .mergeFrom(value) - .buildPartial(); - } else { - mqttConfig_ = value; - } - onChanged(); - } else { - mqttConfigBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - public Builder clearMqttConfig() { - if (mqttConfigBuilder_ == null) { - mqttConfig_ = null; - onChanged(); - } else { - mqttConfig_ = null; - mqttConfigBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - public com.google.cloud.iot.v1.MqttConfig.Builder getMqttConfigBuilder() { - - onChanged(); - return getMqttConfigFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - public com.google.cloud.iot.v1.MqttConfigOrBuilder getMqttConfigOrBuilder() { - if (mqttConfigBuilder_ != null) { - return mqttConfigBuilder_.getMessageOrBuilder(); - } else { - return mqttConfig_ == null - ? com.google.cloud.iot.v1.MqttConfig.getDefaultInstance() - : mqttConfig_; - } - } - /** - * - * - *
-     * The MQTT configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.MqttConfig, - com.google.cloud.iot.v1.MqttConfig.Builder, - com.google.cloud.iot.v1.MqttConfigOrBuilder> - getMqttConfigFieldBuilder() { - if (mqttConfigBuilder_ == null) { - mqttConfigBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.MqttConfig, - com.google.cloud.iot.v1.MqttConfig.Builder, - com.google.cloud.iot.v1.MqttConfigOrBuilder>( - getMqttConfig(), getParentForChildren(), isClean()); - mqttConfig_ = null; - } - return mqttConfigBuilder_; - } - - private com.google.cloud.iot.v1.HttpConfig httpConfig_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.HttpConfig, - com.google.cloud.iot.v1.HttpConfig.Builder, - com.google.cloud.iot.v1.HttpConfigOrBuilder> - httpConfigBuilder_; - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - * - * @return Whether the httpConfig field is set. - */ - public boolean hasHttpConfig() { - return httpConfigBuilder_ != null || httpConfig_ != null; - } - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - * - * @return The httpConfig. - */ - public com.google.cloud.iot.v1.HttpConfig getHttpConfig() { - if (httpConfigBuilder_ == null) { - return httpConfig_ == null - ? com.google.cloud.iot.v1.HttpConfig.getDefaultInstance() - : httpConfig_; - } else { - return httpConfigBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - public Builder setHttpConfig(com.google.cloud.iot.v1.HttpConfig value) { - if (httpConfigBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - httpConfig_ = value; - onChanged(); - } else { - httpConfigBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - public Builder setHttpConfig(com.google.cloud.iot.v1.HttpConfig.Builder builderForValue) { - if (httpConfigBuilder_ == null) { - httpConfig_ = builderForValue.build(); - onChanged(); - } else { - httpConfigBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - public Builder mergeHttpConfig(com.google.cloud.iot.v1.HttpConfig value) { - if (httpConfigBuilder_ == null) { - if (httpConfig_ != null) { - httpConfig_ = - com.google.cloud.iot.v1.HttpConfig.newBuilder(httpConfig_) - .mergeFrom(value) - .buildPartial(); - } else { - httpConfig_ = value; - } - onChanged(); - } else { - httpConfigBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - public Builder clearHttpConfig() { - if (httpConfigBuilder_ == null) { - httpConfig_ = null; - onChanged(); - } else { - httpConfig_ = null; - httpConfigBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - public com.google.cloud.iot.v1.HttpConfig.Builder getHttpConfigBuilder() { - - onChanged(); - return getHttpConfigFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - public com.google.cloud.iot.v1.HttpConfigOrBuilder getHttpConfigOrBuilder() { - if (httpConfigBuilder_ != null) { - return httpConfigBuilder_.getMessageOrBuilder(); - } else { - return httpConfig_ == null - ? com.google.cloud.iot.v1.HttpConfig.getDefaultInstance() - : httpConfig_; - } - } - /** - * - * - *
-     * The DeviceService (HTTP) configuration for this device registry.
-     * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.HttpConfig, - com.google.cloud.iot.v1.HttpConfig.Builder, - com.google.cloud.iot.v1.HttpConfigOrBuilder> - getHttpConfigFieldBuilder() { - if (httpConfigBuilder_ == null) { - httpConfigBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.HttpConfig, - com.google.cloud.iot.v1.HttpConfig.Builder, - com.google.cloud.iot.v1.HttpConfigOrBuilder>( - getHttpConfig(), getParentForChildren(), isClean()); - httpConfig_ = null; - } - return httpConfigBuilder_; - } - - private int logLevel_ = 0; - /** - * - * - *
-     * **Beta Feature**
-     * The default logging verbosity for activity from devices in this registry.
-     * The verbosity level can be overridden by Device.log_level.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @return The enum numeric value on the wire for logLevel. - */ - @java.lang.Override - public int getLogLevelValue() { - return logLevel_; - } - /** - * - * - *
-     * **Beta Feature**
-     * The default logging verbosity for activity from devices in this registry.
-     * The verbosity level can be overridden by Device.log_level.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @param value The enum numeric value on the wire for logLevel to set. - * @return This builder for chaining. - */ - public Builder setLogLevelValue(int value) { - - logLevel_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * **Beta Feature**
-     * The default logging verbosity for activity from devices in this registry.
-     * The verbosity level can be overridden by Device.log_level.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @return The logLevel. - */ - @java.lang.Override - public com.google.cloud.iot.v1.LogLevel getLogLevel() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.LogLevel result = com.google.cloud.iot.v1.LogLevel.valueOf(logLevel_); - return result == null ? com.google.cloud.iot.v1.LogLevel.UNRECOGNIZED : result; - } - /** - * - * - *
-     * **Beta Feature**
-     * The default logging verbosity for activity from devices in this registry.
-     * The verbosity level can be overridden by Device.log_level.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @param value The logLevel to set. - * @return This builder for chaining. - */ - public Builder setLogLevel(com.google.cloud.iot.v1.LogLevel value) { - if (value == null) { - throw new NullPointerException(); - } - - logLevel_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * **Beta Feature**
-     * The default logging verbosity for activity from devices in this registry.
-     * The verbosity level can be overridden by Device.log_level.
-     * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @return This builder for chaining. - */ - public Builder clearLogLevel() { - - logLevel_ = 0; - onChanged(); - return this; - } - - private java.util.List credentials_ = - java.util.Collections.emptyList(); - - private void ensureCredentialsIsMutable() { - if (!((bitField0_ & 0x00000002) != 0)) { - credentials_ = - new java.util.ArrayList(credentials_); - bitField0_ |= 0x00000002; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.RegistryCredential, - com.google.cloud.iot.v1.RegistryCredential.Builder, - com.google.cloud.iot.v1.RegistryCredentialOrBuilder> - credentialsBuilder_; - - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public java.util.List getCredentialsList() { - if (credentialsBuilder_ == null) { - return java.util.Collections.unmodifiableList(credentials_); - } else { - return credentialsBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public int getCredentialsCount() { - if (credentialsBuilder_ == null) { - return credentials_.size(); - } else { - return credentialsBuilder_.getCount(); - } - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public com.google.cloud.iot.v1.RegistryCredential getCredentials(int index) { - if (credentialsBuilder_ == null) { - return credentials_.get(index); - } else { - return credentialsBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder setCredentials(int index, com.google.cloud.iot.v1.RegistryCredential value) { - if (credentialsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCredentialsIsMutable(); - credentials_.set(index, value); - onChanged(); - } else { - credentialsBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder setCredentials( - int index, com.google.cloud.iot.v1.RegistryCredential.Builder builderForValue) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.set(index, builderForValue.build()); - onChanged(); - } else { - credentialsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder addCredentials(com.google.cloud.iot.v1.RegistryCredential value) { - if (credentialsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCredentialsIsMutable(); - credentials_.add(value); - onChanged(); - } else { - credentialsBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder addCredentials(int index, com.google.cloud.iot.v1.RegistryCredential value) { - if (credentialsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureCredentialsIsMutable(); - credentials_.add(index, value); - onChanged(); - } else { - credentialsBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder addCredentials( - com.google.cloud.iot.v1.RegistryCredential.Builder builderForValue) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.add(builderForValue.build()); - onChanged(); - } else { - credentialsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder addCredentials( - int index, com.google.cloud.iot.v1.RegistryCredential.Builder builderForValue) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.add(index, builderForValue.build()); - onChanged(); - } else { - credentialsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder addAllCredentials( - java.lang.Iterable values) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, credentials_); - onChanged(); - } else { - credentialsBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder clearCredentials() { - if (credentialsBuilder_ == null) { - credentials_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - } else { - credentialsBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public Builder removeCredentials(int index) { - if (credentialsBuilder_ == null) { - ensureCredentialsIsMutable(); - credentials_.remove(index); - onChanged(); - } else { - credentialsBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public com.google.cloud.iot.v1.RegistryCredential.Builder getCredentialsBuilder(int index) { - return getCredentialsFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public com.google.cloud.iot.v1.RegistryCredentialOrBuilder getCredentialsOrBuilder(int index) { - if (credentialsBuilder_ == null) { - return credentials_.get(index); - } else { - return credentialsBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public java.util.List - getCredentialsOrBuilderList() { - if (credentialsBuilder_ != null) { - return credentialsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(credentials_); - } - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public com.google.cloud.iot.v1.RegistryCredential.Builder addCredentialsBuilder() { - return getCredentialsFieldBuilder() - .addBuilder(com.google.cloud.iot.v1.RegistryCredential.getDefaultInstance()); - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public com.google.cloud.iot.v1.RegistryCredential.Builder addCredentialsBuilder(int index) { - return getCredentialsFieldBuilder() - .addBuilder(index, com.google.cloud.iot.v1.RegistryCredential.getDefaultInstance()); - } - /** - * - * - *
-     * The credentials used to verify the device credentials. No more than 10
-     * credentials can be bound to a single registry at a time. The verification
-     * process occurs at the time of device creation or update. If this field is
-     * empty, no verification is performed. Otherwise, the credentials of a newly
-     * created device or added credentials of an updated device should be signed
-     * with one of these registry credentials.
-     * Note, however, that existing devices will never be affected by
-     * modifications to this list of credentials: after a device has been
-     * successfully created in a registry, it should be able to connect even if
-     * its registry credentials are revoked, deleted, or modified.
-     * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - public java.util.List - getCredentialsBuilderList() { - return getCredentialsFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.RegistryCredential, - com.google.cloud.iot.v1.RegistryCredential.Builder, - com.google.cloud.iot.v1.RegistryCredentialOrBuilder> - getCredentialsFieldBuilder() { - if (credentialsBuilder_ == null) { - credentialsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.RegistryCredential, - com.google.cloud.iot.v1.RegistryCredential.Builder, - com.google.cloud.iot.v1.RegistryCredentialOrBuilder>( - credentials_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); - credentials_ = null; - } - return credentialsBuilder_; - } - - @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.iot.v1.DeviceRegistry) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.DeviceRegistry) - private static final com.google.cloud.iot.v1.DeviceRegistry DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.DeviceRegistry(); - } - - public static com.google.cloud.iot.v1.DeviceRegistry getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public DeviceRegistry parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistry getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceRegistryOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceRegistryOrBuilder.java deleted file mode 100644 index 21b4b684..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceRegistryOrBuilder.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface DeviceRegistryOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.DeviceRegistry) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The identifier of this device registry. For example, `myRegistry`.
-   * 
- * - * string id = 1; - * - * @return The id. - */ - java.lang.String getId(); - /** - * - * - *
-   * The identifier of this device registry. For example, `myRegistry`.
-   * 
- * - * string id = 1; - * - * @return The bytes for id. - */ - com.google.protobuf.ByteString getIdBytes(); - - /** - * - * - *
-   * The resource path name. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * string name = 2; - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * The resource path name. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * string name = 2; - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); - - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - java.util.List getEventNotificationConfigsList(); - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - com.google.cloud.iot.v1.EventNotificationConfig getEventNotificationConfigs(int index); - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - int getEventNotificationConfigsCount(); - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - java.util.List - getEventNotificationConfigsOrBuilderList(); - /** - * - * - *
-   * The configuration for notification of telemetry events received from the
-   * device. All telemetry events that were successfully published by the
-   * device and acknowledged by Cloud IoT Core are guaranteed to be
-   * delivered to Cloud Pub/Sub. If multiple configurations match a message,
-   * only the first matching configuration is used. If you try to publish a
-   * device telemetry event using MQTT without specifying a Cloud Pub/Sub topic
-   * for the device's registry, the connection closes automatically. If you try
-   * to do so using an HTTP connection, an error is returned. Up to 10
-   * configurations may be provided.
-   * 
- * - * repeated .google.cloud.iot.v1.EventNotificationConfig event_notification_configs = 10; - * - */ - com.google.cloud.iot.v1.EventNotificationConfigOrBuilder getEventNotificationConfigsOrBuilder( - int index); - - /** - * - * - *
-   * The configuration for notification of new states received from the device.
-   * State updates are guaranteed to be stored in the state history, but
-   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-   * permissions are misconfigured or the specified topic doesn't exist, no
-   * notification will be published but the state will still be stored in Cloud
-   * IoT Core.
-   * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - * - * @return Whether the stateNotificationConfig field is set. - */ - boolean hasStateNotificationConfig(); - /** - * - * - *
-   * The configuration for notification of new states received from the device.
-   * State updates are guaranteed to be stored in the state history, but
-   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-   * permissions are misconfigured or the specified topic doesn't exist, no
-   * notification will be published but the state will still be stored in Cloud
-   * IoT Core.
-   * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - * - * @return The stateNotificationConfig. - */ - com.google.cloud.iot.v1.StateNotificationConfig getStateNotificationConfig(); - /** - * - * - *
-   * The configuration for notification of new states received from the device.
-   * State updates are guaranteed to be stored in the state history, but
-   * notifications to Cloud Pub/Sub are not guaranteed. For example, if
-   * permissions are misconfigured or the specified topic doesn't exist, no
-   * notification will be published but the state will still be stored in Cloud
-   * IoT Core.
-   * 
- * - * .google.cloud.iot.v1.StateNotificationConfig state_notification_config = 7; - */ - com.google.cloud.iot.v1.StateNotificationConfigOrBuilder getStateNotificationConfigOrBuilder(); - - /** - * - * - *
-   * The MQTT configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - * - * @return Whether the mqttConfig field is set. - */ - boolean hasMqttConfig(); - /** - * - * - *
-   * The MQTT configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - * - * @return The mqttConfig. - */ - com.google.cloud.iot.v1.MqttConfig getMqttConfig(); - /** - * - * - *
-   * The MQTT configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.MqttConfig mqtt_config = 4; - */ - com.google.cloud.iot.v1.MqttConfigOrBuilder getMqttConfigOrBuilder(); - - /** - * - * - *
-   * The DeviceService (HTTP) configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - * - * @return Whether the httpConfig field is set. - */ - boolean hasHttpConfig(); - /** - * - * - *
-   * The DeviceService (HTTP) configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - * - * @return The httpConfig. - */ - com.google.cloud.iot.v1.HttpConfig getHttpConfig(); - /** - * - * - *
-   * The DeviceService (HTTP) configuration for this device registry.
-   * 
- * - * .google.cloud.iot.v1.HttpConfig http_config = 9; - */ - com.google.cloud.iot.v1.HttpConfigOrBuilder getHttpConfigOrBuilder(); - - /** - * - * - *
-   * **Beta Feature**
-   * The default logging verbosity for activity from devices in this registry.
-   * The verbosity level can be overridden by Device.log_level.
-   * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @return The enum numeric value on the wire for logLevel. - */ - int getLogLevelValue(); - /** - * - * - *
-   * **Beta Feature**
-   * The default logging verbosity for activity from devices in this registry.
-   * The verbosity level can be overridden by Device.log_level.
-   * 
- * - * .google.cloud.iot.v1.LogLevel log_level = 11; - * - * @return The logLevel. - */ - com.google.cloud.iot.v1.LogLevel getLogLevel(); - - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - java.util.List getCredentialsList(); - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - com.google.cloud.iot.v1.RegistryCredential getCredentials(int index); - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - int getCredentialsCount(); - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - java.util.List - getCredentialsOrBuilderList(); - /** - * - * - *
-   * The credentials used to verify the device credentials. No more than 10
-   * credentials can be bound to a single registry at a time. The verification
-   * process occurs at the time of device creation or update. If this field is
-   * empty, no verification is performed. Otherwise, the credentials of a newly
-   * created device or added credentials of an updated device should be signed
-   * with one of these registry credentials.
-   * Note, however, that existing devices will never be affected by
-   * modifications to this list of credentials: after a device has been
-   * successfully created in a registry, it should be able to connect even if
-   * its registry credentials are revoked, deleted, or modified.
-   * 
- * - * repeated .google.cloud.iot.v1.RegistryCredential credentials = 8; - */ - com.google.cloud.iot.v1.RegistryCredentialOrBuilder getCredentialsOrBuilder(int index); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceState.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceState.java deleted file mode 100644 index 3a201467..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceState.java +++ /dev/null @@ -1,803 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The device state, as reported by the device.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeviceState} - */ -public final class DeviceState extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.DeviceState) - DeviceStateOrBuilder { - private static final long serialVersionUID = 0L; - // Use DeviceState.newBuilder() to construct. - private DeviceState(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private DeviceState() { - binaryData_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new DeviceState(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceState_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceState_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeviceState.class, - com.google.cloud.iot.v1.DeviceState.Builder.class); - } - - public static final int UPDATE_TIME_FIELD_NUMBER = 1; - private com.google.protobuf.Timestamp updateTime_; - /** - * - * - *
-   * [Output only] The time at which this state version was updated in Cloud
-   * IoT Core.
-   * 
- * - * .google.protobuf.Timestamp update_time = 1; - * - * @return Whether the updateTime field is set. - */ - @java.lang.Override - public boolean hasUpdateTime() { - return updateTime_ != null; - } - /** - * - * - *
-   * [Output only] The time at which this state version was updated in Cloud
-   * IoT Core.
-   * 
- * - * .google.protobuf.Timestamp update_time = 1; - * - * @return The updateTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getUpdateTime() { - return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; - } - /** - * - * - *
-   * [Output only] The time at which this state version was updated in Cloud
-   * IoT Core.
-   * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { - return getUpdateTime(); - } - - public static final int BINARY_DATA_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString binaryData_; - /** - * - * - *
-   * The device state data.
-   * 
- * - * bytes binary_data = 2; - * - * @return The binaryData. - */ - @java.lang.Override - public com.google.protobuf.ByteString getBinaryData() { - return binaryData_; - } - - 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 (updateTime_ != null) { - output.writeMessage(1, getUpdateTime()); - } - if (!binaryData_.isEmpty()) { - output.writeBytes(2, binaryData_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (updateTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getUpdateTime()); - } - if (!binaryData_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, binaryData_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.DeviceState)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.DeviceState other = (com.google.cloud.iot.v1.DeviceState) obj; - - if (hasUpdateTime() != other.hasUpdateTime()) return false; - if (hasUpdateTime()) { - if (!getUpdateTime().equals(other.getUpdateTime())) return false; - } - if (!getBinaryData().equals(other.getBinaryData())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasUpdateTime()) { - hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; - hash = (53 * hash) + getUpdateTime().hashCode(); - } - hash = (37 * hash) + BINARY_DATA_FIELD_NUMBER; - hash = (53 * hash) + getBinaryData().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.DeviceState parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceState 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.iot.v1.DeviceState parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceState 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.iot.v1.DeviceState parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.DeviceState parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.DeviceState parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceState 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.iot.v1.DeviceState parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceState 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.iot.v1.DeviceState parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.DeviceState 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.iot.v1.DeviceState 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 device state, as reported by the device.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.DeviceState} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.DeviceState) - com.google.cloud.iot.v1.DeviceStateOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceState_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceState_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.DeviceState.class, - com.google.cloud.iot.v1.DeviceState.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.DeviceState.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (updateTimeBuilder_ == null) { - updateTime_ = null; - } else { - updateTime_ = null; - updateTimeBuilder_ = null; - } - binaryData_ = com.google.protobuf.ByteString.EMPTY; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_DeviceState_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceState getDefaultInstanceForType() { - return com.google.cloud.iot.v1.DeviceState.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceState build() { - com.google.cloud.iot.v1.DeviceState result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceState buildPartial() { - com.google.cloud.iot.v1.DeviceState result = new com.google.cloud.iot.v1.DeviceState(this); - if (updateTimeBuilder_ == null) { - result.updateTime_ = updateTime_; - } else { - result.updateTime_ = updateTimeBuilder_.build(); - } - result.binaryData_ = binaryData_; - 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.iot.v1.DeviceState) { - return mergeFrom((com.google.cloud.iot.v1.DeviceState) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.DeviceState other) { - if (other == com.google.cloud.iot.v1.DeviceState.getDefaultInstance()) return this; - if (other.hasUpdateTime()) { - mergeUpdateTime(other.getUpdateTime()); - } - if (other.getBinaryData() != com.google.protobuf.ByteString.EMPTY) { - setBinaryData(other.getBinaryData()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 18: - { - binaryData_ = input.readBytes(); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.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 time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - * - * @return Whether the updateTime field is set. - */ - public boolean hasUpdateTime() { - return updateTimeBuilder_ != null || updateTime_ != null; - } - /** - * - * - *
-     * [Output only] The time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - * - * @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 time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - 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 time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - 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 time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - 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 time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - public Builder clearUpdateTime() { - if (updateTimeBuilder_ == null) { - updateTime_ = null; - onChanged(); - } else { - updateTime_ = null; - updateTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { - - onChanged(); - return getUpdateTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - 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 time at which this state version was updated in Cloud
-     * IoT Core.
-     * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getUpdateTimeFieldBuilder() { - if (updateTimeBuilder_ == null) { - updateTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getUpdateTime(), getParentForChildren(), isClean()); - updateTime_ = null; - } - return updateTimeBuilder_; - } - - private com.google.protobuf.ByteString binaryData_ = com.google.protobuf.ByteString.EMPTY; - /** - * - * - *
-     * The device state data.
-     * 
- * - * bytes binary_data = 2; - * - * @return The binaryData. - */ - @java.lang.Override - public com.google.protobuf.ByteString getBinaryData() { - return binaryData_; - } - /** - * - * - *
-     * The device state data.
-     * 
- * - * bytes binary_data = 2; - * - * @param value The binaryData to set. - * @return This builder for chaining. - */ - public Builder setBinaryData(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - - binaryData_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The device state data.
-     * 
- * - * bytes binary_data = 2; - * - * @return This builder for chaining. - */ - public Builder clearBinaryData() { - - binaryData_ = getDefaultInstance().getBinaryData(); - 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.iot.v1.DeviceState) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.DeviceState) - private static final com.google.cloud.iot.v1.DeviceState DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.DeviceState(); - } - - public static com.google.cloud.iot.v1.DeviceState getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public DeviceState parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.DeviceState getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceStateOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceStateOrBuilder.java deleted file mode 100644 index e47221c1..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceStateOrBuilder.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface DeviceStateOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.DeviceState) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * [Output only] The time at which this state version was updated in Cloud
-   * IoT Core.
-   * 
- * - * .google.protobuf.Timestamp update_time = 1; - * - * @return Whether the updateTime field is set. - */ - boolean hasUpdateTime(); - /** - * - * - *
-   * [Output only] The time at which this state version was updated in Cloud
-   * IoT Core.
-   * 
- * - * .google.protobuf.Timestamp update_time = 1; - * - * @return The updateTime. - */ - com.google.protobuf.Timestamp getUpdateTime(); - /** - * - * - *
-   * [Output only] The time at which this state version was updated in Cloud
-   * IoT Core.
-   * 
- * - * .google.protobuf.Timestamp update_time = 1; - */ - com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); - - /** - * - * - *
-   * The device state data.
-   * 
- * - * bytes binary_data = 2; - * - * @return The binaryData. - */ - com.google.protobuf.ByteString getBinaryData(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/EventNotificationConfig.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/EventNotificationConfig.java deleted file mode 100644 index 7a32aa03..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/EventNotificationConfig.java +++ /dev/null @@ -1,821 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The configuration for forwarding telemetry events.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.EventNotificationConfig} - */ -public final class EventNotificationConfig extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.EventNotificationConfig) - EventNotificationConfigOrBuilder { - private static final long serialVersionUID = 0L; - // Use EventNotificationConfig.newBuilder() to construct. - private EventNotificationConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private EventNotificationConfig() { - subfolderMatches_ = ""; - pubsubTopicName_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new EventNotificationConfig(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_EventNotificationConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_EventNotificationConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.EventNotificationConfig.class, - com.google.cloud.iot.v1.EventNotificationConfig.Builder.class); - } - - public static final int SUBFOLDER_MATCHES_FIELD_NUMBER = 2; - private volatile java.lang.Object subfolderMatches_; - /** - * - * - *
-   * If the subfolder name matches this string exactly, this configuration will
-   * be used. The string must not include the leading '/' character. If empty,
-   * all strings are matched. This field is used only for telemetry events;
-   * subfolders are not supported for state changes.
-   * 
- * - * string subfolder_matches = 2; - * - * @return The subfolderMatches. - */ - @java.lang.Override - public java.lang.String getSubfolderMatches() { - java.lang.Object ref = subfolderMatches_; - 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(); - subfolderMatches_ = s; - return s; - } - } - /** - * - * - *
-   * If the subfolder name matches this string exactly, this configuration will
-   * be used. The string must not include the leading '/' character. If empty,
-   * all strings are matched. This field is used only for telemetry events;
-   * subfolders are not supported for state changes.
-   * 
- * - * string subfolder_matches = 2; - * - * @return The bytes for subfolderMatches. - */ - @java.lang.Override - public com.google.protobuf.ByteString getSubfolderMatchesBytes() { - java.lang.Object ref = subfolderMatches_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - subfolderMatches_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int PUBSUB_TOPIC_NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object pubsubTopicName_; - /** - * - * - *
-   * A Cloud Pub/Sub topic name. For example,
-   * `projects/myProject/topics/deviceEvents`.
-   * 
- * - * string pubsub_topic_name = 1; - * - * @return The pubsubTopicName. - */ - @java.lang.Override - public java.lang.String getPubsubTopicName() { - java.lang.Object ref = pubsubTopicName_; - 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(); - pubsubTopicName_ = s; - return s; - } - } - /** - * - * - *
-   * A Cloud Pub/Sub topic name. For example,
-   * `projects/myProject/topics/deviceEvents`.
-   * 
- * - * string pubsub_topic_name = 1; - * - * @return The bytes for pubsubTopicName. - */ - @java.lang.Override - public com.google.protobuf.ByteString getPubsubTopicNameBytes() { - java.lang.Object ref = pubsubTopicName_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - pubsubTopicName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pubsubTopicName_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pubsubTopicName_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(subfolderMatches_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, subfolderMatches_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pubsubTopicName_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pubsubTopicName_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(subfolderMatches_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, subfolderMatches_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.EventNotificationConfig)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.EventNotificationConfig other = - (com.google.cloud.iot.v1.EventNotificationConfig) obj; - - if (!getSubfolderMatches().equals(other.getSubfolderMatches())) return false; - if (!getPubsubTopicName().equals(other.getPubsubTopicName())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + SUBFOLDER_MATCHES_FIELD_NUMBER; - hash = (53 * hash) + getSubfolderMatches().hashCode(); - hash = (37 * hash) + PUBSUB_TOPIC_NAME_FIELD_NUMBER; - hash = (53 * hash) + getPubsubTopicName().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.EventNotificationConfig parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.EventNotificationConfig 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.iot.v1.EventNotificationConfig parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.EventNotificationConfig 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.iot.v1.EventNotificationConfig parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.EventNotificationConfig parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.EventNotificationConfig parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.EventNotificationConfig 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.iot.v1.EventNotificationConfig parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.EventNotificationConfig 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.iot.v1.EventNotificationConfig parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.EventNotificationConfig 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.iot.v1.EventNotificationConfig 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 configuration for forwarding telemetry events.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.EventNotificationConfig} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.EventNotificationConfig) - com.google.cloud.iot.v1.EventNotificationConfigOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_EventNotificationConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_EventNotificationConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.EventNotificationConfig.class, - com.google.cloud.iot.v1.EventNotificationConfig.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.EventNotificationConfig.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - subfolderMatches_ = ""; - - pubsubTopicName_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_EventNotificationConfig_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.EventNotificationConfig getDefaultInstanceForType() { - return com.google.cloud.iot.v1.EventNotificationConfig.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.EventNotificationConfig build() { - com.google.cloud.iot.v1.EventNotificationConfig result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.EventNotificationConfig buildPartial() { - com.google.cloud.iot.v1.EventNotificationConfig result = - new com.google.cloud.iot.v1.EventNotificationConfig(this); - result.subfolderMatches_ = subfolderMatches_; - result.pubsubTopicName_ = pubsubTopicName_; - 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.iot.v1.EventNotificationConfig) { - return mergeFrom((com.google.cloud.iot.v1.EventNotificationConfig) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.EventNotificationConfig other) { - if (other == com.google.cloud.iot.v1.EventNotificationConfig.getDefaultInstance()) - return this; - if (!other.getSubfolderMatches().isEmpty()) { - subfolderMatches_ = other.subfolderMatches_; - onChanged(); - } - if (!other.getPubsubTopicName().isEmpty()) { - pubsubTopicName_ = other.pubsubTopicName_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - pubsubTopicName_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - subfolderMatches_ = input.readStringRequireUtf8(); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object subfolderMatches_ = ""; - /** - * - * - *
-     * If the subfolder name matches this string exactly, this configuration will
-     * be used. The string must not include the leading '/' character. If empty,
-     * all strings are matched. This field is used only for telemetry events;
-     * subfolders are not supported for state changes.
-     * 
- * - * string subfolder_matches = 2; - * - * @return The subfolderMatches. - */ - public java.lang.String getSubfolderMatches() { - java.lang.Object ref = subfolderMatches_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - subfolderMatches_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * If the subfolder name matches this string exactly, this configuration will
-     * be used. The string must not include the leading '/' character. If empty,
-     * all strings are matched. This field is used only for telemetry events;
-     * subfolders are not supported for state changes.
-     * 
- * - * string subfolder_matches = 2; - * - * @return The bytes for subfolderMatches. - */ - public com.google.protobuf.ByteString getSubfolderMatchesBytes() { - java.lang.Object ref = subfolderMatches_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - subfolderMatches_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * If the subfolder name matches this string exactly, this configuration will
-     * be used. The string must not include the leading '/' character. If empty,
-     * all strings are matched. This field is used only for telemetry events;
-     * subfolders are not supported for state changes.
-     * 
- * - * string subfolder_matches = 2; - * - * @param value The subfolderMatches to set. - * @return This builder for chaining. - */ - public Builder setSubfolderMatches(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - subfolderMatches_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If the subfolder name matches this string exactly, this configuration will
-     * be used. The string must not include the leading '/' character. If empty,
-     * all strings are matched. This field is used only for telemetry events;
-     * subfolders are not supported for state changes.
-     * 
- * - * string subfolder_matches = 2; - * - * @return This builder for chaining. - */ - public Builder clearSubfolderMatches() { - - subfolderMatches_ = getDefaultInstance().getSubfolderMatches(); - onChanged(); - return this; - } - /** - * - * - *
-     * If the subfolder name matches this string exactly, this configuration will
-     * be used. The string must not include the leading '/' character. If empty,
-     * all strings are matched. This field is used only for telemetry events;
-     * subfolders are not supported for state changes.
-     * 
- * - * string subfolder_matches = 2; - * - * @param value The bytes for subfolderMatches to set. - * @return This builder for chaining. - */ - public Builder setSubfolderMatchesBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - subfolderMatches_ = value; - onChanged(); - return this; - } - - private java.lang.Object pubsubTopicName_ = ""; - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @return The pubsubTopicName. - */ - public java.lang.String getPubsubTopicName() { - java.lang.Object ref = pubsubTopicName_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - pubsubTopicName_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @return The bytes for pubsubTopicName. - */ - public com.google.protobuf.ByteString getPubsubTopicNameBytes() { - java.lang.Object ref = pubsubTopicName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - pubsubTopicName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @param value The pubsubTopicName to set. - * @return This builder for chaining. - */ - public Builder setPubsubTopicName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - pubsubTopicName_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @return This builder for chaining. - */ - public Builder clearPubsubTopicName() { - - pubsubTopicName_ = getDefaultInstance().getPubsubTopicName(); - onChanged(); - return this; - } - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @param value The bytes for pubsubTopicName to set. - * @return This builder for chaining. - */ - public Builder setPubsubTopicNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - pubsubTopicName_ = 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.iot.v1.EventNotificationConfig) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.EventNotificationConfig) - private static final com.google.cloud.iot.v1.EventNotificationConfig DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.EventNotificationConfig(); - } - - public static com.google.cloud.iot.v1.EventNotificationConfig getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public EventNotificationConfig parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.EventNotificationConfig getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/EventNotificationConfigOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/EventNotificationConfigOrBuilder.java deleted file mode 100644 index 40cd05f7..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/EventNotificationConfigOrBuilder.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface EventNotificationConfigOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.EventNotificationConfig) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * If the subfolder name matches this string exactly, this configuration will
-   * be used. The string must not include the leading '/' character. If empty,
-   * all strings are matched. This field is used only for telemetry events;
-   * subfolders are not supported for state changes.
-   * 
- * - * string subfolder_matches = 2; - * - * @return The subfolderMatches. - */ - java.lang.String getSubfolderMatches(); - /** - * - * - *
-   * If the subfolder name matches this string exactly, this configuration will
-   * be used. The string must not include the leading '/' character. If empty,
-   * all strings are matched. This field is used only for telemetry events;
-   * subfolders are not supported for state changes.
-   * 
- * - * string subfolder_matches = 2; - * - * @return The bytes for subfolderMatches. - */ - com.google.protobuf.ByteString getSubfolderMatchesBytes(); - - /** - * - * - *
-   * A Cloud Pub/Sub topic name. For example,
-   * `projects/myProject/topics/deviceEvents`.
-   * 
- * - * string pubsub_topic_name = 1; - * - * @return The pubsubTopicName. - */ - java.lang.String getPubsubTopicName(); - /** - * - * - *
-   * A Cloud Pub/Sub topic name. For example,
-   * `projects/myProject/topics/deviceEvents`.
-   * 
- * - * string pubsub_topic_name = 1; - * - * @return The bytes for pubsubTopicName. - */ - com.google.protobuf.ByteString getPubsubTopicNameBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayAuthMethod.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayAuthMethod.java deleted file mode 100644 index d4088e00..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayAuthMethod.java +++ /dev/null @@ -1,211 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The gateway authorization/authentication method. This setting determines how
- * Cloud IoT Core authorizes/authenticate devices to access the gateway.
- * 
- * - * Protobuf enum {@code google.cloud.iot.v1.GatewayAuthMethod} - */ -public enum GatewayAuthMethod implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-   * No authentication/authorization method specified. No devices are allowed to
-   * access the gateway.
-   * 
- * - * GATEWAY_AUTH_METHOD_UNSPECIFIED = 0; - */ - GATEWAY_AUTH_METHOD_UNSPECIFIED(0), - /** - * - * - *
-   * The device is authenticated through the gateway association only. Device
-   * credentials are ignored even if provided.
-   * 
- * - * ASSOCIATION_ONLY = 1; - */ - ASSOCIATION_ONLY(1), - /** - * - * - *
-   * The device is authenticated through its own credentials. Gateway
-   * association is not checked.
-   * 
- * - * DEVICE_AUTH_TOKEN_ONLY = 2; - */ - DEVICE_AUTH_TOKEN_ONLY(2), - /** - * - * - *
-   * The device is authenticated through both device credentials and gateway
-   * association. The device must be bound to the gateway and must provide its
-   * own credentials.
-   * 
- * - * ASSOCIATION_AND_DEVICE_AUTH_TOKEN = 3; - */ - ASSOCIATION_AND_DEVICE_AUTH_TOKEN(3), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-   * No authentication/authorization method specified. No devices are allowed to
-   * access the gateway.
-   * 
- * - * GATEWAY_AUTH_METHOD_UNSPECIFIED = 0; - */ - public static final int GATEWAY_AUTH_METHOD_UNSPECIFIED_VALUE = 0; - /** - * - * - *
-   * The device is authenticated through the gateway association only. Device
-   * credentials are ignored even if provided.
-   * 
- * - * ASSOCIATION_ONLY = 1; - */ - public static final int ASSOCIATION_ONLY_VALUE = 1; - /** - * - * - *
-   * The device is authenticated through its own credentials. Gateway
-   * association is not checked.
-   * 
- * - * DEVICE_AUTH_TOKEN_ONLY = 2; - */ - public static final int DEVICE_AUTH_TOKEN_ONLY_VALUE = 2; - /** - * - * - *
-   * The device is authenticated through both device credentials and gateway
-   * association. The device must be bound to the gateway and must provide its
-   * own credentials.
-   * 
- * - * ASSOCIATION_AND_DEVICE_AUTH_TOKEN = 3; - */ - public static final int ASSOCIATION_AND_DEVICE_AUTH_TOKEN_VALUE = 3; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static GatewayAuthMethod valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static GatewayAuthMethod forNumber(int value) { - switch (value) { - case 0: - return GATEWAY_AUTH_METHOD_UNSPECIFIED; - case 1: - return ASSOCIATION_ONLY; - case 2: - return DEVICE_AUTH_TOKEN_ONLY; - case 3: - return ASSOCIATION_AND_DEVICE_AUTH_TOKEN; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public GatewayAuthMethod findValueByNumber(int number) { - return GatewayAuthMethod.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto.getDescriptor().getEnumTypes().get(4); - } - - private static final GatewayAuthMethod[] VALUES = values(); - - public static GatewayAuthMethod valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private GatewayAuthMethod(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.cloud.iot.v1.GatewayAuthMethod) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayConfig.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayConfig.java deleted file mode 100644 index 7bbc38f4..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayConfig.java +++ /dev/null @@ -1,1201 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Gateway-related configuration and state.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.GatewayConfig} - */ -public final class GatewayConfig extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.GatewayConfig) - GatewayConfigOrBuilder { - private static final long serialVersionUID = 0L; - // Use GatewayConfig.newBuilder() to construct. - private GatewayConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private GatewayConfig() { - gatewayType_ = 0; - gatewayAuthMethod_ = 0; - lastAccessedGatewayId_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new GatewayConfig(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_GatewayConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_GatewayConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.GatewayConfig.class, - com.google.cloud.iot.v1.GatewayConfig.Builder.class); - } - - public static final int GATEWAY_TYPE_FIELD_NUMBER = 1; - private int gatewayType_; - /** - * - * - *
-   * Indicates whether the device is a gateway.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The enum numeric value on the wire for gatewayType. - */ - @java.lang.Override - public int getGatewayTypeValue() { - return gatewayType_; - } - /** - * - * - *
-   * Indicates whether the device is a gateway.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The gatewayType. - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayType getGatewayType() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.GatewayType result = - com.google.cloud.iot.v1.GatewayType.valueOf(gatewayType_); - return result == null ? com.google.cloud.iot.v1.GatewayType.UNRECOGNIZED : result; - } - - public static final int GATEWAY_AUTH_METHOD_FIELD_NUMBER = 2; - private int gatewayAuthMethod_; - /** - * - * - *
-   * Indicates how to authorize and/or authenticate devices to access the
-   * gateway.
-   * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @return The enum numeric value on the wire for gatewayAuthMethod. - */ - @java.lang.Override - public int getGatewayAuthMethodValue() { - return gatewayAuthMethod_; - } - /** - * - * - *
-   * Indicates how to authorize and/or authenticate devices to access the
-   * gateway.
-   * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @return The gatewayAuthMethod. - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayAuthMethod getGatewayAuthMethod() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.GatewayAuthMethod result = - com.google.cloud.iot.v1.GatewayAuthMethod.valueOf(gatewayAuthMethod_); - return result == null ? com.google.cloud.iot.v1.GatewayAuthMethod.UNRECOGNIZED : result; - } - - public static final int LAST_ACCESSED_GATEWAY_ID_FIELD_NUMBER = 3; - private volatile java.lang.Object lastAccessedGatewayId_; - /** - * - * - *
-   * [Output only] The ID of the gateway the device accessed most recently.
-   * 
- * - * string last_accessed_gateway_id = 3; - * - * @return The lastAccessedGatewayId. - */ - @java.lang.Override - public java.lang.String getLastAccessedGatewayId() { - java.lang.Object ref = lastAccessedGatewayId_; - 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(); - lastAccessedGatewayId_ = s; - return s; - } - } - /** - * - * - *
-   * [Output only] The ID of the gateway the device accessed most recently.
-   * 
- * - * string last_accessed_gateway_id = 3; - * - * @return The bytes for lastAccessedGatewayId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getLastAccessedGatewayIdBytes() { - java.lang.Object ref = lastAccessedGatewayId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - lastAccessedGatewayId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int LAST_ACCESSED_GATEWAY_TIME_FIELD_NUMBER = 4; - private com.google.protobuf.Timestamp lastAccessedGatewayTime_; - /** - * - * - *
-   * [Output only] The most recent time at which the device accessed the gateway
-   * specified in `last_accessed_gateway`.
-   * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - * - * @return Whether the lastAccessedGatewayTime field is set. - */ - @java.lang.Override - public boolean hasLastAccessedGatewayTime() { - return lastAccessedGatewayTime_ != null; - } - /** - * - * - *
-   * [Output only] The most recent time at which the device accessed the gateway
-   * specified in `last_accessed_gateway`.
-   * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - * - * @return The lastAccessedGatewayTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getLastAccessedGatewayTime() { - return lastAccessedGatewayTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastAccessedGatewayTime_; - } - /** - * - * - *
-   * [Output only] The most recent time at which the device accessed the gateway
-   * specified in `last_accessed_gateway`.
-   * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getLastAccessedGatewayTimeOrBuilder() { - return getLastAccessedGatewayTime(); - } - - 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 (gatewayType_ != com.google.cloud.iot.v1.GatewayType.GATEWAY_TYPE_UNSPECIFIED.getNumber()) { - output.writeEnum(1, gatewayType_); - } - if (gatewayAuthMethod_ - != com.google.cloud.iot.v1.GatewayAuthMethod.GATEWAY_AUTH_METHOD_UNSPECIFIED.getNumber()) { - output.writeEnum(2, gatewayAuthMethod_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastAccessedGatewayId_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, lastAccessedGatewayId_); - } - if (lastAccessedGatewayTime_ != null) { - output.writeMessage(4, getLastAccessedGatewayTime()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (gatewayType_ != com.google.cloud.iot.v1.GatewayType.GATEWAY_TYPE_UNSPECIFIED.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, gatewayType_); - } - if (gatewayAuthMethod_ - != com.google.cloud.iot.v1.GatewayAuthMethod.GATEWAY_AUTH_METHOD_UNSPECIFIED.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, gatewayAuthMethod_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastAccessedGatewayId_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, lastAccessedGatewayId_); - } - if (lastAccessedGatewayTime_ != null) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize(4, getLastAccessedGatewayTime()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.GatewayConfig)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.GatewayConfig other = (com.google.cloud.iot.v1.GatewayConfig) obj; - - if (gatewayType_ != other.gatewayType_) return false; - if (gatewayAuthMethod_ != other.gatewayAuthMethod_) return false; - if (!getLastAccessedGatewayId().equals(other.getLastAccessedGatewayId())) return false; - if (hasLastAccessedGatewayTime() != other.hasLastAccessedGatewayTime()) return false; - if (hasLastAccessedGatewayTime()) { - if (!getLastAccessedGatewayTime().equals(other.getLastAccessedGatewayTime())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + GATEWAY_TYPE_FIELD_NUMBER; - hash = (53 * hash) + gatewayType_; - hash = (37 * hash) + GATEWAY_AUTH_METHOD_FIELD_NUMBER; - hash = (53 * hash) + gatewayAuthMethod_; - hash = (37 * hash) + LAST_ACCESSED_GATEWAY_ID_FIELD_NUMBER; - hash = (53 * hash) + getLastAccessedGatewayId().hashCode(); - if (hasLastAccessedGatewayTime()) { - hash = (37 * hash) + LAST_ACCESSED_GATEWAY_TIME_FIELD_NUMBER; - hash = (53 * hash) + getLastAccessedGatewayTime().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.GatewayConfig parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GatewayConfig 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.iot.v1.GatewayConfig parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GatewayConfig 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.iot.v1.GatewayConfig parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GatewayConfig parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.GatewayConfig parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GatewayConfig 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.iot.v1.GatewayConfig parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GatewayConfig 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.iot.v1.GatewayConfig parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GatewayConfig 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.iot.v1.GatewayConfig 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; - } - /** - * - * - *
-   * Gateway-related configuration and state.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.GatewayConfig} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.GatewayConfig) - com.google.cloud.iot.v1.GatewayConfigOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_GatewayConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_GatewayConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.GatewayConfig.class, - com.google.cloud.iot.v1.GatewayConfig.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.GatewayConfig.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - gatewayType_ = 0; - - gatewayAuthMethod_ = 0; - - lastAccessedGatewayId_ = ""; - - if (lastAccessedGatewayTimeBuilder_ == null) { - lastAccessedGatewayTime_ = null; - } else { - lastAccessedGatewayTime_ = null; - lastAccessedGatewayTimeBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_GatewayConfig_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GatewayConfig getDefaultInstanceForType() { - return com.google.cloud.iot.v1.GatewayConfig.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.GatewayConfig build() { - com.google.cloud.iot.v1.GatewayConfig result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GatewayConfig buildPartial() { - com.google.cloud.iot.v1.GatewayConfig result = - new com.google.cloud.iot.v1.GatewayConfig(this); - result.gatewayType_ = gatewayType_; - result.gatewayAuthMethod_ = gatewayAuthMethod_; - result.lastAccessedGatewayId_ = lastAccessedGatewayId_; - if (lastAccessedGatewayTimeBuilder_ == null) { - result.lastAccessedGatewayTime_ = lastAccessedGatewayTime_; - } else { - result.lastAccessedGatewayTime_ = lastAccessedGatewayTimeBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.GatewayConfig) { - return mergeFrom((com.google.cloud.iot.v1.GatewayConfig) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.GatewayConfig other) { - if (other == com.google.cloud.iot.v1.GatewayConfig.getDefaultInstance()) return this; - if (other.gatewayType_ != 0) { - setGatewayTypeValue(other.getGatewayTypeValue()); - } - if (other.gatewayAuthMethod_ != 0) { - setGatewayAuthMethodValue(other.getGatewayAuthMethodValue()); - } - if (!other.getLastAccessedGatewayId().isEmpty()) { - lastAccessedGatewayId_ = other.lastAccessedGatewayId_; - onChanged(); - } - if (other.hasLastAccessedGatewayTime()) { - mergeLastAccessedGatewayTime(other.getLastAccessedGatewayTime()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - gatewayType_ = input.readEnum(); - - break; - } // case 8 - case 16: - { - gatewayAuthMethod_ = input.readEnum(); - - break; - } // case 16 - case 26: - { - lastAccessedGatewayId_ = input.readStringRequireUtf8(); - - break; - } // case 26 - case 34: - { - input.readMessage( - getLastAccessedGatewayTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 34 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int gatewayType_ = 0; - /** - * - * - *
-     * Indicates whether the device is a gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The enum numeric value on the wire for gatewayType. - */ - @java.lang.Override - public int getGatewayTypeValue() { - return gatewayType_; - } - /** - * - * - *
-     * Indicates whether the device is a gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @param value The enum numeric value on the wire for gatewayType to set. - * @return This builder for chaining. - */ - public Builder setGatewayTypeValue(int value) { - - gatewayType_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Indicates whether the device is a gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The gatewayType. - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayType getGatewayType() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.GatewayType result = - com.google.cloud.iot.v1.GatewayType.valueOf(gatewayType_); - return result == null ? com.google.cloud.iot.v1.GatewayType.UNRECOGNIZED : result; - } - /** - * - * - *
-     * Indicates whether the device is a gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @param value The gatewayType to set. - * @return This builder for chaining. - */ - public Builder setGatewayType(com.google.cloud.iot.v1.GatewayType value) { - if (value == null) { - throw new NullPointerException(); - } - - gatewayType_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * Indicates whether the device is a gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return This builder for chaining. - */ - public Builder clearGatewayType() { - - gatewayType_ = 0; - onChanged(); - return this; - } - - private int gatewayAuthMethod_ = 0; - /** - * - * - *
-     * Indicates how to authorize and/or authenticate devices to access the
-     * gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @return The enum numeric value on the wire for gatewayAuthMethod. - */ - @java.lang.Override - public int getGatewayAuthMethodValue() { - return gatewayAuthMethod_; - } - /** - * - * - *
-     * Indicates how to authorize and/or authenticate devices to access the
-     * gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @param value The enum numeric value on the wire for gatewayAuthMethod to set. - * @return This builder for chaining. - */ - public Builder setGatewayAuthMethodValue(int value) { - - gatewayAuthMethod_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Indicates how to authorize and/or authenticate devices to access the
-     * gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @return The gatewayAuthMethod. - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayAuthMethod getGatewayAuthMethod() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.GatewayAuthMethod result = - com.google.cloud.iot.v1.GatewayAuthMethod.valueOf(gatewayAuthMethod_); - return result == null ? com.google.cloud.iot.v1.GatewayAuthMethod.UNRECOGNIZED : result; - } - /** - * - * - *
-     * Indicates how to authorize and/or authenticate devices to access the
-     * gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @param value The gatewayAuthMethod to set. - * @return This builder for chaining. - */ - public Builder setGatewayAuthMethod(com.google.cloud.iot.v1.GatewayAuthMethod value) { - if (value == null) { - throw new NullPointerException(); - } - - gatewayAuthMethod_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * Indicates how to authorize and/or authenticate devices to access the
-     * gateway.
-     * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @return This builder for chaining. - */ - public Builder clearGatewayAuthMethod() { - - gatewayAuthMethod_ = 0; - onChanged(); - return this; - } - - private java.lang.Object lastAccessedGatewayId_ = ""; - /** - * - * - *
-     * [Output only] The ID of the gateway the device accessed most recently.
-     * 
- * - * string last_accessed_gateway_id = 3; - * - * @return The lastAccessedGatewayId. - */ - public java.lang.String getLastAccessedGatewayId() { - java.lang.Object ref = lastAccessedGatewayId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - lastAccessedGatewayId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * [Output only] The ID of the gateway the device accessed most recently.
-     * 
- * - * string last_accessed_gateway_id = 3; - * - * @return The bytes for lastAccessedGatewayId. - */ - public com.google.protobuf.ByteString getLastAccessedGatewayIdBytes() { - java.lang.Object ref = lastAccessedGatewayId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - lastAccessedGatewayId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * [Output only] The ID of the gateway the device accessed most recently.
-     * 
- * - * string last_accessed_gateway_id = 3; - * - * @param value The lastAccessedGatewayId to set. - * @return This builder for chaining. - */ - public Builder setLastAccessedGatewayId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - lastAccessedGatewayId_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * [Output only] The ID of the gateway the device accessed most recently.
-     * 
- * - * string last_accessed_gateway_id = 3; - * - * @return This builder for chaining. - */ - public Builder clearLastAccessedGatewayId() { - - lastAccessedGatewayId_ = getDefaultInstance().getLastAccessedGatewayId(); - onChanged(); - return this; - } - /** - * - * - *
-     * [Output only] The ID of the gateway the device accessed most recently.
-     * 
- * - * string last_accessed_gateway_id = 3; - * - * @param value The bytes for lastAccessedGatewayId to set. - * @return This builder for chaining. - */ - public Builder setLastAccessedGatewayIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - lastAccessedGatewayId_ = value; - onChanged(); - return this; - } - - private com.google.protobuf.Timestamp lastAccessedGatewayTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - lastAccessedGatewayTimeBuilder_; - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - * - * @return Whether the lastAccessedGatewayTime field is set. - */ - public boolean hasLastAccessedGatewayTime() { - return lastAccessedGatewayTimeBuilder_ != null || lastAccessedGatewayTime_ != null; - } - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - * - * @return The lastAccessedGatewayTime. - */ - public com.google.protobuf.Timestamp getLastAccessedGatewayTime() { - if (lastAccessedGatewayTimeBuilder_ == null) { - return lastAccessedGatewayTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastAccessedGatewayTime_; - } else { - return lastAccessedGatewayTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - public Builder setLastAccessedGatewayTime(com.google.protobuf.Timestamp value) { - if (lastAccessedGatewayTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - lastAccessedGatewayTime_ = value; - onChanged(); - } else { - lastAccessedGatewayTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - public Builder setLastAccessedGatewayTime( - com.google.protobuf.Timestamp.Builder builderForValue) { - if (lastAccessedGatewayTimeBuilder_ == null) { - lastAccessedGatewayTime_ = builderForValue.build(); - onChanged(); - } else { - lastAccessedGatewayTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - public Builder mergeLastAccessedGatewayTime(com.google.protobuf.Timestamp value) { - if (lastAccessedGatewayTimeBuilder_ == null) { - if (lastAccessedGatewayTime_ != null) { - lastAccessedGatewayTime_ = - com.google.protobuf.Timestamp.newBuilder(lastAccessedGatewayTime_) - .mergeFrom(value) - .buildPartial(); - } else { - lastAccessedGatewayTime_ = value; - } - onChanged(); - } else { - lastAccessedGatewayTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - public Builder clearLastAccessedGatewayTime() { - if (lastAccessedGatewayTimeBuilder_ == null) { - lastAccessedGatewayTime_ = null; - onChanged(); - } else { - lastAccessedGatewayTime_ = null; - lastAccessedGatewayTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - public com.google.protobuf.Timestamp.Builder getLastAccessedGatewayTimeBuilder() { - - onChanged(); - return getLastAccessedGatewayTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - public com.google.protobuf.TimestampOrBuilder getLastAccessedGatewayTimeOrBuilder() { - if (lastAccessedGatewayTimeBuilder_ != null) { - return lastAccessedGatewayTimeBuilder_.getMessageOrBuilder(); - } else { - return lastAccessedGatewayTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : lastAccessedGatewayTime_; - } - } - /** - * - * - *
-     * [Output only] The most recent time at which the device accessed the gateway
-     * specified in `last_accessed_gateway`.
-     * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getLastAccessedGatewayTimeFieldBuilder() { - if (lastAccessedGatewayTimeBuilder_ == null) { - lastAccessedGatewayTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getLastAccessedGatewayTime(), getParentForChildren(), isClean()); - lastAccessedGatewayTime_ = null; - } - return lastAccessedGatewayTimeBuilder_; - } - - @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.iot.v1.GatewayConfig) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.GatewayConfig) - private static final com.google.cloud.iot.v1.GatewayConfig DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.GatewayConfig(); - } - - public static com.google.cloud.iot.v1.GatewayConfig getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public GatewayConfig parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GatewayConfig getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayConfigOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayConfigOrBuilder.java deleted file mode 100644 index 1268e4a0..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayConfigOrBuilder.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface GatewayConfigOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.GatewayConfig) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Indicates whether the device is a gateway.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The enum numeric value on the wire for gatewayType. - */ - int getGatewayTypeValue(); - /** - * - * - *
-   * Indicates whether the device is a gateway.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The gatewayType. - */ - com.google.cloud.iot.v1.GatewayType getGatewayType(); - - /** - * - * - *
-   * Indicates how to authorize and/or authenticate devices to access the
-   * gateway.
-   * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @return The enum numeric value on the wire for gatewayAuthMethod. - */ - int getGatewayAuthMethodValue(); - /** - * - * - *
-   * Indicates how to authorize and/or authenticate devices to access the
-   * gateway.
-   * 
- * - * .google.cloud.iot.v1.GatewayAuthMethod gateway_auth_method = 2; - * - * @return The gatewayAuthMethod. - */ - com.google.cloud.iot.v1.GatewayAuthMethod getGatewayAuthMethod(); - - /** - * - * - *
-   * [Output only] The ID of the gateway the device accessed most recently.
-   * 
- * - * string last_accessed_gateway_id = 3; - * - * @return The lastAccessedGatewayId. - */ - java.lang.String getLastAccessedGatewayId(); - /** - * - * - *
-   * [Output only] The ID of the gateway the device accessed most recently.
-   * 
- * - * string last_accessed_gateway_id = 3; - * - * @return The bytes for lastAccessedGatewayId. - */ - com.google.protobuf.ByteString getLastAccessedGatewayIdBytes(); - - /** - * - * - *
-   * [Output only] The most recent time at which the device accessed the gateway
-   * specified in `last_accessed_gateway`.
-   * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - * - * @return Whether the lastAccessedGatewayTime field is set. - */ - boolean hasLastAccessedGatewayTime(); - /** - * - * - *
-   * [Output only] The most recent time at which the device accessed the gateway
-   * specified in `last_accessed_gateway`.
-   * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - * - * @return The lastAccessedGatewayTime. - */ - com.google.protobuf.Timestamp getLastAccessedGatewayTime(); - /** - * - * - *
-   * [Output only] The most recent time at which the device accessed the gateway
-   * specified in `last_accessed_gateway`.
-   * 
- * - * .google.protobuf.Timestamp last_accessed_gateway_time = 4; - */ - com.google.protobuf.TimestampOrBuilder getLastAccessedGatewayTimeOrBuilder(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayListOptions.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayListOptions.java deleted file mode 100644 index 6a97e87d..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayListOptions.java +++ /dev/null @@ -1,1252 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Options for limiting the list based on gateway type and associations.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.GatewayListOptions} - */ -public final class GatewayListOptions extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.GatewayListOptions) - GatewayListOptionsOrBuilder { - private static final long serialVersionUID = 0L; - // Use GatewayListOptions.newBuilder() to construct. - private GatewayListOptions(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private GatewayListOptions() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new GatewayListOptions(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GatewayListOptions_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GatewayListOptions_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.GatewayListOptions.class, - com.google.cloud.iot.v1.GatewayListOptions.Builder.class); - } - - private int filterCase_ = 0; - private java.lang.Object filter_; - - public enum FilterCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - GATEWAY_TYPE(1), - ASSOCIATIONS_GATEWAY_ID(2), - ASSOCIATIONS_DEVICE_ID(3), - FILTER_NOT_SET(0); - private final int value; - - private FilterCase(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 FilterCase valueOf(int value) { - return forNumber(value); - } - - public static FilterCase forNumber(int value) { - switch (value) { - case 1: - return GATEWAY_TYPE; - case 2: - return ASSOCIATIONS_GATEWAY_ID; - case 3: - return ASSOCIATIONS_DEVICE_ID; - case 0: - return FILTER_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public FilterCase getFilterCase() { - return FilterCase.forNumber(filterCase_); - } - - public static final int GATEWAY_TYPE_FIELD_NUMBER = 1; - /** - * - * - *
-   * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-   * is specified, only non-gateway devices are returned. If
-   * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return Whether the gatewayType field is set. - */ - public boolean hasGatewayType() { - return filterCase_ == 1; - } - /** - * - * - *
-   * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-   * is specified, only non-gateway devices are returned. If
-   * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The enum numeric value on the wire for gatewayType. - */ - public int getGatewayTypeValue() { - if (filterCase_ == 1) { - return (java.lang.Integer) filter_; - } - return 0; - } - /** - * - * - *
-   * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-   * is specified, only non-gateway devices are returned. If
-   * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The gatewayType. - */ - public com.google.cloud.iot.v1.GatewayType getGatewayType() { - if (filterCase_ == 1) { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.GatewayType result = - com.google.cloud.iot.v1.GatewayType.valueOf((java.lang.Integer) filter_); - return result == null ? com.google.cloud.iot.v1.GatewayType.UNRECOGNIZED : result; - } - return com.google.cloud.iot.v1.GatewayType.GATEWAY_TYPE_UNSPECIFIED; - } - - public static final int ASSOCIATIONS_GATEWAY_ID_FIELD_NUMBER = 2; - /** - * - * - *
-   * If set, only devices associated with the specified gateway are returned.
-   * The gateway ID can be numeric (`num_id`) or the user-defined string
-   * (`id`). For example, if `123` is specified, only devices bound to the
-   * gateway with `num_id` 123 are returned.
-   * 
- * - * string associations_gateway_id = 2; - * - * @return Whether the associationsGatewayId field is set. - */ - public boolean hasAssociationsGatewayId() { - return filterCase_ == 2; - } - /** - * - * - *
-   * If set, only devices associated with the specified gateway are returned.
-   * The gateway ID can be numeric (`num_id`) or the user-defined string
-   * (`id`). For example, if `123` is specified, only devices bound to the
-   * gateway with `num_id` 123 are returned.
-   * 
- * - * string associations_gateway_id = 2; - * - * @return The associationsGatewayId. - */ - public java.lang.String getAssociationsGatewayId() { - java.lang.Object ref = ""; - if (filterCase_ == 2) { - ref = filter_; - } - 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(); - if (filterCase_ == 2) { - filter_ = s; - } - return s; - } - } - /** - * - * - *
-   * If set, only devices associated with the specified gateway are returned.
-   * The gateway ID can be numeric (`num_id`) or the user-defined string
-   * (`id`). For example, if `123` is specified, only devices bound to the
-   * gateway with `num_id` 123 are returned.
-   * 
- * - * string associations_gateway_id = 2; - * - * @return The bytes for associationsGatewayId. - */ - public com.google.protobuf.ByteString getAssociationsGatewayIdBytes() { - java.lang.Object ref = ""; - if (filterCase_ == 2) { - ref = filter_; - } - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - if (filterCase_ == 2) { - filter_ = b; - } - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int ASSOCIATIONS_DEVICE_ID_FIELD_NUMBER = 3; - /** - * - * - *
-   * If set, returns only the gateways with which the specified device is
-   * associated. The device ID can be numeric (`num_id`) or the user-defined
-   * string (`id`). For example, if `456` is specified, returns only the
-   * gateways to which the device with `num_id` 456 is bound.
-   * 
- * - * string associations_device_id = 3; - * - * @return Whether the associationsDeviceId field is set. - */ - public boolean hasAssociationsDeviceId() { - return filterCase_ == 3; - } - /** - * - * - *
-   * If set, returns only the gateways with which the specified device is
-   * associated. The device ID can be numeric (`num_id`) or the user-defined
-   * string (`id`). For example, if `456` is specified, returns only the
-   * gateways to which the device with `num_id` 456 is bound.
-   * 
- * - * string associations_device_id = 3; - * - * @return The associationsDeviceId. - */ - public java.lang.String getAssociationsDeviceId() { - java.lang.Object ref = ""; - if (filterCase_ == 3) { - ref = filter_; - } - 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(); - if (filterCase_ == 3) { - filter_ = s; - } - return s; - } - } - /** - * - * - *
-   * If set, returns only the gateways with which the specified device is
-   * associated. The device ID can be numeric (`num_id`) or the user-defined
-   * string (`id`). For example, if `456` is specified, returns only the
-   * gateways to which the device with `num_id` 456 is bound.
-   * 
- * - * string associations_device_id = 3; - * - * @return The bytes for associationsDeviceId. - */ - public com.google.protobuf.ByteString getAssociationsDeviceIdBytes() { - java.lang.Object ref = ""; - if (filterCase_ == 3) { - ref = filter_; - } - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - if (filterCase_ == 3) { - filter_ = 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 (filterCase_ == 1) { - output.writeEnum(1, ((java.lang.Integer) filter_)); - } - if (filterCase_ == 2) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, filter_); - } - if (filterCase_ == 3) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, filter_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (filterCase_ == 1) { - size += - com.google.protobuf.CodedOutputStream.computeEnumSize(1, ((java.lang.Integer) filter_)); - } - if (filterCase_ == 2) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, filter_); - } - if (filterCase_ == 3) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, filter_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.GatewayListOptions)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.GatewayListOptions other = - (com.google.cloud.iot.v1.GatewayListOptions) obj; - - if (!getFilterCase().equals(other.getFilterCase())) return false; - switch (filterCase_) { - case 1: - if (getGatewayTypeValue() != other.getGatewayTypeValue()) return false; - break; - case 2: - if (!getAssociationsGatewayId().equals(other.getAssociationsGatewayId())) return false; - break; - case 3: - if (!getAssociationsDeviceId().equals(other.getAssociationsDeviceId())) return false; - break; - case 0: - default: - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - switch (filterCase_) { - case 1: - hash = (37 * hash) + GATEWAY_TYPE_FIELD_NUMBER; - hash = (53 * hash) + getGatewayTypeValue(); - break; - case 2: - hash = (37 * hash) + ASSOCIATIONS_GATEWAY_ID_FIELD_NUMBER; - hash = (53 * hash) + getAssociationsGatewayId().hashCode(); - break; - case 3: - hash = (37 * hash) + ASSOCIATIONS_DEVICE_ID_FIELD_NUMBER; - hash = (53 * hash) + getAssociationsDeviceId().hashCode(); - break; - case 0: - default: - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.GatewayListOptions parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GatewayListOptions 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.iot.v1.GatewayListOptions parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GatewayListOptions 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.iot.v1.GatewayListOptions parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GatewayListOptions parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.GatewayListOptions parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GatewayListOptions 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.iot.v1.GatewayListOptions parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GatewayListOptions 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.iot.v1.GatewayListOptions parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GatewayListOptions 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.iot.v1.GatewayListOptions 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; - } - /** - * - * - *
-   * Options for limiting the list based on gateway type and associations.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.GatewayListOptions} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.GatewayListOptions) - com.google.cloud.iot.v1.GatewayListOptionsOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GatewayListOptions_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GatewayListOptions_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.GatewayListOptions.class, - com.google.cloud.iot.v1.GatewayListOptions.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.GatewayListOptions.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - filterCase_ = 0; - filter_ = null; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GatewayListOptions_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GatewayListOptions getDefaultInstanceForType() { - return com.google.cloud.iot.v1.GatewayListOptions.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.GatewayListOptions build() { - com.google.cloud.iot.v1.GatewayListOptions result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GatewayListOptions buildPartial() { - com.google.cloud.iot.v1.GatewayListOptions result = - new com.google.cloud.iot.v1.GatewayListOptions(this); - if (filterCase_ == 1) { - result.filter_ = filter_; - } - if (filterCase_ == 2) { - result.filter_ = filter_; - } - if (filterCase_ == 3) { - result.filter_ = filter_; - } - result.filterCase_ = filterCase_; - 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.iot.v1.GatewayListOptions) { - return mergeFrom((com.google.cloud.iot.v1.GatewayListOptions) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.GatewayListOptions other) { - if (other == com.google.cloud.iot.v1.GatewayListOptions.getDefaultInstance()) return this; - switch (other.getFilterCase()) { - case GATEWAY_TYPE: - { - setGatewayTypeValue(other.getGatewayTypeValue()); - break; - } - case ASSOCIATIONS_GATEWAY_ID: - { - filterCase_ = 2; - filter_ = other.filter_; - onChanged(); - break; - } - case ASSOCIATIONS_DEVICE_ID: - { - filterCase_ = 3; - filter_ = other.filter_; - onChanged(); - break; - } - case FILTER_NOT_SET: - { - break; - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - int rawValue = input.readEnum(); - filterCase_ = 1; - filter_ = rawValue; - break; - } // case 8 - case 18: - { - java.lang.String s = input.readStringRequireUtf8(); - filterCase_ = 2; - filter_ = s; - break; - } // case 18 - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - filterCase_ = 3; - filter_ = s; - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int filterCase_ = 0; - private java.lang.Object filter_; - - public FilterCase getFilterCase() { - return FilterCase.forNumber(filterCase_); - } - - public Builder clearFilter() { - filterCase_ = 0; - filter_ = null; - onChanged(); - return this; - } - - /** - * - * - *
-     * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-     * is specified, only non-gateway devices are returned. If
-     * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return Whether the gatewayType field is set. - */ - @java.lang.Override - public boolean hasGatewayType() { - return filterCase_ == 1; - } - /** - * - * - *
-     * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-     * is specified, only non-gateway devices are returned. If
-     * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The enum numeric value on the wire for gatewayType. - */ - @java.lang.Override - public int getGatewayTypeValue() { - if (filterCase_ == 1) { - return ((java.lang.Integer) filter_).intValue(); - } - return 0; - } - /** - * - * - *
-     * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-     * is specified, only non-gateway devices are returned. If
-     * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @param value The enum numeric value on the wire for gatewayType to set. - * @return This builder for chaining. - */ - public Builder setGatewayTypeValue(int value) { - filterCase_ = 1; - filter_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-     * is specified, only non-gateway devices are returned. If
-     * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The gatewayType. - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayType getGatewayType() { - if (filterCase_ == 1) { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.GatewayType result = - com.google.cloud.iot.v1.GatewayType.valueOf((java.lang.Integer) filter_); - return result == null ? com.google.cloud.iot.v1.GatewayType.UNRECOGNIZED : result; - } - return com.google.cloud.iot.v1.GatewayType.GATEWAY_TYPE_UNSPECIFIED; - } - /** - * - * - *
-     * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-     * is specified, only non-gateway devices are returned. If
-     * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @param value The gatewayType to set. - * @return This builder for chaining. - */ - public Builder setGatewayType(com.google.cloud.iot.v1.GatewayType value) { - if (value == null) { - throw new NullPointerException(); - } - filterCase_ = 1; - filter_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-     * is specified, only non-gateway devices are returned. If
-     * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-     * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return This builder for chaining. - */ - public Builder clearGatewayType() { - if (filterCase_ == 1) { - filterCase_ = 0; - filter_ = null; - onChanged(); - } - return this; - } - - /** - * - * - *
-     * If set, only devices associated with the specified gateway are returned.
-     * The gateway ID can be numeric (`num_id`) or the user-defined string
-     * (`id`). For example, if `123` is specified, only devices bound to the
-     * gateway with `num_id` 123 are returned.
-     * 
- * - * string associations_gateway_id = 2; - * - * @return Whether the associationsGatewayId field is set. - */ - @java.lang.Override - public boolean hasAssociationsGatewayId() { - return filterCase_ == 2; - } - /** - * - * - *
-     * If set, only devices associated with the specified gateway are returned.
-     * The gateway ID can be numeric (`num_id`) or the user-defined string
-     * (`id`). For example, if `123` is specified, only devices bound to the
-     * gateway with `num_id` 123 are returned.
-     * 
- * - * string associations_gateway_id = 2; - * - * @return The associationsGatewayId. - */ - @java.lang.Override - public java.lang.String getAssociationsGatewayId() { - java.lang.Object ref = ""; - if (filterCase_ == 2) { - ref = filter_; - } - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (filterCase_ == 2) { - filter_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * If set, only devices associated with the specified gateway are returned.
-     * The gateway ID can be numeric (`num_id`) or the user-defined string
-     * (`id`). For example, if `123` is specified, only devices bound to the
-     * gateway with `num_id` 123 are returned.
-     * 
- * - * string associations_gateway_id = 2; - * - * @return The bytes for associationsGatewayId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getAssociationsGatewayIdBytes() { - java.lang.Object ref = ""; - if (filterCase_ == 2) { - ref = filter_; - } - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - if (filterCase_ == 2) { - filter_ = b; - } - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * If set, only devices associated with the specified gateway are returned.
-     * The gateway ID can be numeric (`num_id`) or the user-defined string
-     * (`id`). For example, if `123` is specified, only devices bound to the
-     * gateway with `num_id` 123 are returned.
-     * 
- * - * string associations_gateway_id = 2; - * - * @param value The associationsGatewayId to set. - * @return This builder for chaining. - */ - public Builder setAssociationsGatewayId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - filterCase_ = 2; - filter_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If set, only devices associated with the specified gateway are returned.
-     * The gateway ID can be numeric (`num_id`) or the user-defined string
-     * (`id`). For example, if `123` is specified, only devices bound to the
-     * gateway with `num_id` 123 are returned.
-     * 
- * - * string associations_gateway_id = 2; - * - * @return This builder for chaining. - */ - public Builder clearAssociationsGatewayId() { - if (filterCase_ == 2) { - filterCase_ = 0; - filter_ = null; - onChanged(); - } - return this; - } - /** - * - * - *
-     * If set, only devices associated with the specified gateway are returned.
-     * The gateway ID can be numeric (`num_id`) or the user-defined string
-     * (`id`). For example, if `123` is specified, only devices bound to the
-     * gateway with `num_id` 123 are returned.
-     * 
- * - * string associations_gateway_id = 2; - * - * @param value The bytes for associationsGatewayId to set. - * @return This builder for chaining. - */ - public Builder setAssociationsGatewayIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - filterCase_ = 2; - filter_ = value; - onChanged(); - return this; - } - - /** - * - * - *
-     * If set, returns only the gateways with which the specified device is
-     * associated. The device ID can be numeric (`num_id`) or the user-defined
-     * string (`id`). For example, if `456` is specified, returns only the
-     * gateways to which the device with `num_id` 456 is bound.
-     * 
- * - * string associations_device_id = 3; - * - * @return Whether the associationsDeviceId field is set. - */ - @java.lang.Override - public boolean hasAssociationsDeviceId() { - return filterCase_ == 3; - } - /** - * - * - *
-     * If set, returns only the gateways with which the specified device is
-     * associated. The device ID can be numeric (`num_id`) or the user-defined
-     * string (`id`). For example, if `456` is specified, returns only the
-     * gateways to which the device with `num_id` 456 is bound.
-     * 
- * - * string associations_device_id = 3; - * - * @return The associationsDeviceId. - */ - @java.lang.Override - public java.lang.String getAssociationsDeviceId() { - java.lang.Object ref = ""; - if (filterCase_ == 3) { - ref = filter_; - } - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - if (filterCase_ == 3) { - filter_ = s; - } - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * If set, returns only the gateways with which the specified device is
-     * associated. The device ID can be numeric (`num_id`) or the user-defined
-     * string (`id`). For example, if `456` is specified, returns only the
-     * gateways to which the device with `num_id` 456 is bound.
-     * 
- * - * string associations_device_id = 3; - * - * @return The bytes for associationsDeviceId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getAssociationsDeviceIdBytes() { - java.lang.Object ref = ""; - if (filterCase_ == 3) { - ref = filter_; - } - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - if (filterCase_ == 3) { - filter_ = b; - } - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * If set, returns only the gateways with which the specified device is
-     * associated. The device ID can be numeric (`num_id`) or the user-defined
-     * string (`id`). For example, if `456` is specified, returns only the
-     * gateways to which the device with `num_id` 456 is bound.
-     * 
- * - * string associations_device_id = 3; - * - * @param value The associationsDeviceId to set. - * @return This builder for chaining. - */ - public Builder setAssociationsDeviceId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - filterCase_ = 3; - filter_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If set, returns only the gateways with which the specified device is
-     * associated. The device ID can be numeric (`num_id`) or the user-defined
-     * string (`id`). For example, if `456` is specified, returns only the
-     * gateways to which the device with `num_id` 456 is bound.
-     * 
- * - * string associations_device_id = 3; - * - * @return This builder for chaining. - */ - public Builder clearAssociationsDeviceId() { - if (filterCase_ == 3) { - filterCase_ = 0; - filter_ = null; - onChanged(); - } - return this; - } - /** - * - * - *
-     * If set, returns only the gateways with which the specified device is
-     * associated. The device ID can be numeric (`num_id`) or the user-defined
-     * string (`id`). For example, if `456` is specified, returns only the
-     * gateways to which the device with `num_id` 456 is bound.
-     * 
- * - * string associations_device_id = 3; - * - * @param value The bytes for associationsDeviceId to set. - * @return This builder for chaining. - */ - public Builder setAssociationsDeviceIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - filterCase_ = 3; - filter_ = 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.iot.v1.GatewayListOptions) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.GatewayListOptions) - private static final com.google.cloud.iot.v1.GatewayListOptions DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.GatewayListOptions(); - } - - public static com.google.cloud.iot.v1.GatewayListOptions getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public GatewayListOptions parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GatewayListOptions getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayListOptionsOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayListOptionsOrBuilder.java deleted file mode 100644 index e0b4861e..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayListOptionsOrBuilder.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface GatewayListOptionsOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.GatewayListOptions) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-   * is specified, only non-gateway devices are returned. If
-   * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return Whether the gatewayType field is set. - */ - boolean hasGatewayType(); - /** - * - * - *
-   * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-   * is specified, only non-gateway devices are returned. If
-   * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The enum numeric value on the wire for gatewayType. - */ - int getGatewayTypeValue(); - /** - * - * - *
-   * If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY`
-   * is specified, only non-gateway devices are returned. If
-   * `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned.
-   * 
- * - * .google.cloud.iot.v1.GatewayType gateway_type = 1; - * - * @return The gatewayType. - */ - com.google.cloud.iot.v1.GatewayType getGatewayType(); - - /** - * - * - *
-   * If set, only devices associated with the specified gateway are returned.
-   * The gateway ID can be numeric (`num_id`) or the user-defined string
-   * (`id`). For example, if `123` is specified, only devices bound to the
-   * gateway with `num_id` 123 are returned.
-   * 
- * - * string associations_gateway_id = 2; - * - * @return Whether the associationsGatewayId field is set. - */ - boolean hasAssociationsGatewayId(); - /** - * - * - *
-   * If set, only devices associated with the specified gateway are returned.
-   * The gateway ID can be numeric (`num_id`) or the user-defined string
-   * (`id`). For example, if `123` is specified, only devices bound to the
-   * gateway with `num_id` 123 are returned.
-   * 
- * - * string associations_gateway_id = 2; - * - * @return The associationsGatewayId. - */ - java.lang.String getAssociationsGatewayId(); - /** - * - * - *
-   * If set, only devices associated with the specified gateway are returned.
-   * The gateway ID can be numeric (`num_id`) or the user-defined string
-   * (`id`). For example, if `123` is specified, only devices bound to the
-   * gateway with `num_id` 123 are returned.
-   * 
- * - * string associations_gateway_id = 2; - * - * @return The bytes for associationsGatewayId. - */ - com.google.protobuf.ByteString getAssociationsGatewayIdBytes(); - - /** - * - * - *
-   * If set, returns only the gateways with which the specified device is
-   * associated. The device ID can be numeric (`num_id`) or the user-defined
-   * string (`id`). For example, if `456` is specified, returns only the
-   * gateways to which the device with `num_id` 456 is bound.
-   * 
- * - * string associations_device_id = 3; - * - * @return Whether the associationsDeviceId field is set. - */ - boolean hasAssociationsDeviceId(); - /** - * - * - *
-   * If set, returns only the gateways with which the specified device is
-   * associated. The device ID can be numeric (`num_id`) or the user-defined
-   * string (`id`). For example, if `456` is specified, returns only the
-   * gateways to which the device with `num_id` 456 is bound.
-   * 
- * - * string associations_device_id = 3; - * - * @return The associationsDeviceId. - */ - java.lang.String getAssociationsDeviceId(); - /** - * - * - *
-   * If set, returns only the gateways with which the specified device is
-   * associated. The device ID can be numeric (`num_id`) or the user-defined
-   * string (`id`). For example, if `456` is specified, returns only the
-   * gateways to which the device with `num_id` 456 is bound.
-   * 
- * - * string associations_device_id = 3; - * - * @return The bytes for associationsDeviceId. - */ - com.google.protobuf.ByteString getAssociationsDeviceIdBytes(); - - public com.google.cloud.iot.v1.GatewayListOptions.FilterCase getFilterCase(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayType.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayType.java deleted file mode 100644 index 569e6959..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayType.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Gateway type.
- * 
- * - * Protobuf enum {@code google.cloud.iot.v1.GatewayType} - */ -public enum GatewayType implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-   * If unspecified, the device is considered a non-gateway device.
-   * 
- * - * GATEWAY_TYPE_UNSPECIFIED = 0; - */ - GATEWAY_TYPE_UNSPECIFIED(0), - /** - * - * - *
-   * The device is a gateway.
-   * 
- * - * GATEWAY = 1; - */ - GATEWAY(1), - /** - * - * - *
-   * The device is not a gateway.
-   * 
- * - * NON_GATEWAY = 2; - */ - NON_GATEWAY(2), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-   * If unspecified, the device is considered a non-gateway device.
-   * 
- * - * GATEWAY_TYPE_UNSPECIFIED = 0; - */ - public static final int GATEWAY_TYPE_UNSPECIFIED_VALUE = 0; - /** - * - * - *
-   * The device is a gateway.
-   * 
- * - * GATEWAY = 1; - */ - public static final int GATEWAY_VALUE = 1; - /** - * - * - *
-   * The device is not a gateway.
-   * 
- * - * NON_GATEWAY = 2; - */ - public static final int NON_GATEWAY_VALUE = 2; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static GatewayType valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static GatewayType forNumber(int value) { - switch (value) { - case 0: - return GATEWAY_TYPE_UNSPECIFIED; - case 1: - return GATEWAY; - case 2: - return NON_GATEWAY; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public GatewayType findValueByNumber(int number) { - return GatewayType.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto.getDescriptor().getEnumTypes().get(3); - } - - private static final GatewayType[] VALUES = values(); - - public static GatewayType valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private GatewayType(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.cloud.iot.v1.GatewayType) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRegistryRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRegistryRequest.java deleted file mode 100644 index 6169b8c8..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRegistryRequest.java +++ /dev/null @@ -1,636 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `GetDeviceRegistry`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.GetDeviceRegistryRequest} - */ -public final class GetDeviceRegistryRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.GetDeviceRegistryRequest) - GetDeviceRegistryRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use GetDeviceRegistryRequest.newBuilder() to construct. - private GetDeviceRegistryRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private GetDeviceRegistryRequest() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new GetDeviceRegistryRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.GetDeviceRegistryRequest.class, - com.google.cloud.iot.v1.GetDeviceRegistryRequest.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * Required. The name of the device registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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 device registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.GetDeviceRegistryRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.GetDeviceRegistryRequest other = - (com.google.cloud.iot.v1.GetDeviceRegistryRequest) obj; - - if (!getName().equals(other.getName())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest 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.iot.v1.GetDeviceRegistryRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest 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.iot.v1.GetDeviceRegistryRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest 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.iot.v1.GetDeviceRegistryRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest 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.iot.v1.GetDeviceRegistryRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest 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.iot.v1.GetDeviceRegistryRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `GetDeviceRegistry`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.GetDeviceRegistryRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.GetDeviceRegistryRequest) - com.google.cloud.iot.v1.GetDeviceRegistryRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.GetDeviceRegistryRequest.class, - com.google.cloud.iot.v1.GetDeviceRegistryRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.GetDeviceRegistryRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GetDeviceRegistryRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.GetDeviceRegistryRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.GetDeviceRegistryRequest build() { - com.google.cloud.iot.v1.GetDeviceRegistryRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GetDeviceRegistryRequest buildPartial() { - com.google.cloud.iot.v1.GetDeviceRegistryRequest result = - new com.google.cloud.iot.v1.GetDeviceRegistryRequest(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.iot.v1.GetDeviceRegistryRequest) { - return mergeFrom((com.google.cloud.iot.v1.GetDeviceRegistryRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.GetDeviceRegistryRequest other) { - if (other == com.google.cloud.iot.v1.GetDeviceRegistryRequest.getDefaultInstance()) - return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * Required. The name of the device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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.iot.v1.GetDeviceRegistryRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.GetDeviceRegistryRequest) - private static final com.google.cloud.iot.v1.GetDeviceRegistryRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.GetDeviceRegistryRequest(); - } - - public static com.google.cloud.iot.v1.GetDeviceRegistryRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public GetDeviceRegistryRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GetDeviceRegistryRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRegistryRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRegistryRequestOrBuilder.java deleted file mode 100644 index 36c5a33a..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRegistryRequestOrBuilder.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface GetDeviceRegistryRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.GetDeviceRegistryRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * Required. The name of the device registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRequest.java deleted file mode 100644 index 6e497644..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRequest.java +++ /dev/null @@ -1,924 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `GetDevice`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.GetDeviceRequest} - */ -public final class GetDeviceRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.GetDeviceRequest) - GetDeviceRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use GetDeviceRequest.newBuilder() to construct. - private GetDeviceRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private GetDeviceRequest() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new GetDeviceRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.GetDeviceRequest.class, - com.google.cloud.iot.v1.GetDeviceRequest.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int FIELD_MASK_FIELD_NUMBER = 2; - private com.google.protobuf.FieldMask fieldMask_; - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. If the
-   * field mask is unset or empty, all fields are returned. Fields have to be
-   * provided in snake_case format, for example: `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 2; - * - * @return Whether the fieldMask field is set. - */ - @java.lang.Override - public boolean hasFieldMask() { - return fieldMask_ != null; - } - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. If the
-   * field mask is unset or empty, all fields are returned. Fields have to be
-   * provided in snake_case format, for example: `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 2; - * - * @return The fieldMask. - */ - @java.lang.Override - public com.google.protobuf.FieldMask getFieldMask() { - return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; - } - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. If the
-   * field mask is unset or empty, all fields are returned. Fields have to be
-   * provided in snake_case format, for example: `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - @java.lang.Override - public com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder() { - return getFieldMask(); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (fieldMask_ != null) { - output.writeMessage(2, getFieldMask()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (fieldMask_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getFieldMask()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.GetDeviceRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.GetDeviceRequest other = (com.google.cloud.iot.v1.GetDeviceRequest) obj; - - if (!getName().equals(other.getName())) return false; - if (hasFieldMask() != other.hasFieldMask()) return false; - if (hasFieldMask()) { - if (!getFieldMask().equals(other.getFieldMask())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - if (hasFieldMask()) { - hash = (37 * hash) + FIELD_MASK_FIELD_NUMBER; - hash = (53 * hash) + getFieldMask().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.GetDeviceRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GetDeviceRequest 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.iot.v1.GetDeviceRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GetDeviceRequest 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.iot.v1.GetDeviceRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.GetDeviceRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.GetDeviceRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GetDeviceRequest 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.iot.v1.GetDeviceRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GetDeviceRequest 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.iot.v1.GetDeviceRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.GetDeviceRequest 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.iot.v1.GetDeviceRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `GetDevice`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.GetDeviceRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.GetDeviceRequest) - com.google.cloud.iot.v1.GetDeviceRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.GetDeviceRequest.class, - com.google.cloud.iot.v1.GetDeviceRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.GetDeviceRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - if (fieldMaskBuilder_ == null) { - fieldMask_ = null; - } else { - fieldMask_ = null; - fieldMaskBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_GetDeviceRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GetDeviceRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.GetDeviceRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.GetDeviceRequest build() { - com.google.cloud.iot.v1.GetDeviceRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GetDeviceRequest buildPartial() { - com.google.cloud.iot.v1.GetDeviceRequest result = - new com.google.cloud.iot.v1.GetDeviceRequest(this); - result.name_ = name_; - if (fieldMaskBuilder_ == null) { - result.fieldMask_ = fieldMask_; - } else { - result.fieldMask_ = fieldMaskBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.GetDeviceRequest) { - return mergeFrom((com.google.cloud.iot.v1.GetDeviceRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.GetDeviceRequest other) { - if (other == com.google.cloud.iot.v1.GetDeviceRequest.getDefaultInstance()) return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (other.hasFieldMask()) { - mergeFieldMask(other.getFieldMask()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - input.readMessage(getFieldMaskFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private com.google.protobuf.FieldMask fieldMask_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder> - fieldMaskBuilder_; - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - * - * @return Whether the fieldMask field is set. - */ - public boolean hasFieldMask() { - return fieldMaskBuilder_ != null || fieldMask_ != null; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - * - * @return The fieldMask. - */ - public com.google.protobuf.FieldMask getFieldMask() { - if (fieldMaskBuilder_ == null) { - return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; - } else { - return fieldMaskBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - public Builder setFieldMask(com.google.protobuf.FieldMask value) { - if (fieldMaskBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - fieldMask_ = value; - onChanged(); - } else { - fieldMaskBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - public Builder setFieldMask(com.google.protobuf.FieldMask.Builder builderForValue) { - if (fieldMaskBuilder_ == null) { - fieldMask_ = builderForValue.build(); - onChanged(); - } else { - fieldMaskBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - public Builder mergeFieldMask(com.google.protobuf.FieldMask value) { - if (fieldMaskBuilder_ == null) { - if (fieldMask_ != null) { - fieldMask_ = - com.google.protobuf.FieldMask.newBuilder(fieldMask_).mergeFrom(value).buildPartial(); - } else { - fieldMask_ = value; - } - onChanged(); - } else { - fieldMaskBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - public Builder clearFieldMask() { - if (fieldMaskBuilder_ == null) { - fieldMask_ = null; - onChanged(); - } else { - fieldMask_ = null; - fieldMaskBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - public com.google.protobuf.FieldMask.Builder getFieldMaskBuilder() { - - onChanged(); - return getFieldMaskFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - public com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder() { - if (fieldMaskBuilder_ != null) { - return fieldMaskBuilder_.getMessageOrBuilder(); - } else { - return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; - } - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. If the
-     * field mask is unset or empty, all fields are returned. Fields have to be
-     * provided in snake_case format, for example: `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder> - getFieldMaskFieldBuilder() { - if (fieldMaskBuilder_ == null) { - fieldMaskBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder>( - getFieldMask(), getParentForChildren(), isClean()); - fieldMask_ = null; - } - return fieldMaskBuilder_; - } - - @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.iot.v1.GetDeviceRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.GetDeviceRequest) - private static final com.google.cloud.iot.v1.GetDeviceRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.GetDeviceRequest(); - } - - public static com.google.cloud.iot.v1.GetDeviceRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public GetDeviceRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.GetDeviceRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRequestOrBuilder.java deleted file mode 100644 index 424790a6..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRequestOrBuilder.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface GetDeviceRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.GetDeviceRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); - - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. If the
-   * field mask is unset or empty, all fields are returned. Fields have to be
-   * provided in snake_case format, for example: `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 2; - * - * @return Whether the fieldMask field is set. - */ - boolean hasFieldMask(); - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. If the
-   * field mask is unset or empty, all fields are returned. Fields have to be
-   * provided in snake_case format, for example: `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 2; - * - * @return The fieldMask. - */ - com.google.protobuf.FieldMask getFieldMask(); - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. If the
-   * field mask is unset or empty, all fields are returned. Fields have to be
-   * provided in snake_case format, for example: `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 2; - */ - com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpConfig.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpConfig.java deleted file mode 100644 index 3de1ec01..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpConfig.java +++ /dev/null @@ -1,589 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The configuration of the HTTP bridge for a device registry.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.HttpConfig} - */ -public final class HttpConfig extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.HttpConfig) - HttpConfigOrBuilder { - private static final long serialVersionUID = 0L; - // Use HttpConfig.newBuilder() to construct. - private HttpConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private HttpConfig() { - httpEnabledState_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new HttpConfig(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_HttpConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_HttpConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.HttpConfig.class, - com.google.cloud.iot.v1.HttpConfig.Builder.class); - } - - public static final int HTTP_ENABLED_STATE_FIELD_NUMBER = 1; - private int httpEnabledState_; - /** - * - * - *
-   * If enabled, allows devices to use DeviceService via the HTTP protocol.
-   * Otherwise, any requests to DeviceService will fail for this registry.
-   * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @return The enum numeric value on the wire for httpEnabledState. - */ - @java.lang.Override - public int getHttpEnabledStateValue() { - return httpEnabledState_; - } - /** - * - * - *
-   * If enabled, allows devices to use DeviceService via the HTTP protocol.
-   * Otherwise, any requests to DeviceService will fail for this registry.
-   * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @return The httpEnabledState. - */ - @java.lang.Override - public com.google.cloud.iot.v1.HttpState getHttpEnabledState() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.HttpState result = - com.google.cloud.iot.v1.HttpState.valueOf(httpEnabledState_); - return result == null ? com.google.cloud.iot.v1.HttpState.UNRECOGNIZED : result; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (httpEnabledState_ != com.google.cloud.iot.v1.HttpState.HTTP_STATE_UNSPECIFIED.getNumber()) { - output.writeEnum(1, httpEnabledState_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (httpEnabledState_ != com.google.cloud.iot.v1.HttpState.HTTP_STATE_UNSPECIFIED.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, httpEnabledState_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.HttpConfig)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.HttpConfig other = (com.google.cloud.iot.v1.HttpConfig) obj; - - if (httpEnabledState_ != other.httpEnabledState_) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + HTTP_ENABLED_STATE_FIELD_NUMBER; - hash = (53 * hash) + httpEnabledState_; - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.HttpConfig parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.HttpConfig 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.iot.v1.HttpConfig parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.HttpConfig 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.iot.v1.HttpConfig parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.HttpConfig parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.HttpConfig parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.HttpConfig 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.iot.v1.HttpConfig parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.HttpConfig 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.iot.v1.HttpConfig parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.HttpConfig 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.iot.v1.HttpConfig 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 configuration of the HTTP bridge for a device registry.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.HttpConfig} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.HttpConfig) - com.google.cloud.iot.v1.HttpConfigOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_HttpConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_HttpConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.HttpConfig.class, - com.google.cloud.iot.v1.HttpConfig.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.HttpConfig.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - httpEnabledState_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_HttpConfig_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.HttpConfig getDefaultInstanceForType() { - return com.google.cloud.iot.v1.HttpConfig.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.HttpConfig build() { - com.google.cloud.iot.v1.HttpConfig result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.HttpConfig buildPartial() { - com.google.cloud.iot.v1.HttpConfig result = new com.google.cloud.iot.v1.HttpConfig(this); - result.httpEnabledState_ = httpEnabledState_; - 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.iot.v1.HttpConfig) { - return mergeFrom((com.google.cloud.iot.v1.HttpConfig) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.HttpConfig other) { - if (other == com.google.cloud.iot.v1.HttpConfig.getDefaultInstance()) return this; - if (other.httpEnabledState_ != 0) { - setHttpEnabledStateValue(other.getHttpEnabledStateValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - httpEnabledState_ = input.readEnum(); - - break; - } // case 8 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int httpEnabledState_ = 0; - /** - * - * - *
-     * If enabled, allows devices to use DeviceService via the HTTP protocol.
-     * Otherwise, any requests to DeviceService will fail for this registry.
-     * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @return The enum numeric value on the wire for httpEnabledState. - */ - @java.lang.Override - public int getHttpEnabledStateValue() { - return httpEnabledState_; - } - /** - * - * - *
-     * If enabled, allows devices to use DeviceService via the HTTP protocol.
-     * Otherwise, any requests to DeviceService will fail for this registry.
-     * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @param value The enum numeric value on the wire for httpEnabledState to set. - * @return This builder for chaining. - */ - public Builder setHttpEnabledStateValue(int value) { - - httpEnabledState_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If enabled, allows devices to use DeviceService via the HTTP protocol.
-     * Otherwise, any requests to DeviceService will fail for this registry.
-     * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @return The httpEnabledState. - */ - @java.lang.Override - public com.google.cloud.iot.v1.HttpState getHttpEnabledState() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.HttpState result = - com.google.cloud.iot.v1.HttpState.valueOf(httpEnabledState_); - return result == null ? com.google.cloud.iot.v1.HttpState.UNRECOGNIZED : result; - } - /** - * - * - *
-     * If enabled, allows devices to use DeviceService via the HTTP protocol.
-     * Otherwise, any requests to DeviceService will fail for this registry.
-     * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @param value The httpEnabledState to set. - * @return This builder for chaining. - */ - public Builder setHttpEnabledState(com.google.cloud.iot.v1.HttpState value) { - if (value == null) { - throw new NullPointerException(); - } - - httpEnabledState_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * If enabled, allows devices to use DeviceService via the HTTP protocol.
-     * Otherwise, any requests to DeviceService will fail for this registry.
-     * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @return This builder for chaining. - */ - public Builder clearHttpEnabledState() { - - httpEnabledState_ = 0; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.HttpConfig) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.HttpConfig) - private static final com.google.cloud.iot.v1.HttpConfig DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.HttpConfig(); - } - - public static com.google.cloud.iot.v1.HttpConfig getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public HttpConfig parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.HttpConfig getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpConfigOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpConfigOrBuilder.java deleted file mode 100644 index 843fcde6..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpConfigOrBuilder.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface HttpConfigOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.HttpConfig) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * If enabled, allows devices to use DeviceService via the HTTP protocol.
-   * Otherwise, any requests to DeviceService will fail for this registry.
-   * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @return The enum numeric value on the wire for httpEnabledState. - */ - int getHttpEnabledStateValue(); - /** - * - * - *
-   * If enabled, allows devices to use DeviceService via the HTTP protocol.
-   * Otherwise, any requests to DeviceService will fail for this registry.
-   * 
- * - * .google.cloud.iot.v1.HttpState http_enabled_state = 1; - * - * @return The httpEnabledState. - */ - com.google.cloud.iot.v1.HttpState getHttpEnabledState(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpState.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpState.java deleted file mode 100644 index 10a5efb1..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpState.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Indicates whether DeviceService (HTTP) is enabled or disabled for the
- * registry. See the field description for details.
- * 
- * - * Protobuf enum {@code google.cloud.iot.v1.HttpState} - */ -public enum HttpState implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-   * No HTTP state specified. If not specified, DeviceService will be
-   * enabled by default.
-   * 
- * - * HTTP_STATE_UNSPECIFIED = 0; - */ - HTTP_STATE_UNSPECIFIED(0), - /** - * - * - *
-   * Enables DeviceService (HTTP) service for the registry.
-   * 
- * - * HTTP_ENABLED = 1; - */ - HTTP_ENABLED(1), - /** - * - * - *
-   * Disables DeviceService (HTTP) service for the registry.
-   * 
- * - * HTTP_DISABLED = 2; - */ - HTTP_DISABLED(2), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-   * No HTTP state specified. If not specified, DeviceService will be
-   * enabled by default.
-   * 
- * - * HTTP_STATE_UNSPECIFIED = 0; - */ - public static final int HTTP_STATE_UNSPECIFIED_VALUE = 0; - /** - * - * - *
-   * Enables DeviceService (HTTP) service for the registry.
-   * 
- * - * HTTP_ENABLED = 1; - */ - public static final int HTTP_ENABLED_VALUE = 1; - /** - * - * - *
-   * Disables DeviceService (HTTP) service for the registry.
-   * 
- * - * HTTP_DISABLED = 2; - */ - public static final int HTTP_DISABLED_VALUE = 2; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static HttpState valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static HttpState forNumber(int value) { - switch (value) { - case 0: - return HTTP_STATE_UNSPECIFIED; - case 1: - return HTTP_ENABLED; - case 2: - return HTTP_DISABLED; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public HttpState findValueByNumber(int number) { - return HttpState.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto.getDescriptor().getEnumTypes().get(1); - } - - private static final HttpState[] VALUES = values(); - - public static HttpState valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private HttpState(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.cloud.iot.v1.HttpState) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsRequest.java deleted file mode 100644 index aec376a1..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsRequest.java +++ /dev/null @@ -1,744 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `ListDeviceConfigVersions`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceConfigVersionsRequest} - */ -public final class ListDeviceConfigVersionsRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ListDeviceConfigVersionsRequest) - ListDeviceConfigVersionsRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use ListDeviceConfigVersionsRequest.newBuilder() to construct. - private ListDeviceConfigVersionsRequest( - com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ListDeviceConfigVersionsRequest() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListDeviceConfigVersionsRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest.class, - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int NUM_VERSIONS_FIELD_NUMBER = 2; - private int numVersions_; - /** - * - * - *
-   * The number of versions to list. Versions are listed in decreasing order of
-   * the version number. The maximum number of versions retained is 10. If this
-   * value is zero, it will return all the versions available.
-   * 
- * - * int32 num_versions = 2; - * - * @return The numVersions. - */ - @java.lang.Override - public int getNumVersions() { - return numVersions_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (numVersions_ != 0) { - output.writeInt32(2, numVersions_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (numVersions_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, numVersions_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest other = - (com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest) obj; - - if (!getName().equals(other.getName())) return false; - if (getNumVersions() != other.getNumVersions()) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + NUM_VERSIONS_FIELD_NUMBER; - hash = (53 * hash) + getNumVersions(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest 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.iot.v1.ListDeviceConfigVersionsRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest 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.iot.v1.ListDeviceConfigVersionsRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest 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.iot.v1.ListDeviceConfigVersionsRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest 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.iot.v1.ListDeviceConfigVersionsRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest 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.iot.v1.ListDeviceConfigVersionsRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `ListDeviceConfigVersions`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceConfigVersionsRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ListDeviceConfigVersionsRequest) - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest.class, - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - numVersions_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest build() { - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest buildPartial() { - com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest result = - new com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest(this); - result.name_ = name_; - result.numVersions_ = numVersions_; - 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.iot.v1.ListDeviceConfigVersionsRequest) { - return mergeFrom((com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest other) { - if (other == com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest.getDefaultInstance()) - return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (other.getNumVersions() != 0) { - setNumVersions(other.getNumVersions()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 16: - { - numVersions_ = input.readInt32(); - - break; - } // case 16 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private int numVersions_; - /** - * - * - *
-     * The number of versions to list. Versions are listed in decreasing order of
-     * the version number. The maximum number of versions retained is 10. If this
-     * value is zero, it will return all the versions available.
-     * 
- * - * int32 num_versions = 2; - * - * @return The numVersions. - */ - @java.lang.Override - public int getNumVersions() { - return numVersions_; - } - /** - * - * - *
-     * The number of versions to list. Versions are listed in decreasing order of
-     * the version number. The maximum number of versions retained is 10. If this
-     * value is zero, it will return all the versions available.
-     * 
- * - * int32 num_versions = 2; - * - * @param value The numVersions to set. - * @return This builder for chaining. - */ - public Builder setNumVersions(int value) { - - numVersions_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The number of versions to list. Versions are listed in decreasing order of
-     * the version number. The maximum number of versions retained is 10. If this
-     * value is zero, it will return all the versions available.
-     * 
- * - * int32 num_versions = 2; - * - * @return This builder for chaining. - */ - public Builder clearNumVersions() { - - numVersions_ = 0; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.ListDeviceConfigVersionsRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ListDeviceConfigVersionsRequest) - private static final com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest(); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ListDeviceConfigVersionsRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsRequestOrBuilder.java deleted file mode 100644 index ee1066be..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsRequestOrBuilder.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ListDeviceConfigVersionsRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ListDeviceConfigVersionsRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); - - /** - * - * - *
-   * The number of versions to list. Versions are listed in decreasing order of
-   * the version number. The maximum number of versions retained is 10. If this
-   * value is zero, it will return all the versions available.
-   * 
- * - * int32 num_versions = 2; - * - * @return The numVersions. - */ - int getNumVersions(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsResponse.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsResponse.java deleted file mode 100644 index 4efe80a6..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsResponse.java +++ /dev/null @@ -1,955 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Response for `ListDeviceConfigVersions`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceConfigVersionsResponse} - */ -public final class ListDeviceConfigVersionsResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ListDeviceConfigVersionsResponse) - ListDeviceConfigVersionsResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use ListDeviceConfigVersionsResponse.newBuilder() to construct. - private ListDeviceConfigVersionsResponse( - com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ListDeviceConfigVersionsResponse() { - deviceConfigs_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListDeviceConfigVersionsResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse.class, - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse.Builder.class); - } - - public static final int DEVICE_CONFIGS_FIELD_NUMBER = 1; - private java.util.List deviceConfigs_; - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - @java.lang.Override - public java.util.List getDeviceConfigsList() { - return deviceConfigs_; - } - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - @java.lang.Override - public java.util.List - getDeviceConfigsOrBuilderList() { - return deviceConfigs_; - } - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - @java.lang.Override - public int getDeviceConfigsCount() { - return deviceConfigs_.size(); - } - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceConfig getDeviceConfigs(int index) { - return deviceConfigs_.get(index); - } - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceConfigOrBuilder getDeviceConfigsOrBuilder(int index) { - return deviceConfigs_.get(index); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < deviceConfigs_.size(); i++) { - output.writeMessage(1, deviceConfigs_.get(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < deviceConfigs_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, deviceConfigs_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse other = - (com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse) obj; - - if (!getDeviceConfigsList().equals(other.getDeviceConfigsList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getDeviceConfigsCount() > 0) { - hash = (37 * hash) + DEVICE_CONFIGS_FIELD_NUMBER; - hash = (53 * hash) + getDeviceConfigsList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse 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.iot.v1.ListDeviceConfigVersionsResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse 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.iot.v1.ListDeviceConfigVersionsResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse 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.iot.v1.ListDeviceConfigVersionsResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse 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.iot.v1.ListDeviceConfigVersionsResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse 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.iot.v1.ListDeviceConfigVersionsResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Response for `ListDeviceConfigVersions`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceConfigVersionsResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ListDeviceConfigVersionsResponse) - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse.class, - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (deviceConfigsBuilder_ == null) { - deviceConfigs_ = java.util.Collections.emptyList(); - } else { - deviceConfigs_ = null; - deviceConfigsBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceConfigVersionsResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse build() { - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse buildPartial() { - com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse result = - new com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse(this); - int from_bitField0_ = bitField0_; - if (deviceConfigsBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - deviceConfigs_ = java.util.Collections.unmodifiableList(deviceConfigs_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.deviceConfigs_ = deviceConfigs_; - } else { - result.deviceConfigs_ = deviceConfigsBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse) { - return mergeFrom((com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse other) { - if (other == com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse.getDefaultInstance()) - return this; - if (deviceConfigsBuilder_ == null) { - if (!other.deviceConfigs_.isEmpty()) { - if (deviceConfigs_.isEmpty()) { - deviceConfigs_ = other.deviceConfigs_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureDeviceConfigsIsMutable(); - deviceConfigs_.addAll(other.deviceConfigs_); - } - onChanged(); - } - } else { - if (!other.deviceConfigs_.isEmpty()) { - if (deviceConfigsBuilder_.isEmpty()) { - deviceConfigsBuilder_.dispose(); - deviceConfigsBuilder_ = null; - deviceConfigs_ = other.deviceConfigs_; - bitField0_ = (bitField0_ & ~0x00000001); - deviceConfigsBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getDeviceConfigsFieldBuilder() - : null; - } else { - deviceConfigsBuilder_.addAllMessages(other.deviceConfigs_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.iot.v1.DeviceConfig m = - input.readMessage( - com.google.cloud.iot.v1.DeviceConfig.parser(), extensionRegistry); - if (deviceConfigsBuilder_ == null) { - ensureDeviceConfigsIsMutable(); - deviceConfigs_.add(m); - } else { - deviceConfigsBuilder_.addMessage(m); - } - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List deviceConfigs_ = - java.util.Collections.emptyList(); - - private void ensureDeviceConfigsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - deviceConfigs_ = - new java.util.ArrayList(deviceConfigs_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceConfig, - com.google.cloud.iot.v1.DeviceConfig.Builder, - com.google.cloud.iot.v1.DeviceConfigOrBuilder> - deviceConfigsBuilder_; - - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public java.util.List getDeviceConfigsList() { - if (deviceConfigsBuilder_ == null) { - return java.util.Collections.unmodifiableList(deviceConfigs_); - } else { - return deviceConfigsBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public int getDeviceConfigsCount() { - if (deviceConfigsBuilder_ == null) { - return deviceConfigs_.size(); - } else { - return deviceConfigsBuilder_.getCount(); - } - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public com.google.cloud.iot.v1.DeviceConfig getDeviceConfigs(int index) { - if (deviceConfigsBuilder_ == null) { - return deviceConfigs_.get(index); - } else { - return deviceConfigsBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder setDeviceConfigs(int index, com.google.cloud.iot.v1.DeviceConfig value) { - if (deviceConfigsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceConfigsIsMutable(); - deviceConfigs_.set(index, value); - onChanged(); - } else { - deviceConfigsBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder setDeviceConfigs( - int index, com.google.cloud.iot.v1.DeviceConfig.Builder builderForValue) { - if (deviceConfigsBuilder_ == null) { - ensureDeviceConfigsIsMutable(); - deviceConfigs_.set(index, builderForValue.build()); - onChanged(); - } else { - deviceConfigsBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder addDeviceConfigs(com.google.cloud.iot.v1.DeviceConfig value) { - if (deviceConfigsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceConfigsIsMutable(); - deviceConfigs_.add(value); - onChanged(); - } else { - deviceConfigsBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder addDeviceConfigs(int index, com.google.cloud.iot.v1.DeviceConfig value) { - if (deviceConfigsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceConfigsIsMutable(); - deviceConfigs_.add(index, value); - onChanged(); - } else { - deviceConfigsBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder addDeviceConfigs(com.google.cloud.iot.v1.DeviceConfig.Builder builderForValue) { - if (deviceConfigsBuilder_ == null) { - ensureDeviceConfigsIsMutable(); - deviceConfigs_.add(builderForValue.build()); - onChanged(); - } else { - deviceConfigsBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder addDeviceConfigs( - int index, com.google.cloud.iot.v1.DeviceConfig.Builder builderForValue) { - if (deviceConfigsBuilder_ == null) { - ensureDeviceConfigsIsMutable(); - deviceConfigs_.add(index, builderForValue.build()); - onChanged(); - } else { - deviceConfigsBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder addAllDeviceConfigs( - java.lang.Iterable values) { - if (deviceConfigsBuilder_ == null) { - ensureDeviceConfigsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deviceConfigs_); - onChanged(); - } else { - deviceConfigsBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder clearDeviceConfigs() { - if (deviceConfigsBuilder_ == null) { - deviceConfigs_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - deviceConfigsBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public Builder removeDeviceConfigs(int index) { - if (deviceConfigsBuilder_ == null) { - ensureDeviceConfigsIsMutable(); - deviceConfigs_.remove(index); - onChanged(); - } else { - deviceConfigsBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public com.google.cloud.iot.v1.DeviceConfig.Builder getDeviceConfigsBuilder(int index) { - return getDeviceConfigsFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public com.google.cloud.iot.v1.DeviceConfigOrBuilder getDeviceConfigsOrBuilder(int index) { - if (deviceConfigsBuilder_ == null) { - return deviceConfigs_.get(index); - } else { - return deviceConfigsBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public java.util.List - getDeviceConfigsOrBuilderList() { - if (deviceConfigsBuilder_ != null) { - return deviceConfigsBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(deviceConfigs_); - } - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public com.google.cloud.iot.v1.DeviceConfig.Builder addDeviceConfigsBuilder() { - return getDeviceConfigsFieldBuilder() - .addBuilder(com.google.cloud.iot.v1.DeviceConfig.getDefaultInstance()); - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public com.google.cloud.iot.v1.DeviceConfig.Builder addDeviceConfigsBuilder(int index) { - return getDeviceConfigsFieldBuilder() - .addBuilder(index, com.google.cloud.iot.v1.DeviceConfig.getDefaultInstance()); - } - /** - * - * - *
-     * The device configuration for the last few versions. Versions are listed
-     * in decreasing order, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - public java.util.List - getDeviceConfigsBuilderList() { - return getDeviceConfigsFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceConfig, - com.google.cloud.iot.v1.DeviceConfig.Builder, - com.google.cloud.iot.v1.DeviceConfigOrBuilder> - getDeviceConfigsFieldBuilder() { - if (deviceConfigsBuilder_ == null) { - deviceConfigsBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceConfig, - com.google.cloud.iot.v1.DeviceConfig.Builder, - com.google.cloud.iot.v1.DeviceConfigOrBuilder>( - deviceConfigs_, - ((bitField0_ & 0x00000001) != 0), - getParentForChildren(), - isClean()); - deviceConfigs_ = null; - } - return deviceConfigsBuilder_; - } - - @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.iot.v1.ListDeviceConfigVersionsResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ListDeviceConfigVersionsResponse) - private static final com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse(); - } - - public static com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ListDeviceConfigVersionsResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsResponseOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsResponseOrBuilder.java deleted file mode 100644 index 2784e68a..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsResponseOrBuilder.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ListDeviceConfigVersionsResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ListDeviceConfigVersionsResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - java.util.List getDeviceConfigsList(); - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - com.google.cloud.iot.v1.DeviceConfig getDeviceConfigs(int index); - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - int getDeviceConfigsCount(); - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - java.util.List - getDeviceConfigsOrBuilderList(); - /** - * - * - *
-   * The device configuration for the last few versions. Versions are listed
-   * in decreasing order, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceConfig device_configs = 1; - */ - com.google.cloud.iot.v1.DeviceConfigOrBuilder getDeviceConfigsOrBuilder(int index); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesRequest.java deleted file mode 100644 index 31ea44d5..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesRequest.java +++ /dev/null @@ -1,931 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `ListDeviceRegistries`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceRegistriesRequest} - */ -public final class ListDeviceRegistriesRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ListDeviceRegistriesRequest) - ListDeviceRegistriesRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use ListDeviceRegistriesRequest.newBuilder() to construct. - private ListDeviceRegistriesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ListDeviceRegistriesRequest() { - parent_ = ""; - pageToken_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListDeviceRegistriesRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceRegistriesRequest.class, - com.google.cloud.iot.v1.ListDeviceRegistriesRequest.Builder.class); - } - - public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; - /** - * - * - *
-   * Required. The project and cloud region path. For example,
-   * `projects/example-project/locations/us-central1`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - @java.lang.Override - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The project and cloud region path. For example,
-   * `projects/example-project/locations/us-central1`.
-   * 
- * - * - * 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 registries to return in the response. If this value
-   * is zero, the service will select a default size. A call may return fewer
-   * objects than requested. A non-empty `next_page_token` in the response
-   * indicates that more data is available.
-   * 
- * - * 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 value returned by the last `ListDeviceRegistriesResponse`; indicates
-   * that this is a continuation of a prior `ListDeviceRegistries` call and
-   * the system should return the next page of data.
-   * 
- * - * 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 value returned by the last `ListDeviceRegistriesResponse`; indicates
-   * that this is a continuation of a prior `ListDeviceRegistries` call and
-   * the system should return the next page of data.
-   * 
- * - * 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; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); - } - if (pageSize_ != 0) { - output.writeInt32(2, pageSize_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); - } - if (pageSize_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ListDeviceRegistriesRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ListDeviceRegistriesRequest other = - (com.google.cloud.iot.v1.ListDeviceRegistriesRequest) obj; - - if (!getParent().equals(other.getParent())) return false; - if (getPageSize() != other.getPageSize()) return false; - if (!getPageToken().equals(other.getPageToken())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + PARENT_FIELD_NUMBER; - hash = (53 * hash) + getParent().hashCode(); - hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; - hash = (53 * hash) + getPageSize(); - hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; - hash = (53 * hash) + getPageToken().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest 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.iot.v1.ListDeviceRegistriesRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest 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.iot.v1.ListDeviceRegistriesRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest 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.iot.v1.ListDeviceRegistriesRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest 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.iot.v1.ListDeviceRegistriesRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest 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.iot.v1.ListDeviceRegistriesRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `ListDeviceRegistries`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceRegistriesRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ListDeviceRegistriesRequest) - com.google.cloud.iot.v1.ListDeviceRegistriesRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceRegistriesRequest.class, - com.google.cloud.iot.v1.ListDeviceRegistriesRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ListDeviceRegistriesRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - parent_ = ""; - - pageSize_ = 0; - - pageToken_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceRegistriesRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ListDeviceRegistriesRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceRegistriesRequest build() { - com.google.cloud.iot.v1.ListDeviceRegistriesRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceRegistriesRequest buildPartial() { - com.google.cloud.iot.v1.ListDeviceRegistriesRequest result = - new com.google.cloud.iot.v1.ListDeviceRegistriesRequest(this); - result.parent_ = parent_; - result.pageSize_ = pageSize_; - result.pageToken_ = pageToken_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.ListDeviceRegistriesRequest) { - return mergeFrom((com.google.cloud.iot.v1.ListDeviceRegistriesRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ListDeviceRegistriesRequest other) { - if (other == com.google.cloud.iot.v1.ListDeviceRegistriesRequest.getDefaultInstance()) - return this; - if (!other.getParent().isEmpty()) { - parent_ = other.parent_; - onChanged(); - } - if (other.getPageSize() != 0) { - setPageSize(other.getPageSize()); - } - if (!other.getPageToken().isEmpty()) { - pageToken_ = other.pageToken_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - parent_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 16: - { - pageSize_ = input.readInt32(); - - break; - } // case 16 - case 26: - { - pageToken_ = input.readStringRequireUtf8(); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object parent_ = ""; - /** - * - * - *
-     * Required. The project and cloud region path. For example,
-     * `projects/example-project/locations/us-central1`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The project and cloud region path. For example,
-     * `projects/example-project/locations/us-central1`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - public com.google.protobuf.ByteString getParentBytes() { - java.lang.Object ref = parent_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - parent_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The project and cloud region path. For example,
-     * `projects/example-project/locations/us-central1`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The parent to set. - * @return This builder for chaining. - */ - public Builder setParent(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - parent_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The project and cloud region path. For example,
-     * `projects/example-project/locations/us-central1`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearParent() { - - parent_ = getDefaultInstance().getParent(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The project and cloud region path. For example,
-     * `projects/example-project/locations/us-central1`.
-     * 
- * - * - * 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 registries to return in the response. If this value
-     * is zero, the service will select a default size. A call may return fewer
-     * objects than requested. A non-empty `next_page_token` in the response
-     * indicates that more data is available.
-     * 
- * - * int32 page_size = 2; - * - * @return The pageSize. - */ - @java.lang.Override - public int getPageSize() { - return pageSize_; - } - /** - * - * - *
-     * The maximum number of registries to return in the response. If this value
-     * is zero, the service will select a default size. A call may return fewer
-     * objects than requested. A non-empty `next_page_token` in the response
-     * indicates that more data is available.
-     * 
- * - * 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 registries to return in the response. If this value
-     * is zero, the service will select a default size. A call may return fewer
-     * objects than requested. A non-empty `next_page_token` in the response
-     * indicates that more data is available.
-     * 
- * - * int32 page_size = 2; - * - * @return This builder for chaining. - */ - public Builder clearPageSize() { - - pageSize_ = 0; - onChanged(); - return this; - } - - private java.lang.Object pageToken_ = ""; - /** - * - * - *
-     * The value returned by the last `ListDeviceRegistriesResponse`; indicates
-     * that this is a continuation of a prior `ListDeviceRegistries` call and
-     * the system should return the next page of data.
-     * 
- * - * 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 value returned by the last `ListDeviceRegistriesResponse`; indicates
-     * that this is a continuation of a prior `ListDeviceRegistries` call and
-     * the system should return the next page of data.
-     * 
- * - * 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 value returned by the last `ListDeviceRegistriesResponse`; indicates
-     * that this is a continuation of a prior `ListDeviceRegistries` call and
-     * the system should return the next page of data.
-     * 
- * - * 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 value returned by the last `ListDeviceRegistriesResponse`; indicates
-     * that this is a continuation of a prior `ListDeviceRegistries` call and
-     * the system should return the next page of data.
-     * 
- * - * string page_token = 3; - * - * @return This builder for chaining. - */ - public Builder clearPageToken() { - - pageToken_ = getDefaultInstance().getPageToken(); - onChanged(); - return this; - } - /** - * - * - *
-     * The value returned by the last `ListDeviceRegistriesResponse`; indicates
-     * that this is a continuation of a prior `ListDeviceRegistries` call and
-     * the system should return the next page of data.
-     * 
- * - * 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; - } - - @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.iot.v1.ListDeviceRegistriesRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ListDeviceRegistriesRequest) - private static final com.google.cloud.iot.v1.ListDeviceRegistriesRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ListDeviceRegistriesRequest(); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ListDeviceRegistriesRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceRegistriesRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesRequestOrBuilder.java deleted file mode 100644 index df99ea40..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesRequestOrBuilder.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ListDeviceRegistriesRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ListDeviceRegistriesRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The project and cloud region path. For example,
-   * `projects/example-project/locations/us-central1`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - java.lang.String getParent(); - /** - * - * - *
-   * Required. The project and cloud region path. For example,
-   * `projects/example-project/locations/us-central1`.
-   * 
- * - * - * 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 registries to return in the response. If this value
-   * is zero, the service will select a default size. A call may return fewer
-   * objects than requested. A non-empty `next_page_token` in the response
-   * indicates that more data is available.
-   * 
- * - * int32 page_size = 2; - * - * @return The pageSize. - */ - int getPageSize(); - - /** - * - * - *
-   * The value returned by the last `ListDeviceRegistriesResponse`; indicates
-   * that this is a continuation of a prior `ListDeviceRegistries` call and
-   * the system should return the next page of data.
-   * 
- * - * string page_token = 3; - * - * @return The pageToken. - */ - java.lang.String getPageToken(); - /** - * - * - *
-   * The value returned by the last `ListDeviceRegistriesResponse`; indicates
-   * that this is a continuation of a prior `ListDeviceRegistries` call and
-   * the system should return the next page of data.
-   * 
- * - * string page_token = 3; - * - * @return The bytes for pageToken. - */ - com.google.protobuf.ByteString getPageTokenBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesResponse.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesResponse.java deleted file mode 100644 index 92235673..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesResponse.java +++ /dev/null @@ -1,1123 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Response for `ListDeviceRegistries`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceRegistriesResponse} - */ -public final class ListDeviceRegistriesResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ListDeviceRegistriesResponse) - ListDeviceRegistriesResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use ListDeviceRegistriesResponse.newBuilder() to construct. - private ListDeviceRegistriesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ListDeviceRegistriesResponse() { - deviceRegistries_ = java.util.Collections.emptyList(); - nextPageToken_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListDeviceRegistriesResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceRegistriesResponse.class, - com.google.cloud.iot.v1.ListDeviceRegistriesResponse.Builder.class); - } - - public static final int DEVICE_REGISTRIES_FIELD_NUMBER = 1; - private java.util.List deviceRegistries_; - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - @java.lang.Override - public java.util.List getDeviceRegistriesList() { - return deviceRegistries_; - } - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - @java.lang.Override - public java.util.List - getDeviceRegistriesOrBuilderList() { - return deviceRegistries_; - } - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - @java.lang.Override - public int getDeviceRegistriesCount() { - return deviceRegistries_.size(); - } - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistries(int index) { - return deviceRegistries_.get(index); - } - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistriesOrBuilder(int index) { - return deviceRegistries_.get(index); - } - - public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; - private volatile java.lang.Object nextPageToken_; - /** - * - * - *
-   * If not empty, indicates that there may be more registries that match the
-   * request; this value should be passed in a new
-   * `ListDeviceRegistriesRequest`.
-   * 
- * - * string next_page_token = 2; - * - * @return The nextPageToken. - */ - @java.lang.Override - public java.lang.String getNextPageToken() { - java.lang.Object ref = nextPageToken_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - nextPageToken_ = s; - return s; - } - } - /** - * - * - *
-   * If not empty, indicates that there may be more registries that match the
-   * request; this value should be passed in a new
-   * `ListDeviceRegistriesRequest`.
-   * 
- * - * string next_page_token = 2; - * - * @return The bytes for nextPageToken. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNextPageTokenBytes() { - java.lang.Object ref = nextPageToken_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - nextPageToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < deviceRegistries_.size(); i++) { - output.writeMessage(1, deviceRegistries_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < deviceRegistries_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, deviceRegistries_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ListDeviceRegistriesResponse)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ListDeviceRegistriesResponse other = - (com.google.cloud.iot.v1.ListDeviceRegistriesResponse) obj; - - if (!getDeviceRegistriesList().equals(other.getDeviceRegistriesList())) return false; - if (!getNextPageToken().equals(other.getNextPageToken())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getDeviceRegistriesCount() > 0) { - hash = (37 * hash) + DEVICE_REGISTRIES_FIELD_NUMBER; - hash = (53 * hash) + getDeviceRegistriesList().hashCode(); - } - hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; - hash = (53 * hash) + getNextPageToken().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse 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.iot.v1.ListDeviceRegistriesResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse 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.iot.v1.ListDeviceRegistriesResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse 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.iot.v1.ListDeviceRegistriesResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse 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.iot.v1.ListDeviceRegistriesResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse 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.iot.v1.ListDeviceRegistriesResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Response for `ListDeviceRegistries`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceRegistriesResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ListDeviceRegistriesResponse) - com.google.cloud.iot.v1.ListDeviceRegistriesResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceRegistriesResponse.class, - com.google.cloud.iot.v1.ListDeviceRegistriesResponse.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ListDeviceRegistriesResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (deviceRegistriesBuilder_ == null) { - deviceRegistries_ = java.util.Collections.emptyList(); - } else { - deviceRegistries_ = null; - deviceRegistriesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - nextPageToken_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceRegistriesResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceRegistriesResponse getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ListDeviceRegistriesResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceRegistriesResponse build() { - com.google.cloud.iot.v1.ListDeviceRegistriesResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceRegistriesResponse buildPartial() { - com.google.cloud.iot.v1.ListDeviceRegistriesResponse result = - new com.google.cloud.iot.v1.ListDeviceRegistriesResponse(this); - int from_bitField0_ = bitField0_; - if (deviceRegistriesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - deviceRegistries_ = java.util.Collections.unmodifiableList(deviceRegistries_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.deviceRegistries_ = deviceRegistries_; - } else { - result.deviceRegistries_ = deviceRegistriesBuilder_.build(); - } - result.nextPageToken_ = nextPageToken_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.ListDeviceRegistriesResponse) { - return mergeFrom((com.google.cloud.iot.v1.ListDeviceRegistriesResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ListDeviceRegistriesResponse other) { - if (other == com.google.cloud.iot.v1.ListDeviceRegistriesResponse.getDefaultInstance()) - return this; - if (deviceRegistriesBuilder_ == null) { - if (!other.deviceRegistries_.isEmpty()) { - if (deviceRegistries_.isEmpty()) { - deviceRegistries_ = other.deviceRegistries_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.addAll(other.deviceRegistries_); - } - onChanged(); - } - } else { - if (!other.deviceRegistries_.isEmpty()) { - if (deviceRegistriesBuilder_.isEmpty()) { - deviceRegistriesBuilder_.dispose(); - deviceRegistriesBuilder_ = null; - deviceRegistries_ = other.deviceRegistries_; - bitField0_ = (bitField0_ & ~0x00000001); - deviceRegistriesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getDeviceRegistriesFieldBuilder() - : null; - } else { - deviceRegistriesBuilder_.addAllMessages(other.deviceRegistries_); - } - } - } - if (!other.getNextPageToken().isEmpty()) { - nextPageToken_ = other.nextPageToken_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.iot.v1.DeviceRegistry m = - input.readMessage( - com.google.cloud.iot.v1.DeviceRegistry.parser(), extensionRegistry); - if (deviceRegistriesBuilder_ == null) { - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.add(m); - } else { - deviceRegistriesBuilder_.addMessage(m); - } - break; - } // case 10 - case 18: - { - nextPageToken_ = input.readStringRequireUtf8(); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List deviceRegistries_ = - java.util.Collections.emptyList(); - - private void ensureDeviceRegistriesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - deviceRegistries_ = - new java.util.ArrayList(deviceRegistries_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder> - deviceRegistriesBuilder_; - - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public java.util.List getDeviceRegistriesList() { - if (deviceRegistriesBuilder_ == null) { - return java.util.Collections.unmodifiableList(deviceRegistries_); - } else { - return deviceRegistriesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public int getDeviceRegistriesCount() { - if (deviceRegistriesBuilder_ == null) { - return deviceRegistries_.size(); - } else { - return deviceRegistriesBuilder_.getCount(); - } - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistries(int index) { - if (deviceRegistriesBuilder_ == null) { - return deviceRegistries_.get(index); - } else { - return deviceRegistriesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder setDeviceRegistries(int index, com.google.cloud.iot.v1.DeviceRegistry value) { - if (deviceRegistriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.set(index, value); - onChanged(); - } else { - deviceRegistriesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder setDeviceRegistries( - int index, com.google.cloud.iot.v1.DeviceRegistry.Builder builderForValue) { - if (deviceRegistriesBuilder_ == null) { - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.set(index, builderForValue.build()); - onChanged(); - } else { - deviceRegistriesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder addDeviceRegistries(com.google.cloud.iot.v1.DeviceRegistry value) { - if (deviceRegistriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.add(value); - onChanged(); - } else { - deviceRegistriesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder addDeviceRegistries(int index, com.google.cloud.iot.v1.DeviceRegistry value) { - if (deviceRegistriesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.add(index, value); - onChanged(); - } else { - deviceRegistriesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder addDeviceRegistries( - com.google.cloud.iot.v1.DeviceRegistry.Builder builderForValue) { - if (deviceRegistriesBuilder_ == null) { - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.add(builderForValue.build()); - onChanged(); - } else { - deviceRegistriesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder addDeviceRegistries( - int index, com.google.cloud.iot.v1.DeviceRegistry.Builder builderForValue) { - if (deviceRegistriesBuilder_ == null) { - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.add(index, builderForValue.build()); - onChanged(); - } else { - deviceRegistriesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder addAllDeviceRegistries( - java.lang.Iterable values) { - if (deviceRegistriesBuilder_ == null) { - ensureDeviceRegistriesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deviceRegistries_); - onChanged(); - } else { - deviceRegistriesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder clearDeviceRegistries() { - if (deviceRegistriesBuilder_ == null) { - deviceRegistries_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - deviceRegistriesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public Builder removeDeviceRegistries(int index) { - if (deviceRegistriesBuilder_ == null) { - ensureDeviceRegistriesIsMutable(); - deviceRegistries_.remove(index); - onChanged(); - } else { - deviceRegistriesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public com.google.cloud.iot.v1.DeviceRegistry.Builder getDeviceRegistriesBuilder(int index) { - return getDeviceRegistriesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistriesOrBuilder(int index) { - if (deviceRegistriesBuilder_ == null) { - return deviceRegistries_.get(index); - } else { - return deviceRegistriesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public java.util.List - getDeviceRegistriesOrBuilderList() { - if (deviceRegistriesBuilder_ != null) { - return deviceRegistriesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(deviceRegistries_); - } - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public com.google.cloud.iot.v1.DeviceRegistry.Builder addDeviceRegistriesBuilder() { - return getDeviceRegistriesFieldBuilder() - .addBuilder(com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance()); - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public com.google.cloud.iot.v1.DeviceRegistry.Builder addDeviceRegistriesBuilder(int index) { - return getDeviceRegistriesFieldBuilder() - .addBuilder(index, com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance()); - } - /** - * - * - *
-     * The registries that matched the query.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - public java.util.List - getDeviceRegistriesBuilderList() { - return getDeviceRegistriesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder> - getDeviceRegistriesFieldBuilder() { - if (deviceRegistriesBuilder_ == null) { - deviceRegistriesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder>( - deviceRegistries_, - ((bitField0_ & 0x00000001) != 0), - getParentForChildren(), - isClean()); - deviceRegistries_ = null; - } - return deviceRegistriesBuilder_; - } - - private java.lang.Object nextPageToken_ = ""; - /** - * - * - *
-     * If not empty, indicates that there may be more registries that match the
-     * request; this value should be passed in a new
-     * `ListDeviceRegistriesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @return The nextPageToken. - */ - public java.lang.String getNextPageToken() { - java.lang.Object ref = nextPageToken_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - nextPageToken_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * If not empty, indicates that there may be more registries that match the
-     * request; this value should be passed in a new
-     * `ListDeviceRegistriesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @return The bytes for nextPageToken. - */ - public com.google.protobuf.ByteString getNextPageTokenBytes() { - java.lang.Object ref = nextPageToken_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - nextPageToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * If not empty, indicates that there may be more registries that match the
-     * request; this value should be passed in a new
-     * `ListDeviceRegistriesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @param value The nextPageToken to set. - * @return This builder for chaining. - */ - public Builder setNextPageToken(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - nextPageToken_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If not empty, indicates that there may be more registries that match the
-     * request; this value should be passed in a new
-     * `ListDeviceRegistriesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @return This builder for chaining. - */ - public Builder clearNextPageToken() { - - nextPageToken_ = getDefaultInstance().getNextPageToken(); - onChanged(); - return this; - } - /** - * - * - *
-     * If not empty, indicates that there may be more registries that match the
-     * request; this value should be passed in a new
-     * `ListDeviceRegistriesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @param value The bytes for nextPageToken to set. - * @return This builder for chaining. - */ - public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - nextPageToken_ = value; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.ListDeviceRegistriesResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ListDeviceRegistriesResponse) - private static final com.google.cloud.iot.v1.ListDeviceRegistriesResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ListDeviceRegistriesResponse(); - } - - public static com.google.cloud.iot.v1.ListDeviceRegistriesResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ListDeviceRegistriesResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceRegistriesResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesResponseOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesResponseOrBuilder.java deleted file mode 100644 index 769fcc29..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesResponseOrBuilder.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ListDeviceRegistriesResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ListDeviceRegistriesResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - java.util.List getDeviceRegistriesList(); - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistries(int index); - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - int getDeviceRegistriesCount(); - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - java.util.List - getDeviceRegistriesOrBuilderList(); - /** - * - * - *
-   * The registries that matched the query.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceRegistry device_registries = 1; - */ - com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistriesOrBuilder(int index); - - /** - * - * - *
-   * If not empty, indicates that there may be more registries that match the
-   * request; this value should be passed in a new
-   * `ListDeviceRegistriesRequest`.
-   * 
- * - * string next_page_token = 2; - * - * @return The nextPageToken. - */ - java.lang.String getNextPageToken(); - /** - * - * - *
-   * If not empty, indicates that there may be more registries that match the
-   * request; this value should be passed in a new
-   * `ListDeviceRegistriesRequest`.
-   * 
- * - * string next_page_token = 2; - * - * @return The bytes for nextPageToken. - */ - com.google.protobuf.ByteString getNextPageTokenBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesRequest.java deleted file mode 100644 index 99c59c1d..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesRequest.java +++ /dev/null @@ -1,742 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `ListDeviceStates`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceStatesRequest} - */ -public final class ListDeviceStatesRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ListDeviceStatesRequest) - ListDeviceStatesRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use ListDeviceStatesRequest.newBuilder() to construct. - private ListDeviceStatesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ListDeviceStatesRequest() { - name_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListDeviceStatesRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceStatesRequest.class, - com.google.cloud.iot.v1.ListDeviceStatesRequest.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int NUM_STATES_FIELD_NUMBER = 2; - private int numStates_; - /** - * - * - *
-   * The number of states to list. States are listed in descending order of
-   * update time. The maximum number of states retained is 10. If this
-   * value is zero, it will return all the states available.
-   * 
- * - * int32 num_states = 2; - * - * @return The numStates. - */ - @java.lang.Override - public int getNumStates() { - return numStates_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (numStates_ != 0) { - output.writeInt32(2, numStates_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (numStates_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, numStates_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ListDeviceStatesRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ListDeviceStatesRequest other = - (com.google.cloud.iot.v1.ListDeviceStatesRequest) obj; - - if (!getName().equals(other.getName())) return false; - if (getNumStates() != other.getNumStates()) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + NUM_STATES_FIELD_NUMBER; - hash = (53 * hash) + getNumStates(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest 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.iot.v1.ListDeviceStatesRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest 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.iot.v1.ListDeviceStatesRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest 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.iot.v1.ListDeviceStatesRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest 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.iot.v1.ListDeviceStatesRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest 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.iot.v1.ListDeviceStatesRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `ListDeviceStates`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceStatesRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ListDeviceStatesRequest) - com.google.cloud.iot.v1.ListDeviceStatesRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceStatesRequest.class, - com.google.cloud.iot.v1.ListDeviceStatesRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ListDeviceStatesRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - numStates_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceStatesRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ListDeviceStatesRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceStatesRequest build() { - com.google.cloud.iot.v1.ListDeviceStatesRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceStatesRequest buildPartial() { - com.google.cloud.iot.v1.ListDeviceStatesRequest result = - new com.google.cloud.iot.v1.ListDeviceStatesRequest(this); - result.name_ = name_; - result.numStates_ = numStates_; - 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.iot.v1.ListDeviceStatesRequest) { - return mergeFrom((com.google.cloud.iot.v1.ListDeviceStatesRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ListDeviceStatesRequest other) { - if (other == com.google.cloud.iot.v1.ListDeviceStatesRequest.getDefaultInstance()) - return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (other.getNumStates() != 0) { - setNumStates(other.getNumStates()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 16: - { - numStates_ = input.readInt32(); - - break; - } // case 16 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private int numStates_; - /** - * - * - *
-     * The number of states to list. States are listed in descending order of
-     * update time. The maximum number of states retained is 10. If this
-     * value is zero, it will return all the states available.
-     * 
- * - * int32 num_states = 2; - * - * @return The numStates. - */ - @java.lang.Override - public int getNumStates() { - return numStates_; - } - /** - * - * - *
-     * The number of states to list. States are listed in descending order of
-     * update time. The maximum number of states retained is 10. If this
-     * value is zero, it will return all the states available.
-     * 
- * - * int32 num_states = 2; - * - * @param value The numStates to set. - * @return This builder for chaining. - */ - public Builder setNumStates(int value) { - - numStates_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The number of states to list. States are listed in descending order of
-     * update time. The maximum number of states retained is 10. If this
-     * value is zero, it will return all the states available.
-     * 
- * - * int32 num_states = 2; - * - * @return This builder for chaining. - */ - public Builder clearNumStates() { - - numStates_ = 0; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.ListDeviceStatesRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ListDeviceStatesRequest) - private static final com.google.cloud.iot.v1.ListDeviceStatesRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ListDeviceStatesRequest(); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ListDeviceStatesRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceStatesRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesRequestOrBuilder.java deleted file mode 100644 index dd4137a8..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesRequestOrBuilder.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ListDeviceStatesRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ListDeviceStatesRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); - - /** - * - * - *
-   * The number of states to list. States are listed in descending order of
-   * update time. The maximum number of states retained is 10. If this
-   * value is zero, it will return all the states available.
-   * 
- * - * int32 num_states = 2; - * - * @return The numStates. - */ - int getNumStates(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesResponse.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesResponse.java deleted file mode 100644 index 522b6fe5..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesResponse.java +++ /dev/null @@ -1,949 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Response for `ListDeviceStates`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceStatesResponse} - */ -public final class ListDeviceStatesResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ListDeviceStatesResponse) - ListDeviceStatesResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use ListDeviceStatesResponse.newBuilder() to construct. - private ListDeviceStatesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ListDeviceStatesResponse() { - deviceStates_ = java.util.Collections.emptyList(); - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListDeviceStatesResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceStatesResponse.class, - com.google.cloud.iot.v1.ListDeviceStatesResponse.Builder.class); - } - - public static final int DEVICE_STATES_FIELD_NUMBER = 1; - private java.util.List deviceStates_; - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - @java.lang.Override - public java.util.List getDeviceStatesList() { - return deviceStates_; - } - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - @java.lang.Override - public java.util.List - getDeviceStatesOrBuilderList() { - return deviceStates_; - } - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - @java.lang.Override - public int getDeviceStatesCount() { - return deviceStates_.size(); - } - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceState getDeviceStates(int index) { - return deviceStates_.get(index); - } - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceStateOrBuilder getDeviceStatesOrBuilder(int index) { - return deviceStates_.get(index); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < deviceStates_.size(); i++) { - output.writeMessage(1, deviceStates_.get(i)); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < deviceStates_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, deviceStates_.get(i)); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ListDeviceStatesResponse)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ListDeviceStatesResponse other = - (com.google.cloud.iot.v1.ListDeviceStatesResponse) obj; - - if (!getDeviceStatesList().equals(other.getDeviceStatesList())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getDeviceStatesCount() > 0) { - hash = (37 * hash) + DEVICE_STATES_FIELD_NUMBER; - hash = (53 * hash) + getDeviceStatesList().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse 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.iot.v1.ListDeviceStatesResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse 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.iot.v1.ListDeviceStatesResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse 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.iot.v1.ListDeviceStatesResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse 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.iot.v1.ListDeviceStatesResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse 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.iot.v1.ListDeviceStatesResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Response for `ListDeviceStates`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDeviceStatesResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ListDeviceStatesResponse) - com.google.cloud.iot.v1.ListDeviceStatesResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDeviceStatesResponse.class, - com.google.cloud.iot.v1.ListDeviceStatesResponse.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ListDeviceStatesResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (deviceStatesBuilder_ == null) { - deviceStates_ = java.util.Collections.emptyList(); - } else { - deviceStates_ = null; - deviceStatesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDeviceStatesResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceStatesResponse getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ListDeviceStatesResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceStatesResponse build() { - com.google.cloud.iot.v1.ListDeviceStatesResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceStatesResponse buildPartial() { - com.google.cloud.iot.v1.ListDeviceStatesResponse result = - new com.google.cloud.iot.v1.ListDeviceStatesResponse(this); - int from_bitField0_ = bitField0_; - if (deviceStatesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - deviceStates_ = java.util.Collections.unmodifiableList(deviceStates_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.deviceStates_ = deviceStates_; - } else { - result.deviceStates_ = deviceStatesBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.ListDeviceStatesResponse) { - return mergeFrom((com.google.cloud.iot.v1.ListDeviceStatesResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ListDeviceStatesResponse other) { - if (other == com.google.cloud.iot.v1.ListDeviceStatesResponse.getDefaultInstance()) - return this; - if (deviceStatesBuilder_ == null) { - if (!other.deviceStates_.isEmpty()) { - if (deviceStates_.isEmpty()) { - deviceStates_ = other.deviceStates_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureDeviceStatesIsMutable(); - deviceStates_.addAll(other.deviceStates_); - } - onChanged(); - } - } else { - if (!other.deviceStates_.isEmpty()) { - if (deviceStatesBuilder_.isEmpty()) { - deviceStatesBuilder_.dispose(); - deviceStatesBuilder_ = null; - deviceStates_ = other.deviceStates_; - bitField0_ = (bitField0_ & ~0x00000001); - deviceStatesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getDeviceStatesFieldBuilder() - : null; - } else { - deviceStatesBuilder_.addAllMessages(other.deviceStates_); - } - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.iot.v1.DeviceState m = - input.readMessage( - com.google.cloud.iot.v1.DeviceState.parser(), extensionRegistry); - if (deviceStatesBuilder_ == null) { - ensureDeviceStatesIsMutable(); - deviceStates_.add(m); - } else { - deviceStatesBuilder_.addMessage(m); - } - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List deviceStates_ = - java.util.Collections.emptyList(); - - private void ensureDeviceStatesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - deviceStates_ = new java.util.ArrayList(deviceStates_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceState, - com.google.cloud.iot.v1.DeviceState.Builder, - com.google.cloud.iot.v1.DeviceStateOrBuilder> - deviceStatesBuilder_; - - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public java.util.List getDeviceStatesList() { - if (deviceStatesBuilder_ == null) { - return java.util.Collections.unmodifiableList(deviceStates_); - } else { - return deviceStatesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public int getDeviceStatesCount() { - if (deviceStatesBuilder_ == null) { - return deviceStates_.size(); - } else { - return deviceStatesBuilder_.getCount(); - } - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public com.google.cloud.iot.v1.DeviceState getDeviceStates(int index) { - if (deviceStatesBuilder_ == null) { - return deviceStates_.get(index); - } else { - return deviceStatesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder setDeviceStates(int index, com.google.cloud.iot.v1.DeviceState value) { - if (deviceStatesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceStatesIsMutable(); - deviceStates_.set(index, value); - onChanged(); - } else { - deviceStatesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder setDeviceStates( - int index, com.google.cloud.iot.v1.DeviceState.Builder builderForValue) { - if (deviceStatesBuilder_ == null) { - ensureDeviceStatesIsMutable(); - deviceStates_.set(index, builderForValue.build()); - onChanged(); - } else { - deviceStatesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder addDeviceStates(com.google.cloud.iot.v1.DeviceState value) { - if (deviceStatesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceStatesIsMutable(); - deviceStates_.add(value); - onChanged(); - } else { - deviceStatesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder addDeviceStates(int index, com.google.cloud.iot.v1.DeviceState value) { - if (deviceStatesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceStatesIsMutable(); - deviceStates_.add(index, value); - onChanged(); - } else { - deviceStatesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder addDeviceStates(com.google.cloud.iot.v1.DeviceState.Builder builderForValue) { - if (deviceStatesBuilder_ == null) { - ensureDeviceStatesIsMutable(); - deviceStates_.add(builderForValue.build()); - onChanged(); - } else { - deviceStatesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder addDeviceStates( - int index, com.google.cloud.iot.v1.DeviceState.Builder builderForValue) { - if (deviceStatesBuilder_ == null) { - ensureDeviceStatesIsMutable(); - deviceStates_.add(index, builderForValue.build()); - onChanged(); - } else { - deviceStatesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder addAllDeviceStates( - java.lang.Iterable values) { - if (deviceStatesBuilder_ == null) { - ensureDeviceStatesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deviceStates_); - onChanged(); - } else { - deviceStatesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder clearDeviceStates() { - if (deviceStatesBuilder_ == null) { - deviceStates_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - deviceStatesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public Builder removeDeviceStates(int index) { - if (deviceStatesBuilder_ == null) { - ensureDeviceStatesIsMutable(); - deviceStates_.remove(index); - onChanged(); - } else { - deviceStatesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public com.google.cloud.iot.v1.DeviceState.Builder getDeviceStatesBuilder(int index) { - return getDeviceStatesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public com.google.cloud.iot.v1.DeviceStateOrBuilder getDeviceStatesOrBuilder(int index) { - if (deviceStatesBuilder_ == null) { - return deviceStates_.get(index); - } else { - return deviceStatesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public java.util.List - getDeviceStatesOrBuilderList() { - if (deviceStatesBuilder_ != null) { - return deviceStatesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(deviceStates_); - } - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public com.google.cloud.iot.v1.DeviceState.Builder addDeviceStatesBuilder() { - return getDeviceStatesFieldBuilder() - .addBuilder(com.google.cloud.iot.v1.DeviceState.getDefaultInstance()); - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public com.google.cloud.iot.v1.DeviceState.Builder addDeviceStatesBuilder(int index) { - return getDeviceStatesFieldBuilder() - .addBuilder(index, com.google.cloud.iot.v1.DeviceState.getDefaultInstance()); - } - /** - * - * - *
-     * The last few device states. States are listed in descending order of server
-     * update time, starting from the most recent one.
-     * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - public java.util.List - getDeviceStatesBuilderList() { - return getDeviceStatesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceState, - com.google.cloud.iot.v1.DeviceState.Builder, - com.google.cloud.iot.v1.DeviceStateOrBuilder> - getDeviceStatesFieldBuilder() { - if (deviceStatesBuilder_ == null) { - deviceStatesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.DeviceState, - com.google.cloud.iot.v1.DeviceState.Builder, - com.google.cloud.iot.v1.DeviceStateOrBuilder>( - deviceStates_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - deviceStates_ = null; - } - return deviceStatesBuilder_; - } - - @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.iot.v1.ListDeviceStatesResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ListDeviceStatesResponse) - private static final com.google.cloud.iot.v1.ListDeviceStatesResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ListDeviceStatesResponse(); - } - - public static com.google.cloud.iot.v1.ListDeviceStatesResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ListDeviceStatesResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDeviceStatesResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesResponseOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesResponseOrBuilder.java deleted file mode 100644 index 90f12b2f..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesResponseOrBuilder.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ListDeviceStatesResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ListDeviceStatesResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - java.util.List getDeviceStatesList(); - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - com.google.cloud.iot.v1.DeviceState getDeviceStates(int index); - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - int getDeviceStatesCount(); - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - java.util.List - getDeviceStatesOrBuilderList(); - /** - * - * - *
-   * The last few device states. States are listed in descending order of server
-   * update time, starting from the most recent one.
-   * 
- * - * repeated .google.cloud.iot.v1.DeviceState device_states = 1; - */ - com.google.cloud.iot.v1.DeviceStateOrBuilder getDeviceStatesOrBuilder(int index); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesRequest.java deleted file mode 100644 index 15030a4f..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesRequest.java +++ /dev/null @@ -1,2027 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `ListDevices`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDevicesRequest} - */ -public final class ListDevicesRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ListDevicesRequest) - ListDevicesRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use ListDevicesRequest.newBuilder() to construct. - private ListDevicesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ListDevicesRequest() { - parent_ = ""; - deviceNumIds_ = emptyLongList(); - deviceIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - pageToken_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListDevicesRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDevicesRequest.class, - com.google.cloud.iot.v1.ListDevicesRequest.Builder.class); - } - - public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; - /** - * - * - *
-   * Required. The device registry path. Required. For example,
-   * `projects/my-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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 device registry path. Required. For example,
-   * `projects/my-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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 DEVICE_NUM_IDS_FIELD_NUMBER = 2; - private com.google.protobuf.Internal.LongList deviceNumIds_; - /** - * - * - *
-   * A list of device numeric IDs. If empty, this field is ignored. Maximum
-   * IDs: 10,000.
-   * 
- * - * repeated uint64 device_num_ids = 2; - * - * @return A list containing the deviceNumIds. - */ - @java.lang.Override - public java.util.List getDeviceNumIdsList() { - return deviceNumIds_; - } - /** - * - * - *
-   * A list of device numeric IDs. If empty, this field is ignored. Maximum
-   * IDs: 10,000.
-   * 
- * - * repeated uint64 device_num_ids = 2; - * - * @return The count of deviceNumIds. - */ - public int getDeviceNumIdsCount() { - return deviceNumIds_.size(); - } - /** - * - * - *
-   * A list of device numeric IDs. If empty, this field is ignored. Maximum
-   * IDs: 10,000.
-   * 
- * - * repeated uint64 device_num_ids = 2; - * - * @param index The index of the element to return. - * @return The deviceNumIds at the given index. - */ - public long getDeviceNumIds(int index) { - return deviceNumIds_.getLong(index); - } - - private int deviceNumIdsMemoizedSerializedSize = -1; - - public static final int DEVICE_IDS_FIELD_NUMBER = 3; - private com.google.protobuf.LazyStringList deviceIds_; - /** - * - * - *
-   * A list of device string IDs. For example, `['device0', 'device12']`.
-   * If empty, this field is ignored. Maximum IDs: 10,000
-   * 
- * - * repeated string device_ids = 3; - * - * @return A list containing the deviceIds. - */ - public com.google.protobuf.ProtocolStringList getDeviceIdsList() { - return deviceIds_; - } - /** - * - * - *
-   * A list of device string IDs. For example, `['device0', 'device12']`.
-   * If empty, this field is ignored. Maximum IDs: 10,000
-   * 
- * - * repeated string device_ids = 3; - * - * @return The count of deviceIds. - */ - public int getDeviceIdsCount() { - return deviceIds_.size(); - } - /** - * - * - *
-   * A list of device string IDs. For example, `['device0', 'device12']`.
-   * If empty, this field is ignored. Maximum IDs: 10,000
-   * 
- * - * repeated string device_ids = 3; - * - * @param index The index of the element to return. - * @return The deviceIds at the given index. - */ - public java.lang.String getDeviceIds(int index) { - return deviceIds_.get(index); - } - /** - * - * - *
-   * A list of device string IDs. For example, `['device0', 'device12']`.
-   * If empty, this field is ignored. Maximum IDs: 10,000
-   * 
- * - * repeated string device_ids = 3; - * - * @param index The index of the value to return. - * @return The bytes of the deviceIds at the given index. - */ - public com.google.protobuf.ByteString getDeviceIdsBytes(int index) { - return deviceIds_.getByteString(index); - } - - public static final int FIELD_MASK_FIELD_NUMBER = 4; - private com.google.protobuf.FieldMask fieldMask_; - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. The
-   * fields `id` and `num_id` are always returned, along with any
-   * other fields specified in snake_case format, for example:
-   * `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 4; - * - * @return Whether the fieldMask field is set. - */ - @java.lang.Override - public boolean hasFieldMask() { - return fieldMask_ != null; - } - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. The
-   * fields `id` and `num_id` are always returned, along with any
-   * other fields specified in snake_case format, for example:
-   * `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 4; - * - * @return The fieldMask. - */ - @java.lang.Override - public com.google.protobuf.FieldMask getFieldMask() { - return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; - } - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. The
-   * fields `id` and `num_id` are always returned, along with any
-   * other fields specified in snake_case format, for example:
-   * `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - @java.lang.Override - public com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder() { - return getFieldMask(); - } - - public static final int GATEWAY_LIST_OPTIONS_FIELD_NUMBER = 6; - private com.google.cloud.iot.v1.GatewayListOptions gatewayListOptions_; - /** - * - * - *
-   * Options related to gateways.
-   * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - * - * @return Whether the gatewayListOptions field is set. - */ - @java.lang.Override - public boolean hasGatewayListOptions() { - return gatewayListOptions_ != null; - } - /** - * - * - *
-   * Options related to gateways.
-   * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - * - * @return The gatewayListOptions. - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayListOptions getGatewayListOptions() { - return gatewayListOptions_ == null - ? com.google.cloud.iot.v1.GatewayListOptions.getDefaultInstance() - : gatewayListOptions_; - } - /** - * - * - *
-   * Options related to gateways.
-   * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - @java.lang.Override - public com.google.cloud.iot.v1.GatewayListOptionsOrBuilder getGatewayListOptionsOrBuilder() { - return getGatewayListOptions(); - } - - public static final int PAGE_SIZE_FIELD_NUMBER = 100; - private int pageSize_; - /** - * - * - *
-   * The maximum number of devices to return in the response. If this value
-   * is zero, the service will select a default size. A call may return fewer
-   * objects than requested. A non-empty `next_page_token` in the response
-   * indicates that more data is available.
-   * 
- * - * int32 page_size = 100; - * - * @return The pageSize. - */ - @java.lang.Override - public int getPageSize() { - return pageSize_; - } - - public static final int PAGE_TOKEN_FIELD_NUMBER = 101; - private volatile java.lang.Object pageToken_; - /** - * - * - *
-   * The value returned by the last `ListDevicesResponse`; indicates
-   * that this is a continuation of a prior `ListDevices` call and
-   * the system should return the next page of data.
-   * 
- * - * string page_token = 101; - * - * @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 value returned by the last `ListDevicesResponse`; indicates
-   * that this is a continuation of a prior `ListDevices` call and
-   * the system should return the next page of data.
-   * 
- * - * string page_token = 101; - * - * @return The bytes for pageToken. - */ - @java.lang.Override - public com.google.protobuf.ByteString getPageTokenBytes() { - java.lang.Object ref = pageToken_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - pageToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - getSerializedSize(); - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); - } - if (getDeviceNumIdsList().size() > 0) { - output.writeUInt32NoTag(18); - output.writeUInt32NoTag(deviceNumIdsMemoizedSerializedSize); - } - for (int i = 0; i < deviceNumIds_.size(); i++) { - output.writeUInt64NoTag(deviceNumIds_.getLong(i)); - } - for (int i = 0; i < deviceIds_.size(); i++) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, deviceIds_.getRaw(i)); - } - if (fieldMask_ != null) { - output.writeMessage(4, getFieldMask()); - } - if (gatewayListOptions_ != null) { - output.writeMessage(6, getGatewayListOptions()); - } - if (pageSize_ != 0) { - output.writeInt32(100, pageSize_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 101, pageToken_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); - } - { - int dataSize = 0; - for (int i = 0; i < deviceNumIds_.size(); i++) { - dataSize += - com.google.protobuf.CodedOutputStream.computeUInt64SizeNoTag(deviceNumIds_.getLong(i)); - } - size += dataSize; - if (!getDeviceNumIdsList().isEmpty()) { - size += 1; - size += com.google.protobuf.CodedOutputStream.computeInt32SizeNoTag(dataSize); - } - deviceNumIdsMemoizedSerializedSize = dataSize; - } - { - int dataSize = 0; - for (int i = 0; i < deviceIds_.size(); i++) { - dataSize += computeStringSizeNoTag(deviceIds_.getRaw(i)); - } - size += dataSize; - size += 1 * getDeviceIdsList().size(); - } - if (fieldMask_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getFieldMask()); - } - if (gatewayListOptions_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getGatewayListOptions()); - } - if (pageSize_ != 0) { - size += com.google.protobuf.CodedOutputStream.computeInt32Size(100, pageSize_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(101, pageToken_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ListDevicesRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ListDevicesRequest other = - (com.google.cloud.iot.v1.ListDevicesRequest) obj; - - if (!getParent().equals(other.getParent())) return false; - if (!getDeviceNumIdsList().equals(other.getDeviceNumIdsList())) return false; - if (!getDeviceIdsList().equals(other.getDeviceIdsList())) return false; - if (hasFieldMask() != other.hasFieldMask()) return false; - if (hasFieldMask()) { - if (!getFieldMask().equals(other.getFieldMask())) return false; - } - if (hasGatewayListOptions() != other.hasGatewayListOptions()) return false; - if (hasGatewayListOptions()) { - if (!getGatewayListOptions().equals(other.getGatewayListOptions())) return false; - } - if (getPageSize() != other.getPageSize()) return false; - if (!getPageToken().equals(other.getPageToken())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + PARENT_FIELD_NUMBER; - hash = (53 * hash) + getParent().hashCode(); - if (getDeviceNumIdsCount() > 0) { - hash = (37 * hash) + DEVICE_NUM_IDS_FIELD_NUMBER; - hash = (53 * hash) + getDeviceNumIdsList().hashCode(); - } - if (getDeviceIdsCount() > 0) { - hash = (37 * hash) + DEVICE_IDS_FIELD_NUMBER; - hash = (53 * hash) + getDeviceIdsList().hashCode(); - } - if (hasFieldMask()) { - hash = (37 * hash) + FIELD_MASK_FIELD_NUMBER; - hash = (53 * hash) + getFieldMask().hashCode(); - } - if (hasGatewayListOptions()) { - hash = (37 * hash) + GATEWAY_LIST_OPTIONS_FIELD_NUMBER; - hash = (53 * hash) + getGatewayListOptions().hashCode(); - } - hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; - hash = (53 * hash) + getPageSize(); - hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; - hash = (53 * hash) + getPageToken().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ListDevicesRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDevicesRequest 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.iot.v1.ListDevicesRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDevicesRequest 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.iot.v1.ListDevicesRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDevicesRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ListDevicesRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDevicesRequest 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.iot.v1.ListDevicesRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDevicesRequest 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.iot.v1.ListDevicesRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDevicesRequest 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.iot.v1.ListDevicesRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `ListDevices`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDevicesRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ListDevicesRequest) - com.google.cloud.iot.v1.ListDevicesRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDevicesRequest.class, - com.google.cloud.iot.v1.ListDevicesRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ListDevicesRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - parent_ = ""; - - deviceNumIds_ = emptyLongList(); - bitField0_ = (bitField0_ & ~0x00000001); - deviceIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - if (fieldMaskBuilder_ == null) { - fieldMask_ = null; - } else { - fieldMask_ = null; - fieldMaskBuilder_ = null; - } - if (gatewayListOptionsBuilder_ == null) { - gatewayListOptions_ = null; - } else { - gatewayListOptions_ = null; - gatewayListOptionsBuilder_ = null; - } - pageSize_ = 0; - - pageToken_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDevicesRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ListDevicesRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDevicesRequest build() { - com.google.cloud.iot.v1.ListDevicesRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDevicesRequest buildPartial() { - com.google.cloud.iot.v1.ListDevicesRequest result = - new com.google.cloud.iot.v1.ListDevicesRequest(this); - int from_bitField0_ = bitField0_; - result.parent_ = parent_; - if (((bitField0_ & 0x00000001) != 0)) { - deviceNumIds_.makeImmutable(); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.deviceNumIds_ = deviceNumIds_; - if (((bitField0_ & 0x00000002) != 0)) { - deviceIds_ = deviceIds_.getUnmodifiableView(); - bitField0_ = (bitField0_ & ~0x00000002); - } - result.deviceIds_ = deviceIds_; - if (fieldMaskBuilder_ == null) { - result.fieldMask_ = fieldMask_; - } else { - result.fieldMask_ = fieldMaskBuilder_.build(); - } - if (gatewayListOptionsBuilder_ == null) { - result.gatewayListOptions_ = gatewayListOptions_; - } else { - result.gatewayListOptions_ = gatewayListOptionsBuilder_.build(); - } - result.pageSize_ = pageSize_; - result.pageToken_ = pageToken_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.ListDevicesRequest) { - return mergeFrom((com.google.cloud.iot.v1.ListDevicesRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ListDevicesRequest other) { - if (other == com.google.cloud.iot.v1.ListDevicesRequest.getDefaultInstance()) return this; - if (!other.getParent().isEmpty()) { - parent_ = other.parent_; - onChanged(); - } - if (!other.deviceNumIds_.isEmpty()) { - if (deviceNumIds_.isEmpty()) { - deviceNumIds_ = other.deviceNumIds_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureDeviceNumIdsIsMutable(); - deviceNumIds_.addAll(other.deviceNumIds_); - } - onChanged(); - } - if (!other.deviceIds_.isEmpty()) { - if (deviceIds_.isEmpty()) { - deviceIds_ = other.deviceIds_; - bitField0_ = (bitField0_ & ~0x00000002); - } else { - ensureDeviceIdsIsMutable(); - deviceIds_.addAll(other.deviceIds_); - } - onChanged(); - } - if (other.hasFieldMask()) { - mergeFieldMask(other.getFieldMask()); - } - if (other.hasGatewayListOptions()) { - mergeGatewayListOptions(other.getGatewayListOptions()); - } - if (other.getPageSize() != 0) { - setPageSize(other.getPageSize()); - } - if (!other.getPageToken().isEmpty()) { - pageToken_ = other.pageToken_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - parent_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 16: - { - long v = input.readUInt64(); - ensureDeviceNumIdsIsMutable(); - deviceNumIds_.addLong(v); - break; - } // case 16 - case 18: - { - int length = input.readRawVarint32(); - int limit = input.pushLimit(length); - ensureDeviceNumIdsIsMutable(); - while (input.getBytesUntilLimit() > 0) { - deviceNumIds_.addLong(input.readUInt64()); - } - input.popLimit(limit); - break; - } // case 18 - case 26: - { - java.lang.String s = input.readStringRequireUtf8(); - ensureDeviceIdsIsMutable(); - deviceIds_.add(s); - break; - } // case 26 - case 34: - { - input.readMessage(getFieldMaskFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 34 - case 50: - { - input.readMessage( - getGatewayListOptionsFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 50 - case 800: - { - pageSize_ = input.readInt32(); - - break; - } // case 800 - case 810: - { - pageToken_ = input.readStringRequireUtf8(); - - break; - } // case 810 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.lang.Object parent_ = ""; - /** - * - * - *
-     * Required. The device registry path. Required. For example,
-     * `projects/my-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry path. Required. For example,
-     * `projects/my-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry path. Required. For example,
-     * `projects/my-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry path. Required. For example,
-     * `projects/my-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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 device registry path. Required. For example,
-     * `projects/my-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * 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.protobuf.Internal.LongList deviceNumIds_ = emptyLongList(); - - private void ensureDeviceNumIdsIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - deviceNumIds_ = mutableCopy(deviceNumIds_); - bitField0_ |= 0x00000001; - } - } - /** - * - * - *
-     * A list of device numeric IDs. If empty, this field is ignored. Maximum
-     * IDs: 10,000.
-     * 
- * - * repeated uint64 device_num_ids = 2; - * - * @return A list containing the deviceNumIds. - */ - public java.util.List getDeviceNumIdsList() { - return ((bitField0_ & 0x00000001) != 0) - ? java.util.Collections.unmodifiableList(deviceNumIds_) - : deviceNumIds_; - } - /** - * - * - *
-     * A list of device numeric IDs. If empty, this field is ignored. Maximum
-     * IDs: 10,000.
-     * 
- * - * repeated uint64 device_num_ids = 2; - * - * @return The count of deviceNumIds. - */ - public int getDeviceNumIdsCount() { - return deviceNumIds_.size(); - } - /** - * - * - *
-     * A list of device numeric IDs. If empty, this field is ignored. Maximum
-     * IDs: 10,000.
-     * 
- * - * repeated uint64 device_num_ids = 2; - * - * @param index The index of the element to return. - * @return The deviceNumIds at the given index. - */ - public long getDeviceNumIds(int index) { - return deviceNumIds_.getLong(index); - } - /** - * - * - *
-     * A list of device numeric IDs. If empty, this field is ignored. Maximum
-     * IDs: 10,000.
-     * 
- * - * repeated uint64 device_num_ids = 2; - * - * @param index The index to set the value at. - * @param value The deviceNumIds to set. - * @return This builder for chaining. - */ - public Builder setDeviceNumIds(int index, long value) { - ensureDeviceNumIdsIsMutable(); - deviceNumIds_.setLong(index, value); - onChanged(); - return this; - } - /** - * - * - *
-     * A list of device numeric IDs. If empty, this field is ignored. Maximum
-     * IDs: 10,000.
-     * 
- * - * repeated uint64 device_num_ids = 2; - * - * @param value The deviceNumIds to add. - * @return This builder for chaining. - */ - public Builder addDeviceNumIds(long value) { - ensureDeviceNumIdsIsMutable(); - deviceNumIds_.addLong(value); - onChanged(); - return this; - } - /** - * - * - *
-     * A list of device numeric IDs. If empty, this field is ignored. Maximum
-     * IDs: 10,000.
-     * 
- * - * repeated uint64 device_num_ids = 2; - * - * @param values The deviceNumIds to add. - * @return This builder for chaining. - */ - public Builder addAllDeviceNumIds(java.lang.Iterable values) { - ensureDeviceNumIdsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deviceNumIds_); - onChanged(); - return this; - } - /** - * - * - *
-     * A list of device numeric IDs. If empty, this field is ignored. Maximum
-     * IDs: 10,000.
-     * 
- * - * repeated uint64 device_num_ids = 2; - * - * @return This builder for chaining. - */ - public Builder clearDeviceNumIds() { - deviceNumIds_ = emptyLongList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - return this; - } - - private com.google.protobuf.LazyStringList deviceIds_ = - com.google.protobuf.LazyStringArrayList.EMPTY; - - private void ensureDeviceIdsIsMutable() { - if (!((bitField0_ & 0x00000002) != 0)) { - deviceIds_ = new com.google.protobuf.LazyStringArrayList(deviceIds_); - bitField0_ |= 0x00000002; - } - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @return A list containing the deviceIds. - */ - public com.google.protobuf.ProtocolStringList getDeviceIdsList() { - return deviceIds_.getUnmodifiableView(); - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @return The count of deviceIds. - */ - public int getDeviceIdsCount() { - return deviceIds_.size(); - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @param index The index of the element to return. - * @return The deviceIds at the given index. - */ - public java.lang.String getDeviceIds(int index) { - return deviceIds_.get(index); - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @param index The index of the value to return. - * @return The bytes of the deviceIds at the given index. - */ - public com.google.protobuf.ByteString getDeviceIdsBytes(int index) { - return deviceIds_.getByteString(index); - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @param index The index to set the value at. - * @param value The deviceIds to set. - * @return This builder for chaining. - */ - public Builder setDeviceIds(int index, java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceIdsIsMutable(); - deviceIds_.set(index, value); - onChanged(); - return this; - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @param value The deviceIds to add. - * @return This builder for chaining. - */ - public Builder addDeviceIds(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - ensureDeviceIdsIsMutable(); - deviceIds_.add(value); - onChanged(); - return this; - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @param values The deviceIds to add. - * @return This builder for chaining. - */ - public Builder addAllDeviceIds(java.lang.Iterable values) { - ensureDeviceIdsIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deviceIds_); - onChanged(); - return this; - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @return This builder for chaining. - */ - public Builder clearDeviceIds() { - deviceIds_ = com.google.protobuf.LazyStringArrayList.EMPTY; - bitField0_ = (bitField0_ & ~0x00000002); - onChanged(); - return this; - } - /** - * - * - *
-     * A list of device string IDs. For example, `['device0', 'device12']`.
-     * If empty, this field is ignored. Maximum IDs: 10,000
-     * 
- * - * repeated string device_ids = 3; - * - * @param value The bytes of the deviceIds to add. - * @return This builder for chaining. - */ - public Builder addDeviceIdsBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - ensureDeviceIdsIsMutable(); - deviceIds_.add(value); - onChanged(); - return this; - } - - private com.google.protobuf.FieldMask fieldMask_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder> - fieldMaskBuilder_; - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - * - * @return Whether the fieldMask field is set. - */ - public boolean hasFieldMask() { - return fieldMaskBuilder_ != null || fieldMask_ != null; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - * - * @return The fieldMask. - */ - public com.google.protobuf.FieldMask getFieldMask() { - if (fieldMaskBuilder_ == null) { - return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; - } else { - return fieldMaskBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - public Builder setFieldMask(com.google.protobuf.FieldMask value) { - if (fieldMaskBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - fieldMask_ = value; - onChanged(); - } else { - fieldMaskBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - public Builder setFieldMask(com.google.protobuf.FieldMask.Builder builderForValue) { - if (fieldMaskBuilder_ == null) { - fieldMask_ = builderForValue.build(); - onChanged(); - } else { - fieldMaskBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - public Builder mergeFieldMask(com.google.protobuf.FieldMask value) { - if (fieldMaskBuilder_ == null) { - if (fieldMask_ != null) { - fieldMask_ = - com.google.protobuf.FieldMask.newBuilder(fieldMask_).mergeFrom(value).buildPartial(); - } else { - fieldMask_ = value; - } - onChanged(); - } else { - fieldMaskBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - public Builder clearFieldMask() { - if (fieldMaskBuilder_ == null) { - fieldMask_ = null; - onChanged(); - } else { - fieldMask_ = null; - fieldMaskBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - public com.google.protobuf.FieldMask.Builder getFieldMaskBuilder() { - - onChanged(); - return getFieldMaskFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - public com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder() { - if (fieldMaskBuilder_ != null) { - return fieldMaskBuilder_.getMessageOrBuilder(); - } else { - return fieldMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : fieldMask_; - } - } - /** - * - * - *
-     * The fields of the `Device` resource to be returned in the response. The
-     * fields `id` and `num_id` are always returned, along with any
-     * other fields specified in snake_case format, for example:
-     * `last_heartbeat_time`.
-     * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder> - getFieldMaskFieldBuilder() { - if (fieldMaskBuilder_ == null) { - fieldMaskBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder>( - getFieldMask(), getParentForChildren(), isClean()); - fieldMask_ = null; - } - return fieldMaskBuilder_; - } - - private com.google.cloud.iot.v1.GatewayListOptions gatewayListOptions_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.GatewayListOptions, - com.google.cloud.iot.v1.GatewayListOptions.Builder, - com.google.cloud.iot.v1.GatewayListOptionsOrBuilder> - gatewayListOptionsBuilder_; - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - * - * @return Whether the gatewayListOptions field is set. - */ - public boolean hasGatewayListOptions() { - return gatewayListOptionsBuilder_ != null || gatewayListOptions_ != null; - } - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - * - * @return The gatewayListOptions. - */ - public com.google.cloud.iot.v1.GatewayListOptions getGatewayListOptions() { - if (gatewayListOptionsBuilder_ == null) { - return gatewayListOptions_ == null - ? com.google.cloud.iot.v1.GatewayListOptions.getDefaultInstance() - : gatewayListOptions_; - } else { - return gatewayListOptionsBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - public Builder setGatewayListOptions(com.google.cloud.iot.v1.GatewayListOptions value) { - if (gatewayListOptionsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - gatewayListOptions_ = value; - onChanged(); - } else { - gatewayListOptionsBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - public Builder setGatewayListOptions( - com.google.cloud.iot.v1.GatewayListOptions.Builder builderForValue) { - if (gatewayListOptionsBuilder_ == null) { - gatewayListOptions_ = builderForValue.build(); - onChanged(); - } else { - gatewayListOptionsBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - public Builder mergeGatewayListOptions(com.google.cloud.iot.v1.GatewayListOptions value) { - if (gatewayListOptionsBuilder_ == null) { - if (gatewayListOptions_ != null) { - gatewayListOptions_ = - com.google.cloud.iot.v1.GatewayListOptions.newBuilder(gatewayListOptions_) - .mergeFrom(value) - .buildPartial(); - } else { - gatewayListOptions_ = value; - } - onChanged(); - } else { - gatewayListOptionsBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - public Builder clearGatewayListOptions() { - if (gatewayListOptionsBuilder_ == null) { - gatewayListOptions_ = null; - onChanged(); - } else { - gatewayListOptions_ = null; - gatewayListOptionsBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - public com.google.cloud.iot.v1.GatewayListOptions.Builder getGatewayListOptionsBuilder() { - - onChanged(); - return getGatewayListOptionsFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - public com.google.cloud.iot.v1.GatewayListOptionsOrBuilder getGatewayListOptionsOrBuilder() { - if (gatewayListOptionsBuilder_ != null) { - return gatewayListOptionsBuilder_.getMessageOrBuilder(); - } else { - return gatewayListOptions_ == null - ? com.google.cloud.iot.v1.GatewayListOptions.getDefaultInstance() - : gatewayListOptions_; - } - } - /** - * - * - *
-     * Options related to gateways.
-     * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.GatewayListOptions, - com.google.cloud.iot.v1.GatewayListOptions.Builder, - com.google.cloud.iot.v1.GatewayListOptionsOrBuilder> - getGatewayListOptionsFieldBuilder() { - if (gatewayListOptionsBuilder_ == null) { - gatewayListOptionsBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.GatewayListOptions, - com.google.cloud.iot.v1.GatewayListOptions.Builder, - com.google.cloud.iot.v1.GatewayListOptionsOrBuilder>( - getGatewayListOptions(), getParentForChildren(), isClean()); - gatewayListOptions_ = null; - } - return gatewayListOptionsBuilder_; - } - - private int pageSize_; - /** - * - * - *
-     * The maximum number of devices to return in the response. If this value
-     * is zero, the service will select a default size. A call may return fewer
-     * objects than requested. A non-empty `next_page_token` in the response
-     * indicates that more data is available.
-     * 
- * - * int32 page_size = 100; - * - * @return The pageSize. - */ - @java.lang.Override - public int getPageSize() { - return pageSize_; - } - /** - * - * - *
-     * The maximum number of devices to return in the response. If this value
-     * is zero, the service will select a default size. A call may return fewer
-     * objects than requested. A non-empty `next_page_token` in the response
-     * indicates that more data is available.
-     * 
- * - * int32 page_size = 100; - * - * @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 devices to return in the response. If this value
-     * is zero, the service will select a default size. A call may return fewer
-     * objects than requested. A non-empty `next_page_token` in the response
-     * indicates that more data is available.
-     * 
- * - * int32 page_size = 100; - * - * @return This builder for chaining. - */ - public Builder clearPageSize() { - - pageSize_ = 0; - onChanged(); - return this; - } - - private java.lang.Object pageToken_ = ""; - /** - * - * - *
-     * The value returned by the last `ListDevicesResponse`; indicates
-     * that this is a continuation of a prior `ListDevices` call and
-     * the system should return the next page of data.
-     * 
- * - * string page_token = 101; - * - * @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 value returned by the last `ListDevicesResponse`; indicates
-     * that this is a continuation of a prior `ListDevices` call and
-     * the system should return the next page of data.
-     * 
- * - * string page_token = 101; - * - * @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 value returned by the last `ListDevicesResponse`; indicates
-     * that this is a continuation of a prior `ListDevices` call and
-     * the system should return the next page of data.
-     * 
- * - * string page_token = 101; - * - * @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 value returned by the last `ListDevicesResponse`; indicates
-     * that this is a continuation of a prior `ListDevices` call and
-     * the system should return the next page of data.
-     * 
- * - * string page_token = 101; - * - * @return This builder for chaining. - */ - public Builder clearPageToken() { - - pageToken_ = getDefaultInstance().getPageToken(); - onChanged(); - return this; - } - /** - * - * - *
-     * The value returned by the last `ListDevicesResponse`; indicates
-     * that this is a continuation of a prior `ListDevices` call and
-     * the system should return the next page of data.
-     * 
- * - * string page_token = 101; - * - * @param value The bytes for pageToken to set. - * @return This builder for chaining. - */ - public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - pageToken_ = value; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.ListDevicesRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ListDevicesRequest) - private static final com.google.cloud.iot.v1.ListDevicesRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ListDevicesRequest(); - } - - public static com.google.cloud.iot.v1.ListDevicesRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ListDevicesRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDevicesRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesRequestOrBuilder.java deleted file mode 100644 index 501c3586..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesRequestOrBuilder.java +++ /dev/null @@ -1,276 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ListDevicesRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ListDevicesRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The device registry path. Required. For example,
-   * `projects/my-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - java.lang.String getParent(); - /** - * - * - *
-   * Required. The device registry path. Required. For example,
-   * `projects/my-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - com.google.protobuf.ByteString getParentBytes(); - - /** - * - * - *
-   * A list of device numeric IDs. If empty, this field is ignored. Maximum
-   * IDs: 10,000.
-   * 
- * - * repeated uint64 device_num_ids = 2; - * - * @return A list containing the deviceNumIds. - */ - java.util.List getDeviceNumIdsList(); - /** - * - * - *
-   * A list of device numeric IDs. If empty, this field is ignored. Maximum
-   * IDs: 10,000.
-   * 
- * - * repeated uint64 device_num_ids = 2; - * - * @return The count of deviceNumIds. - */ - int getDeviceNumIdsCount(); - /** - * - * - *
-   * A list of device numeric IDs. If empty, this field is ignored. Maximum
-   * IDs: 10,000.
-   * 
- * - * repeated uint64 device_num_ids = 2; - * - * @param index The index of the element to return. - * @return The deviceNumIds at the given index. - */ - long getDeviceNumIds(int index); - - /** - * - * - *
-   * A list of device string IDs. For example, `['device0', 'device12']`.
-   * If empty, this field is ignored. Maximum IDs: 10,000
-   * 
- * - * repeated string device_ids = 3; - * - * @return A list containing the deviceIds. - */ - java.util.List getDeviceIdsList(); - /** - * - * - *
-   * A list of device string IDs. For example, `['device0', 'device12']`.
-   * If empty, this field is ignored. Maximum IDs: 10,000
-   * 
- * - * repeated string device_ids = 3; - * - * @return The count of deviceIds. - */ - int getDeviceIdsCount(); - /** - * - * - *
-   * A list of device string IDs. For example, `['device0', 'device12']`.
-   * If empty, this field is ignored. Maximum IDs: 10,000
-   * 
- * - * repeated string device_ids = 3; - * - * @param index The index of the element to return. - * @return The deviceIds at the given index. - */ - java.lang.String getDeviceIds(int index); - /** - * - * - *
-   * A list of device string IDs. For example, `['device0', 'device12']`.
-   * If empty, this field is ignored. Maximum IDs: 10,000
-   * 
- * - * repeated string device_ids = 3; - * - * @param index The index of the value to return. - * @return The bytes of the deviceIds at the given index. - */ - com.google.protobuf.ByteString getDeviceIdsBytes(int index); - - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. The
-   * fields `id` and `num_id` are always returned, along with any
-   * other fields specified in snake_case format, for example:
-   * `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 4; - * - * @return Whether the fieldMask field is set. - */ - boolean hasFieldMask(); - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. The
-   * fields `id` and `num_id` are always returned, along with any
-   * other fields specified in snake_case format, for example:
-   * `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 4; - * - * @return The fieldMask. - */ - com.google.protobuf.FieldMask getFieldMask(); - /** - * - * - *
-   * The fields of the `Device` resource to be returned in the response. The
-   * fields `id` and `num_id` are always returned, along with any
-   * other fields specified in snake_case format, for example:
-   * `last_heartbeat_time`.
-   * 
- * - * .google.protobuf.FieldMask field_mask = 4; - */ - com.google.protobuf.FieldMaskOrBuilder getFieldMaskOrBuilder(); - - /** - * - * - *
-   * Options related to gateways.
-   * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - * - * @return Whether the gatewayListOptions field is set. - */ - boolean hasGatewayListOptions(); - /** - * - * - *
-   * Options related to gateways.
-   * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - * - * @return The gatewayListOptions. - */ - com.google.cloud.iot.v1.GatewayListOptions getGatewayListOptions(); - /** - * - * - *
-   * Options related to gateways.
-   * 
- * - * .google.cloud.iot.v1.GatewayListOptions gateway_list_options = 6; - */ - com.google.cloud.iot.v1.GatewayListOptionsOrBuilder getGatewayListOptionsOrBuilder(); - - /** - * - * - *
-   * The maximum number of devices to return in the response. If this value
-   * is zero, the service will select a default size. A call may return fewer
-   * objects than requested. A non-empty `next_page_token` in the response
-   * indicates that more data is available.
-   * 
- * - * int32 page_size = 100; - * - * @return The pageSize. - */ - int getPageSize(); - - /** - * - * - *
-   * The value returned by the last `ListDevicesResponse`; indicates
-   * that this is a continuation of a prior `ListDevices` call and
-   * the system should return the next page of data.
-   * 
- * - * string page_token = 101; - * - * @return The pageToken. - */ - java.lang.String getPageToken(); - /** - * - * - *
-   * The value returned by the last `ListDevicesResponse`; indicates
-   * that this is a continuation of a prior `ListDevices` call and
-   * the system should return the next page of data.
-   * 
- * - * string page_token = 101; - * - * @return The bytes for pageToken. - */ - com.google.protobuf.ByteString getPageTokenBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesResponse.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesResponse.java deleted file mode 100644 index 89b41beb..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesResponse.java +++ /dev/null @@ -1,1106 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Response for `ListDevices`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDevicesResponse} - */ -public final class ListDevicesResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ListDevicesResponse) - ListDevicesResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use ListDevicesResponse.newBuilder() to construct. - private ListDevicesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ListDevicesResponse() { - devices_ = java.util.Collections.emptyList(); - nextPageToken_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ListDevicesResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDevicesResponse.class, - com.google.cloud.iot.v1.ListDevicesResponse.Builder.class); - } - - public static final int DEVICES_FIELD_NUMBER = 1; - private java.util.List devices_; - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - @java.lang.Override - public java.util.List getDevicesList() { - return devices_; - } - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - @java.lang.Override - public java.util.List - getDevicesOrBuilderList() { - return devices_; - } - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - @java.lang.Override - public int getDevicesCount() { - return devices_.size(); - } - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.Device getDevices(int index) { - return devices_.get(index); - } - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceOrBuilder getDevicesOrBuilder(int index) { - return devices_.get(index); - } - - public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; - private volatile java.lang.Object nextPageToken_; - /** - * - * - *
-   * If not empty, indicates that there may be more devices that match the
-   * request; this value should be passed in a new `ListDevicesRequest`.
-   * 
- * - * string next_page_token = 2; - * - * @return The nextPageToken. - */ - @java.lang.Override - public java.lang.String getNextPageToken() { - java.lang.Object ref = nextPageToken_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - nextPageToken_ = s; - return s; - } - } - /** - * - * - *
-   * If not empty, indicates that there may be more devices that match the
-   * request; this value should be passed in a new `ListDevicesRequest`.
-   * 
- * - * string next_page_token = 2; - * - * @return The bytes for nextPageToken. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNextPageTokenBytes() { - java.lang.Object ref = nextPageToken_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - nextPageToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - for (int i = 0; i < devices_.size(); i++) { - output.writeMessage(1, devices_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - for (int i = 0; i < devices_.size(); i++) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, devices_.get(i)); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ListDevicesResponse)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ListDevicesResponse other = - (com.google.cloud.iot.v1.ListDevicesResponse) obj; - - if (!getDevicesList().equals(other.getDevicesList())) return false; - if (!getNextPageToken().equals(other.getNextPageToken())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (getDevicesCount() > 0) { - hash = (37 * hash) + DEVICES_FIELD_NUMBER; - hash = (53 * hash) + getDevicesList().hashCode(); - } - hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; - hash = (53 * hash) + getNextPageToken().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ListDevicesResponse parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDevicesResponse 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.iot.v1.ListDevicesResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDevicesResponse 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.iot.v1.ListDevicesResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ListDevicesResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ListDevicesResponse parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDevicesResponse 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.iot.v1.ListDevicesResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDevicesResponse 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.iot.v1.ListDevicesResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ListDevicesResponse 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.iot.v1.ListDevicesResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Response for `ListDevices`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ListDevicesResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ListDevicesResponse) - com.google.cloud.iot.v1.ListDevicesResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ListDevicesResponse.class, - com.google.cloud.iot.v1.ListDevicesResponse.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ListDevicesResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (devicesBuilder_ == null) { - devices_ = java.util.Collections.emptyList(); - } else { - devices_ = null; - devicesBuilder_.clear(); - } - bitField0_ = (bitField0_ & ~0x00000001); - nextPageToken_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ListDevicesResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDevicesResponse getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ListDevicesResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDevicesResponse build() { - com.google.cloud.iot.v1.ListDevicesResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDevicesResponse buildPartial() { - com.google.cloud.iot.v1.ListDevicesResponse result = - new com.google.cloud.iot.v1.ListDevicesResponse(this); - int from_bitField0_ = bitField0_; - if (devicesBuilder_ == null) { - if (((bitField0_ & 0x00000001) != 0)) { - devices_ = java.util.Collections.unmodifiableList(devices_); - bitField0_ = (bitField0_ & ~0x00000001); - } - result.devices_ = devices_; - } else { - result.devices_ = devicesBuilder_.build(); - } - result.nextPageToken_ = nextPageToken_; - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.ListDevicesResponse) { - return mergeFrom((com.google.cloud.iot.v1.ListDevicesResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ListDevicesResponse other) { - if (other == com.google.cloud.iot.v1.ListDevicesResponse.getDefaultInstance()) return this; - if (devicesBuilder_ == null) { - if (!other.devices_.isEmpty()) { - if (devices_.isEmpty()) { - devices_ = other.devices_; - bitField0_ = (bitField0_ & ~0x00000001); - } else { - ensureDevicesIsMutable(); - devices_.addAll(other.devices_); - } - onChanged(); - } - } else { - if (!other.devices_.isEmpty()) { - if (devicesBuilder_.isEmpty()) { - devicesBuilder_.dispose(); - devicesBuilder_ = null; - devices_ = other.devices_; - bitField0_ = (bitField0_ & ~0x00000001); - devicesBuilder_ = - com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders - ? getDevicesFieldBuilder() - : null; - } else { - devicesBuilder_.addAllMessages(other.devices_); - } - } - } - if (!other.getNextPageToken().isEmpty()) { - nextPageToken_ = other.nextPageToken_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - com.google.cloud.iot.v1.Device m = - input.readMessage(com.google.cloud.iot.v1.Device.parser(), extensionRegistry); - if (devicesBuilder_ == null) { - ensureDevicesIsMutable(); - devices_.add(m); - } else { - devicesBuilder_.addMessage(m); - } - break; - } // case 10 - case 18: - { - nextPageToken_ = input.readStringRequireUtf8(); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int bitField0_; - - private java.util.List devices_ = - java.util.Collections.emptyList(); - - private void ensureDevicesIsMutable() { - if (!((bitField0_ & 0x00000001) != 0)) { - devices_ = new java.util.ArrayList(devices_); - bitField0_ |= 0x00000001; - } - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder> - devicesBuilder_; - - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public java.util.List getDevicesList() { - if (devicesBuilder_ == null) { - return java.util.Collections.unmodifiableList(devices_); - } else { - return devicesBuilder_.getMessageList(); - } - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public int getDevicesCount() { - if (devicesBuilder_ == null) { - return devices_.size(); - } else { - return devicesBuilder_.getCount(); - } - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public com.google.cloud.iot.v1.Device getDevices(int index) { - if (devicesBuilder_ == null) { - return devices_.get(index); - } else { - return devicesBuilder_.getMessage(index); - } - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder setDevices(int index, com.google.cloud.iot.v1.Device value) { - if (devicesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDevicesIsMutable(); - devices_.set(index, value); - onChanged(); - } else { - devicesBuilder_.setMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder setDevices(int index, com.google.cloud.iot.v1.Device.Builder builderForValue) { - if (devicesBuilder_ == null) { - ensureDevicesIsMutable(); - devices_.set(index, builderForValue.build()); - onChanged(); - } else { - devicesBuilder_.setMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder addDevices(com.google.cloud.iot.v1.Device value) { - if (devicesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDevicesIsMutable(); - devices_.add(value); - onChanged(); - } else { - devicesBuilder_.addMessage(value); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder addDevices(int index, com.google.cloud.iot.v1.Device value) { - if (devicesBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - ensureDevicesIsMutable(); - devices_.add(index, value); - onChanged(); - } else { - devicesBuilder_.addMessage(index, value); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder addDevices(com.google.cloud.iot.v1.Device.Builder builderForValue) { - if (devicesBuilder_ == null) { - ensureDevicesIsMutable(); - devices_.add(builderForValue.build()); - onChanged(); - } else { - devicesBuilder_.addMessage(builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder addDevices(int index, com.google.cloud.iot.v1.Device.Builder builderForValue) { - if (devicesBuilder_ == null) { - ensureDevicesIsMutable(); - devices_.add(index, builderForValue.build()); - onChanged(); - } else { - devicesBuilder_.addMessage(index, builderForValue.build()); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder addAllDevices( - java.lang.Iterable values) { - if (devicesBuilder_ == null) { - ensureDevicesIsMutable(); - com.google.protobuf.AbstractMessageLite.Builder.addAll(values, devices_); - onChanged(); - } else { - devicesBuilder_.addAllMessages(values); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder clearDevices() { - if (devicesBuilder_ == null) { - devices_ = java.util.Collections.emptyList(); - bitField0_ = (bitField0_ & ~0x00000001); - onChanged(); - } else { - devicesBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public Builder removeDevices(int index) { - if (devicesBuilder_ == null) { - ensureDevicesIsMutable(); - devices_.remove(index); - onChanged(); - } else { - devicesBuilder_.remove(index); - } - return this; - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public com.google.cloud.iot.v1.Device.Builder getDevicesBuilder(int index) { - return getDevicesFieldBuilder().getBuilder(index); - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public com.google.cloud.iot.v1.DeviceOrBuilder getDevicesOrBuilder(int index) { - if (devicesBuilder_ == null) { - return devices_.get(index); - } else { - return devicesBuilder_.getMessageOrBuilder(index); - } - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public java.util.List - getDevicesOrBuilderList() { - if (devicesBuilder_ != null) { - return devicesBuilder_.getMessageOrBuilderList(); - } else { - return java.util.Collections.unmodifiableList(devices_); - } - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public com.google.cloud.iot.v1.Device.Builder addDevicesBuilder() { - return getDevicesFieldBuilder() - .addBuilder(com.google.cloud.iot.v1.Device.getDefaultInstance()); - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public com.google.cloud.iot.v1.Device.Builder addDevicesBuilder(int index) { - return getDevicesFieldBuilder() - .addBuilder(index, com.google.cloud.iot.v1.Device.getDefaultInstance()); - } - /** - * - * - *
-     * The devices that match the request.
-     * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - public java.util.List getDevicesBuilderList() { - return getDevicesFieldBuilder().getBuilderList(); - } - - private com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder> - getDevicesFieldBuilder() { - if (devicesBuilder_ == null) { - devicesBuilder_ = - new com.google.protobuf.RepeatedFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder>( - devices_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); - devices_ = null; - } - return devicesBuilder_; - } - - private java.lang.Object nextPageToken_ = ""; - /** - * - * - *
-     * If not empty, indicates that there may be more devices that match the
-     * request; this value should be passed in a new `ListDevicesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @return The nextPageToken. - */ - public java.lang.String getNextPageToken() { - java.lang.Object ref = nextPageToken_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - nextPageToken_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * If not empty, indicates that there may be more devices that match the
-     * request; this value should be passed in a new `ListDevicesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @return The bytes for nextPageToken. - */ - public com.google.protobuf.ByteString getNextPageTokenBytes() { - java.lang.Object ref = nextPageToken_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - nextPageToken_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * If not empty, indicates that there may be more devices that match the
-     * request; this value should be passed in a new `ListDevicesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @param value The nextPageToken to set. - * @return This builder for chaining. - */ - public Builder setNextPageToken(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - nextPageToken_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If not empty, indicates that there may be more devices that match the
-     * request; this value should be passed in a new `ListDevicesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @return This builder for chaining. - */ - public Builder clearNextPageToken() { - - nextPageToken_ = getDefaultInstance().getNextPageToken(); - onChanged(); - return this; - } - /** - * - * - *
-     * If not empty, indicates that there may be more devices that match the
-     * request; this value should be passed in a new `ListDevicesRequest`.
-     * 
- * - * string next_page_token = 2; - * - * @param value The bytes for nextPageToken to set. - * @return This builder for chaining. - */ - public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - nextPageToken_ = value; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.ListDevicesResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ListDevicesResponse) - private static final com.google.cloud.iot.v1.ListDevicesResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ListDevicesResponse(); - } - - public static com.google.cloud.iot.v1.ListDevicesResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ListDevicesResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ListDevicesResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesResponseOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesResponseOrBuilder.java deleted file mode 100644 index 4aaf0e36..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesResponseOrBuilder.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ListDevicesResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ListDevicesResponse) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - java.util.List getDevicesList(); - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - com.google.cloud.iot.v1.Device getDevices(int index); - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - int getDevicesCount(); - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - java.util.List getDevicesOrBuilderList(); - /** - * - * - *
-   * The devices that match the request.
-   * 
- * - * repeated .google.cloud.iot.v1.Device devices = 1; - */ - com.google.cloud.iot.v1.DeviceOrBuilder getDevicesOrBuilder(int index); - - /** - * - * - *
-   * If not empty, indicates that there may be more devices that match the
-   * request; this value should be passed in a new `ListDevicesRequest`.
-   * 
- * - * string next_page_token = 2; - * - * @return The nextPageToken. - */ - java.lang.String getNextPageToken(); - /** - * - * - *
-   * If not empty, indicates that there may be more devices that match the
-   * request; this value should be passed in a new `ListDevicesRequest`.
-   * 
- * - * string next_page_token = 2; - * - * @return The bytes for nextPageToken. - */ - com.google.protobuf.ByteString getNextPageTokenBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/LocationName.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/LocationName.java deleted file mode 100644 index 344bc18d..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/LocationName.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.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) { - this.project = locationName.project; - this.location = locationName.location; - } - - public LocationName build() { - return new LocationName(this); - } - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/LogLevel.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/LogLevel.java deleted file mode 100644 index 4e73594c..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/LogLevel.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * **Beta Feature**
- * The logging verbosity for device activity. Specifies which events should be
- * written to logs. For example, if the LogLevel is ERROR, only events that
- * terminate in errors will be logged. LogLevel is inclusive; enabling INFO
- * logging will also enable ERROR logging.
- * 
- * - * Protobuf enum {@code google.cloud.iot.v1.LogLevel} - */ -public enum LogLevel implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-   * No logging specified. If not specified, logging will be disabled.
-   * 
- * - * LOG_LEVEL_UNSPECIFIED = 0; - */ - LOG_LEVEL_UNSPECIFIED(0), - /** - * - * - *
-   * Disables logging.
-   * 
- * - * NONE = 10; - */ - NONE(10), - /** - * - * - *
-   * Error events will be logged.
-   * 
- * - * ERROR = 20; - */ - ERROR(20), - /** - * - * - *
-   * Informational events will be logged, such as connections and
-   * disconnections.
-   * 
- * - * INFO = 30; - */ - INFO(30), - /** - * - * - *
-   * All events will be logged.
-   * 
- * - * DEBUG = 40; - */ - DEBUG(40), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-   * No logging specified. If not specified, logging will be disabled.
-   * 
- * - * LOG_LEVEL_UNSPECIFIED = 0; - */ - public static final int LOG_LEVEL_UNSPECIFIED_VALUE = 0; - /** - * - * - *
-   * Disables logging.
-   * 
- * - * NONE = 10; - */ - public static final int NONE_VALUE = 10; - /** - * - * - *
-   * Error events will be logged.
-   * 
- * - * ERROR = 20; - */ - public static final int ERROR_VALUE = 20; - /** - * - * - *
-   * Informational events will be logged, such as connections and
-   * disconnections.
-   * 
- * - * INFO = 30; - */ - public static final int INFO_VALUE = 30; - /** - * - * - *
-   * All events will be logged.
-   * 
- * - * DEBUG = 40; - */ - public static final int DEBUG_VALUE = 40; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static LogLevel valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static LogLevel forNumber(int value) { - switch (value) { - case 0: - return LOG_LEVEL_UNSPECIFIED; - case 10: - return NONE; - case 20: - return ERROR; - case 30: - return INFO; - case 40: - return DEBUG; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public LogLevel findValueByNumber(int number) { - return LogLevel.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto.getDescriptor().getEnumTypes().get(2); - } - - private static final LogLevel[] VALUES = values(); - - public static LogLevel valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private LogLevel(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.cloud.iot.v1.LogLevel) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ModifyCloudToDeviceConfigRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ModifyCloudToDeviceConfigRequest.java deleted file mode 100644 index 80fa2131..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ModifyCloudToDeviceConfigRequest.java +++ /dev/null @@ -1,847 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `ModifyCloudToDeviceConfig`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest} - */ -public final class ModifyCloudToDeviceConfigRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) - ModifyCloudToDeviceConfigRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use ModifyCloudToDeviceConfigRequest.newBuilder() to construct. - private ModifyCloudToDeviceConfigRequest( - com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private ModifyCloudToDeviceConfigRequest() { - name_ = ""; - binaryData_ = com.google.protobuf.ByteString.EMPTY; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new ModifyCloudToDeviceConfigRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.class, - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int VERSION_TO_UPDATE_FIELD_NUMBER = 2; - private long versionToUpdate_; - /** - * - * - *
-   * The version number to update. If this value is zero, it will not check the
-   * version number of the server and will always update the current version;
-   * otherwise, this update will fail if the version number found on the server
-   * does not match this version number. This is used to support multiple
-   * simultaneous updates without losing data.
-   * 
- * - * int64 version_to_update = 2; - * - * @return The versionToUpdate. - */ - @java.lang.Override - public long getVersionToUpdate() { - return versionToUpdate_; - } - - public static final int BINARY_DATA_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString binaryData_; - /** - * - * - *
-   * Required. The configuration data for the device.
-   * 
- * - * bytes binary_data = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The binaryData. - */ - @java.lang.Override - public com.google.protobuf.ByteString getBinaryData() { - return binaryData_; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (versionToUpdate_ != 0L) { - output.writeInt64(2, versionToUpdate_); - } - if (!binaryData_.isEmpty()) { - output.writeBytes(3, binaryData_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (versionToUpdate_ != 0L) { - size += com.google.protobuf.CodedOutputStream.computeInt64Size(2, versionToUpdate_); - } - if (!binaryData_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, binaryData_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest other = - (com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) obj; - - if (!getName().equals(other.getName())) return false; - if (getVersionToUpdate() != other.getVersionToUpdate()) return false; - if (!getBinaryData().equals(other.getBinaryData())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + VERSION_TO_UPDATE_FIELD_NUMBER; - hash = (53 * hash) + com.google.protobuf.Internal.hashLong(getVersionToUpdate()); - hash = (37 * hash) + BINARY_DATA_FIELD_NUMBER; - hash = (53 * hash) + getBinaryData().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest 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.iot.v1.ModifyCloudToDeviceConfigRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest 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.iot.v1.ModifyCloudToDeviceConfigRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest 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.iot.v1.ModifyCloudToDeviceConfigRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest 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.iot.v1.ModifyCloudToDeviceConfigRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest 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.iot.v1.ModifyCloudToDeviceConfigRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `ModifyCloudToDeviceConfig`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.class, - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - versionToUpdate_ = 0L; - - binaryData_ = com.google.protobuf.ByteString.EMPTY; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_ModifyCloudToDeviceConfigRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest build() { - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest buildPartial() { - com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest result = - new com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest(this); - result.name_ = name_; - result.versionToUpdate_ = versionToUpdate_; - result.binaryData_ = binaryData_; - 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.iot.v1.ModifyCloudToDeviceConfigRequest) { - return mergeFrom((com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest other) { - if (other == com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest.getDefaultInstance()) - return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (other.getVersionToUpdate() != 0L) { - setVersionToUpdate(other.getVersionToUpdate()); - } - if (other.getBinaryData() != com.google.protobuf.ByteString.EMPTY) { - setBinaryData(other.getBinaryData()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 16: - { - versionToUpdate_ = input.readInt64(); - - break; - } // case 16 - case 26: - { - binaryData_ = input.readBytes(); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private long versionToUpdate_; - /** - * - * - *
-     * The version number to update. If this value is zero, it will not check the
-     * version number of the server and will always update the current version;
-     * otherwise, this update will fail if the version number found on the server
-     * does not match this version number. This is used to support multiple
-     * simultaneous updates without losing data.
-     * 
- * - * int64 version_to_update = 2; - * - * @return The versionToUpdate. - */ - @java.lang.Override - public long getVersionToUpdate() { - return versionToUpdate_; - } - /** - * - * - *
-     * The version number to update. If this value is zero, it will not check the
-     * version number of the server and will always update the current version;
-     * otherwise, this update will fail if the version number found on the server
-     * does not match this version number. This is used to support multiple
-     * simultaneous updates without losing data.
-     * 
- * - * int64 version_to_update = 2; - * - * @param value The versionToUpdate to set. - * @return This builder for chaining. - */ - public Builder setVersionToUpdate(long value) { - - versionToUpdate_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The version number to update. If this value is zero, it will not check the
-     * version number of the server and will always update the current version;
-     * otherwise, this update will fail if the version number found on the server
-     * does not match this version number. This is used to support multiple
-     * simultaneous updates without losing data.
-     * 
- * - * int64 version_to_update = 2; - * - * @return This builder for chaining. - */ - public Builder clearVersionToUpdate() { - - versionToUpdate_ = 0L; - onChanged(); - return this; - } - - private com.google.protobuf.ByteString binaryData_ = com.google.protobuf.ByteString.EMPTY; - /** - * - * - *
-     * Required. The configuration data for the device.
-     * 
- * - * bytes binary_data = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The binaryData. - */ - @java.lang.Override - public com.google.protobuf.ByteString getBinaryData() { - return binaryData_; - } - /** - * - * - *
-     * Required. The configuration data for the device.
-     * 
- * - * bytes binary_data = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The binaryData to set. - * @return This builder for chaining. - */ - public Builder setBinaryData(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - - binaryData_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The configuration data for the device.
-     * 
- * - * bytes binary_data = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return This builder for chaining. - */ - public Builder clearBinaryData() { - - binaryData_ = getDefaultInstance().getBinaryData(); - 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.iot.v1.ModifyCloudToDeviceConfigRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) - private static final com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest(); - } - - public static com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public ModifyCloudToDeviceConfigRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ModifyCloudToDeviceConfigRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ModifyCloudToDeviceConfigRequestOrBuilder.java deleted file mode 100644 index ee851ed3..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ModifyCloudToDeviceConfigRequestOrBuilder.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface ModifyCloudToDeviceConfigRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); - - /** - * - * - *
-   * The version number to update. If this value is zero, it will not check the
-   * version number of the server and will always update the current version;
-   * otherwise, this update will fail if the version number found on the server
-   * does not match this version number. This is used to support multiple
-   * simultaneous updates without losing data.
-   * 
- * - * int64 version_to_update = 2; - * - * @return The versionToUpdate. - */ - long getVersionToUpdate(); - - /** - * - * - *
-   * Required. The configuration data for the device.
-   * 
- * - * bytes binary_data = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The binaryData. - */ - com.google.protobuf.ByteString getBinaryData(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttConfig.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttConfig.java deleted file mode 100644 index 5a8cac34..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttConfig.java +++ /dev/null @@ -1,589 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The configuration of MQTT for a device registry.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.MqttConfig} - */ -public final class MqttConfig extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.MqttConfig) - MqttConfigOrBuilder { - private static final long serialVersionUID = 0L; - // Use MqttConfig.newBuilder() to construct. - private MqttConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private MqttConfig() { - mqttEnabledState_ = 0; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new MqttConfig(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_MqttConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_MqttConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.MqttConfig.class, - com.google.cloud.iot.v1.MqttConfig.Builder.class); - } - - public static final int MQTT_ENABLED_STATE_FIELD_NUMBER = 1; - private int mqttEnabledState_; - /** - * - * - *
-   * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-   * connections to this registry will fail.
-   * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @return The enum numeric value on the wire for mqttEnabledState. - */ - @java.lang.Override - public int getMqttEnabledStateValue() { - return mqttEnabledState_; - } - /** - * - * - *
-   * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-   * connections to this registry will fail.
-   * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @return The mqttEnabledState. - */ - @java.lang.Override - public com.google.cloud.iot.v1.MqttState getMqttEnabledState() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.MqttState result = - com.google.cloud.iot.v1.MqttState.valueOf(mqttEnabledState_); - return result == null ? com.google.cloud.iot.v1.MqttState.UNRECOGNIZED : result; - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (mqttEnabledState_ != com.google.cloud.iot.v1.MqttState.MQTT_STATE_UNSPECIFIED.getNumber()) { - output.writeEnum(1, mqttEnabledState_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (mqttEnabledState_ != com.google.cloud.iot.v1.MqttState.MQTT_STATE_UNSPECIFIED.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, mqttEnabledState_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.MqttConfig)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.MqttConfig other = (com.google.cloud.iot.v1.MqttConfig) obj; - - if (mqttEnabledState_ != other.mqttEnabledState_) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + MQTT_ENABLED_STATE_FIELD_NUMBER; - hash = (53 * hash) + mqttEnabledState_; - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.MqttConfig parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.MqttConfig 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.iot.v1.MqttConfig parseFrom(com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.MqttConfig 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.iot.v1.MqttConfig parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.MqttConfig parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.MqttConfig parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.MqttConfig 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.iot.v1.MqttConfig parseDelimitedFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.MqttConfig 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.iot.v1.MqttConfig parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.MqttConfig 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.iot.v1.MqttConfig 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 configuration of MQTT for a device registry.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.MqttConfig} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.MqttConfig) - com.google.cloud.iot.v1.MqttConfigOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_MqttConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_MqttConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.MqttConfig.class, - com.google.cloud.iot.v1.MqttConfig.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.MqttConfig.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - mqttEnabledState_ = 0; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_MqttConfig_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.MqttConfig getDefaultInstanceForType() { - return com.google.cloud.iot.v1.MqttConfig.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.MqttConfig build() { - com.google.cloud.iot.v1.MqttConfig result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.MqttConfig buildPartial() { - com.google.cloud.iot.v1.MqttConfig result = new com.google.cloud.iot.v1.MqttConfig(this); - result.mqttEnabledState_ = mqttEnabledState_; - 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.iot.v1.MqttConfig) { - return mergeFrom((com.google.cloud.iot.v1.MqttConfig) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.MqttConfig other) { - if (other == com.google.cloud.iot.v1.MqttConfig.getDefaultInstance()) return this; - if (other.mqttEnabledState_ != 0) { - setMqttEnabledStateValue(other.getMqttEnabledStateValue()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - mqttEnabledState_ = input.readEnum(); - - break; - } // case 8 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int mqttEnabledState_ = 0; - /** - * - * - *
-     * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-     * connections to this registry will fail.
-     * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @return The enum numeric value on the wire for mqttEnabledState. - */ - @java.lang.Override - public int getMqttEnabledStateValue() { - return mqttEnabledState_; - } - /** - * - * - *
-     * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-     * connections to this registry will fail.
-     * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @param value The enum numeric value on the wire for mqttEnabledState to set. - * @return This builder for chaining. - */ - public Builder setMqttEnabledStateValue(int value) { - - mqttEnabledState_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-     * connections to this registry will fail.
-     * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @return The mqttEnabledState. - */ - @java.lang.Override - public com.google.cloud.iot.v1.MqttState getMqttEnabledState() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.MqttState result = - com.google.cloud.iot.v1.MqttState.valueOf(mqttEnabledState_); - return result == null ? com.google.cloud.iot.v1.MqttState.UNRECOGNIZED : result; - } - /** - * - * - *
-     * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-     * connections to this registry will fail.
-     * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @param value The mqttEnabledState to set. - * @return This builder for chaining. - */ - public Builder setMqttEnabledState(com.google.cloud.iot.v1.MqttState value) { - if (value == null) { - throw new NullPointerException(); - } - - mqttEnabledState_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-     * connections to this registry will fail.
-     * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @return This builder for chaining. - */ - public Builder clearMqttEnabledState() { - - mqttEnabledState_ = 0; - onChanged(); - return this; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.MqttConfig) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.MqttConfig) - private static final com.google.cloud.iot.v1.MqttConfig DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.MqttConfig(); - } - - public static com.google.cloud.iot.v1.MqttConfig getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public MqttConfig parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.MqttConfig getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttConfigOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttConfigOrBuilder.java deleted file mode 100644 index 897b7f5e..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttConfigOrBuilder.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface MqttConfigOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.MqttConfig) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-   * connections to this registry will fail.
-   * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @return The enum numeric value on the wire for mqttEnabledState. - */ - int getMqttEnabledStateValue(); - /** - * - * - *
-   * If enabled, allows connections using the MQTT protocol. Otherwise, MQTT
-   * connections to this registry will fail.
-   * 
- * - * .google.cloud.iot.v1.MqttState mqtt_enabled_state = 1; - * - * @return The mqttEnabledState. - */ - com.google.cloud.iot.v1.MqttState getMqttEnabledState(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttState.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttState.java deleted file mode 100644 index b0de10ee..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttState.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Indicates whether an MQTT connection is enabled or disabled. See the field
- * description for details.
- * 
- * - * Protobuf enum {@code google.cloud.iot.v1.MqttState} - */ -public enum MqttState implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-   * No MQTT state specified. If not specified, MQTT will be enabled by default.
-   * 
- * - * MQTT_STATE_UNSPECIFIED = 0; - */ - MQTT_STATE_UNSPECIFIED(0), - /** - * - * - *
-   * Enables a MQTT connection.
-   * 
- * - * MQTT_ENABLED = 1; - */ - MQTT_ENABLED(1), - /** - * - * - *
-   * Disables a MQTT connection.
-   * 
- * - * MQTT_DISABLED = 2; - */ - MQTT_DISABLED(2), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-   * No MQTT state specified. If not specified, MQTT will be enabled by default.
-   * 
- * - * MQTT_STATE_UNSPECIFIED = 0; - */ - public static final int MQTT_STATE_UNSPECIFIED_VALUE = 0; - /** - * - * - *
-   * Enables a MQTT connection.
-   * 
- * - * MQTT_ENABLED = 1; - */ - public static final int MQTT_ENABLED_VALUE = 1; - /** - * - * - *
-   * Disables a MQTT connection.
-   * 
- * - * MQTT_DISABLED = 2; - */ - public static final int MQTT_DISABLED_VALUE = 2; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static MqttState valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static MqttState forNumber(int value) { - switch (value) { - case 0: - return MQTT_STATE_UNSPECIFIED; - case 1: - return MQTT_ENABLED; - case 2: - return MQTT_DISABLED; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public MqttState findValueByNumber(int number) { - return MqttState.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto.getDescriptor().getEnumTypes().get(0); - } - - private static final MqttState[] VALUES = values(); - - public static MqttState valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private MqttState(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.cloud.iot.v1.MqttState) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificate.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificate.java deleted file mode 100644 index bb750045..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificate.java +++ /dev/null @@ -1,1041 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * A public key certificate format and data.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.PublicKeyCertificate} - */ -public final class PublicKeyCertificate extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.PublicKeyCertificate) - PublicKeyCertificateOrBuilder { - private static final long serialVersionUID = 0L; - // Use PublicKeyCertificate.newBuilder() to construct. - private PublicKeyCertificate(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private PublicKeyCertificate() { - format_ = 0; - certificate_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PublicKeyCertificate(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCertificate_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCertificate_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.PublicKeyCertificate.class, - com.google.cloud.iot.v1.PublicKeyCertificate.Builder.class); - } - - public static final int FORMAT_FIELD_NUMBER = 1; - private int format_; - /** - * - * - *
-   * The certificate format.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @return The enum numeric value on the wire for format. - */ - @java.lang.Override - public int getFormatValue() { - return format_; - } - /** - * - * - *
-   * The certificate format.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @return The format. - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificateFormat getFormat() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.PublicKeyCertificateFormat result = - com.google.cloud.iot.v1.PublicKeyCertificateFormat.valueOf(format_); - return result == null - ? com.google.cloud.iot.v1.PublicKeyCertificateFormat.UNRECOGNIZED - : result; - } - - public static final int CERTIFICATE_FIELD_NUMBER = 2; - private volatile java.lang.Object certificate_; - /** - * - * - *
-   * The certificate data.
-   * 
- * - * string certificate = 2; - * - * @return The certificate. - */ - @java.lang.Override - public java.lang.String getCertificate() { - java.lang.Object ref = certificate_; - 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(); - certificate_ = s; - return s; - } - } - /** - * - * - *
-   * The certificate data.
-   * 
- * - * string certificate = 2; - * - * @return The bytes for certificate. - */ - @java.lang.Override - public com.google.protobuf.ByteString getCertificateBytes() { - java.lang.Object ref = certificate_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - certificate_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int X509_DETAILS_FIELD_NUMBER = 3; - private com.google.cloud.iot.v1.X509CertificateDetails x509Details_; - /** - * - * - *
-   * [Output only] The certificate details. Used only for X.509 certificates.
-   * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - * - * @return Whether the x509Details field is set. - */ - @java.lang.Override - public boolean hasX509Details() { - return x509Details_ != null; - } - /** - * - * - *
-   * [Output only] The certificate details. Used only for X.509 certificates.
-   * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - * - * @return The x509Details. - */ - @java.lang.Override - public com.google.cloud.iot.v1.X509CertificateDetails getX509Details() { - return x509Details_ == null - ? com.google.cloud.iot.v1.X509CertificateDetails.getDefaultInstance() - : x509Details_; - } - /** - * - * - *
-   * [Output only] The certificate details. Used only for X.509 certificates.
-   * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - @java.lang.Override - public com.google.cloud.iot.v1.X509CertificateDetailsOrBuilder getX509DetailsOrBuilder() { - return getX509Details(); - } - - 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 (format_ - != com.google.cloud.iot.v1.PublicKeyCertificateFormat - .UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT - .getNumber()) { - output.writeEnum(1, format_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(certificate_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, certificate_); - } - if (x509Details_ != null) { - output.writeMessage(3, getX509Details()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (format_ - != com.google.cloud.iot.v1.PublicKeyCertificateFormat - .UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT - .getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, format_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(certificate_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, certificate_); - } - if (x509Details_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getX509Details()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.PublicKeyCertificate)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.PublicKeyCertificate other = - (com.google.cloud.iot.v1.PublicKeyCertificate) obj; - - if (format_ != other.format_) return false; - if (!getCertificate().equals(other.getCertificate())) return false; - if (hasX509Details() != other.hasX509Details()) return false; - if (hasX509Details()) { - if (!getX509Details().equals(other.getX509Details())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + FORMAT_FIELD_NUMBER; - hash = (53 * hash) + format_; - hash = (37 * hash) + CERTIFICATE_FIELD_NUMBER; - hash = (53 * hash) + getCertificate().hashCode(); - if (hasX509Details()) { - hash = (37 * hash) + X509_DETAILS_FIELD_NUMBER; - hash = (53 * hash) + getX509Details().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate 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.iot.v1.PublicKeyCertificate parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate 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.iot.v1.PublicKeyCertificate parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate 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.iot.v1.PublicKeyCertificate parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate 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.iot.v1.PublicKeyCertificate parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate 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.iot.v1.PublicKeyCertificate 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 public key certificate format and data.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.PublicKeyCertificate} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.PublicKeyCertificate) - com.google.cloud.iot.v1.PublicKeyCertificateOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCertificate_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCertificate_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.PublicKeyCertificate.class, - com.google.cloud.iot.v1.PublicKeyCertificate.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.PublicKeyCertificate.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - format_ = 0; - - certificate_ = ""; - - if (x509DetailsBuilder_ == null) { - x509Details_ = null; - } else { - x509Details_ = null; - x509DetailsBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCertificate_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificate getDefaultInstanceForType() { - return com.google.cloud.iot.v1.PublicKeyCertificate.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificate build() { - com.google.cloud.iot.v1.PublicKeyCertificate result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificate buildPartial() { - com.google.cloud.iot.v1.PublicKeyCertificate result = - new com.google.cloud.iot.v1.PublicKeyCertificate(this); - result.format_ = format_; - result.certificate_ = certificate_; - if (x509DetailsBuilder_ == null) { - result.x509Details_ = x509Details_; - } else { - result.x509Details_ = x509DetailsBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.PublicKeyCertificate) { - return mergeFrom((com.google.cloud.iot.v1.PublicKeyCertificate) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.PublicKeyCertificate other) { - if (other == com.google.cloud.iot.v1.PublicKeyCertificate.getDefaultInstance()) return this; - if (other.format_ != 0) { - setFormatValue(other.getFormatValue()); - } - if (!other.getCertificate().isEmpty()) { - certificate_ = other.certificate_; - onChanged(); - } - if (other.hasX509Details()) { - mergeX509Details(other.getX509Details()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - format_ = input.readEnum(); - - break; - } // case 8 - case 18: - { - certificate_ = input.readStringRequireUtf8(); - - break; - } // case 18 - case 26: - { - input.readMessage(getX509DetailsFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int format_ = 0; - /** - * - * - *
-     * The certificate format.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @return The enum numeric value on the wire for format. - */ - @java.lang.Override - public int getFormatValue() { - return format_; - } - /** - * - * - *
-     * The certificate format.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @param value The enum numeric value on the wire for format to set. - * @return This builder for chaining. - */ - public Builder setFormatValue(int value) { - - format_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The certificate format.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @return The format. - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificateFormat getFormat() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.PublicKeyCertificateFormat result = - com.google.cloud.iot.v1.PublicKeyCertificateFormat.valueOf(format_); - return result == null - ? com.google.cloud.iot.v1.PublicKeyCertificateFormat.UNRECOGNIZED - : result; - } - /** - * - * - *
-     * The certificate format.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @param value The format to set. - * @return This builder for chaining. - */ - public Builder setFormat(com.google.cloud.iot.v1.PublicKeyCertificateFormat value) { - if (value == null) { - throw new NullPointerException(); - } - - format_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * The certificate format.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @return This builder for chaining. - */ - public Builder clearFormat() { - - format_ = 0; - onChanged(); - return this; - } - - private java.lang.Object certificate_ = ""; - /** - * - * - *
-     * The certificate data.
-     * 
- * - * string certificate = 2; - * - * @return The certificate. - */ - public java.lang.String getCertificate() { - java.lang.Object ref = certificate_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - certificate_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The certificate data.
-     * 
- * - * string certificate = 2; - * - * @return The bytes for certificate. - */ - public com.google.protobuf.ByteString getCertificateBytes() { - java.lang.Object ref = certificate_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - certificate_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The certificate data.
-     * 
- * - * string certificate = 2; - * - * @param value The certificate to set. - * @return This builder for chaining. - */ - public Builder setCertificate(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - certificate_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The certificate data.
-     * 
- * - * string certificate = 2; - * - * @return This builder for chaining. - */ - public Builder clearCertificate() { - - certificate_ = getDefaultInstance().getCertificate(); - onChanged(); - return this; - } - /** - * - * - *
-     * The certificate data.
-     * 
- * - * string certificate = 2; - * - * @param value The bytes for certificate to set. - * @return This builder for chaining. - */ - public Builder setCertificateBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - certificate_ = value; - onChanged(); - return this; - } - - private com.google.cloud.iot.v1.X509CertificateDetails x509Details_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.X509CertificateDetails, - com.google.cloud.iot.v1.X509CertificateDetails.Builder, - com.google.cloud.iot.v1.X509CertificateDetailsOrBuilder> - x509DetailsBuilder_; - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - * - * @return Whether the x509Details field is set. - */ - public boolean hasX509Details() { - return x509DetailsBuilder_ != null || x509Details_ != null; - } - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - * - * @return The x509Details. - */ - public com.google.cloud.iot.v1.X509CertificateDetails getX509Details() { - if (x509DetailsBuilder_ == null) { - return x509Details_ == null - ? com.google.cloud.iot.v1.X509CertificateDetails.getDefaultInstance() - : x509Details_; - } else { - return x509DetailsBuilder_.getMessage(); - } - } - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - public Builder setX509Details(com.google.cloud.iot.v1.X509CertificateDetails value) { - if (x509DetailsBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - x509Details_ = value; - onChanged(); - } else { - x509DetailsBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - public Builder setX509Details( - com.google.cloud.iot.v1.X509CertificateDetails.Builder builderForValue) { - if (x509DetailsBuilder_ == null) { - x509Details_ = builderForValue.build(); - onChanged(); - } else { - x509DetailsBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - public Builder mergeX509Details(com.google.cloud.iot.v1.X509CertificateDetails value) { - if (x509DetailsBuilder_ == null) { - if (x509Details_ != null) { - x509Details_ = - com.google.cloud.iot.v1.X509CertificateDetails.newBuilder(x509Details_) - .mergeFrom(value) - .buildPartial(); - } else { - x509Details_ = value; - } - onChanged(); - } else { - x509DetailsBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - public Builder clearX509Details() { - if (x509DetailsBuilder_ == null) { - x509Details_ = null; - onChanged(); - } else { - x509Details_ = null; - x509DetailsBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - public com.google.cloud.iot.v1.X509CertificateDetails.Builder getX509DetailsBuilder() { - - onChanged(); - return getX509DetailsFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - public com.google.cloud.iot.v1.X509CertificateDetailsOrBuilder getX509DetailsOrBuilder() { - if (x509DetailsBuilder_ != null) { - return x509DetailsBuilder_.getMessageOrBuilder(); - } else { - return x509Details_ == null - ? com.google.cloud.iot.v1.X509CertificateDetails.getDefaultInstance() - : x509Details_; - } - } - /** - * - * - *
-     * [Output only] The certificate details. Used only for X.509 certificates.
-     * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.X509CertificateDetails, - com.google.cloud.iot.v1.X509CertificateDetails.Builder, - com.google.cloud.iot.v1.X509CertificateDetailsOrBuilder> - getX509DetailsFieldBuilder() { - if (x509DetailsBuilder_ == null) { - x509DetailsBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.X509CertificateDetails, - com.google.cloud.iot.v1.X509CertificateDetails.Builder, - com.google.cloud.iot.v1.X509CertificateDetailsOrBuilder>( - getX509Details(), getParentForChildren(), isClean()); - x509Details_ = null; - } - return x509DetailsBuilder_; - } - - @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.iot.v1.PublicKeyCertificate) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.PublicKeyCertificate) - private static final com.google.cloud.iot.v1.PublicKeyCertificate DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.PublicKeyCertificate(); - } - - public static com.google.cloud.iot.v1.PublicKeyCertificate getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public PublicKeyCertificate parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificate getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificateFormat.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificateFormat.java deleted file mode 100644 index 2babfa94..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificateFormat.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The supported formats for the public key.
- * 
- * - * Protobuf enum {@code google.cloud.iot.v1.PublicKeyCertificateFormat} - */ -public enum PublicKeyCertificateFormat implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-   * The format has not been specified. This is an invalid default value and
-   * must not be used.
-   * 
- * - * UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT = 0; - */ - UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT(0), - /** - * - * - *
-   * An X.509v3 certificate ([RFC5280](https://www.ietf.org/rfc/rfc5280.txt)),
-   * encoded in base64, and wrapped by `-----BEGIN CERTIFICATE-----` and
-   * `-----END CERTIFICATE-----`.
-   * 
- * - * X509_CERTIFICATE_PEM = 1; - */ - X509_CERTIFICATE_PEM(1), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-   * The format has not been specified. This is an invalid default value and
-   * must not be used.
-   * 
- * - * UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT = 0; - */ - public static final int UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT_VALUE = 0; - /** - * - * - *
-   * An X.509v3 certificate ([RFC5280](https://www.ietf.org/rfc/rfc5280.txt)),
-   * encoded in base64, and wrapped by `-----BEGIN CERTIFICATE-----` and
-   * `-----END CERTIFICATE-----`.
-   * 
- * - * X509_CERTIFICATE_PEM = 1; - */ - public static final int X509_CERTIFICATE_PEM_VALUE = 1; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static PublicKeyCertificateFormat valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static PublicKeyCertificateFormat forNumber(int value) { - switch (value) { - case 0: - return UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT; - case 1: - return X509_CERTIFICATE_PEM; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap - internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap - internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public PublicKeyCertificateFormat findValueByNumber(int number) { - return PublicKeyCertificateFormat.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto.getDescriptor().getEnumTypes().get(5); - } - - private static final PublicKeyCertificateFormat[] VALUES = values(); - - public static PublicKeyCertificateFormat valueOf( - com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private PublicKeyCertificateFormat(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.cloud.iot.v1.PublicKeyCertificateFormat) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificateOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificateOrBuilder.java deleted file mode 100644 index 4f0ea283..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificateOrBuilder.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface PublicKeyCertificateOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.PublicKeyCertificate) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The certificate format.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @return The enum numeric value on the wire for format. - */ - int getFormatValue(); - /** - * - * - *
-   * The certificate format.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificateFormat format = 1; - * - * @return The format. - */ - com.google.cloud.iot.v1.PublicKeyCertificateFormat getFormat(); - - /** - * - * - *
-   * The certificate data.
-   * 
- * - * string certificate = 2; - * - * @return The certificate. - */ - java.lang.String getCertificate(); - /** - * - * - *
-   * The certificate data.
-   * 
- * - * string certificate = 2; - * - * @return The bytes for certificate. - */ - com.google.protobuf.ByteString getCertificateBytes(); - - /** - * - * - *
-   * [Output only] The certificate details. Used only for X.509 certificates.
-   * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - * - * @return Whether the x509Details field is set. - */ - boolean hasX509Details(); - /** - * - * - *
-   * [Output only] The certificate details. Used only for X.509 certificates.
-   * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - * - * @return The x509Details. - */ - com.google.cloud.iot.v1.X509CertificateDetails getX509Details(); - /** - * - * - *
-   * [Output only] The certificate details. Used only for X.509 certificates.
-   * 
- * - * .google.cloud.iot.v1.X509CertificateDetails x509_details = 3; - */ - com.google.cloud.iot.v1.X509CertificateDetailsOrBuilder getX509DetailsOrBuilder(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCredential.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCredential.java deleted file mode 100644 index 708e4842..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCredential.java +++ /dev/null @@ -1,765 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * A public key format and data.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.PublicKeyCredential} - */ -public final class PublicKeyCredential extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.PublicKeyCredential) - PublicKeyCredentialOrBuilder { - private static final long serialVersionUID = 0L; - // Use PublicKeyCredential.newBuilder() to construct. - private PublicKeyCredential(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private PublicKeyCredential() { - format_ = 0; - key_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new PublicKeyCredential(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCredential_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCredential_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.PublicKeyCredential.class, - com.google.cloud.iot.v1.PublicKeyCredential.Builder.class); - } - - public static final int FORMAT_FIELD_NUMBER = 1; - private int format_; - /** - * - * - *
-   * The format of the key.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @return The enum numeric value on the wire for format. - */ - @java.lang.Override - public int getFormatValue() { - return format_; - } - /** - * - * - *
-   * The format of the key.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @return The format. - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyFormat getFormat() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.PublicKeyFormat result = - com.google.cloud.iot.v1.PublicKeyFormat.valueOf(format_); - return result == null ? com.google.cloud.iot.v1.PublicKeyFormat.UNRECOGNIZED : result; - } - - public static final int KEY_FIELD_NUMBER = 2; - private volatile java.lang.Object key_; - /** - * - * - *
-   * The key data.
-   * 
- * - * string key = 2; - * - * @return The key. - */ - @java.lang.Override - public java.lang.String getKey() { - java.lang.Object ref = key_; - 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(); - key_ = s; - return s; - } - } - /** - * - * - *
-   * The key data.
-   * 
- * - * string key = 2; - * - * @return The bytes for key. - */ - @java.lang.Override - public com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - key_ = 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 (format_ - != com.google.cloud.iot.v1.PublicKeyFormat.UNSPECIFIED_PUBLIC_KEY_FORMAT.getNumber()) { - output.writeEnum(1, format_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, key_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (format_ - != com.google.cloud.iot.v1.PublicKeyFormat.UNSPECIFIED_PUBLIC_KEY_FORMAT.getNumber()) { - size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, format_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(key_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, key_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.PublicKeyCredential)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.PublicKeyCredential other = - (com.google.cloud.iot.v1.PublicKeyCredential) obj; - - if (format_ != other.format_) return false; - if (!getKey().equals(other.getKey())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + FORMAT_FIELD_NUMBER; - hash = (53 * hash) + format_; - hash = (37 * hash) + KEY_FIELD_NUMBER; - hash = (53 * hash) + getKey().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.PublicKeyCredential parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.PublicKeyCredential 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.iot.v1.PublicKeyCredential parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.PublicKeyCredential 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.iot.v1.PublicKeyCredential parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.PublicKeyCredential parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.PublicKeyCredential parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.PublicKeyCredential 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.iot.v1.PublicKeyCredential parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.PublicKeyCredential 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.iot.v1.PublicKeyCredential parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.PublicKeyCredential 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.iot.v1.PublicKeyCredential 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 public key format and data.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.PublicKeyCredential} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.PublicKeyCredential) - com.google.cloud.iot.v1.PublicKeyCredentialOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCredential_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCredential_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.PublicKeyCredential.class, - com.google.cloud.iot.v1.PublicKeyCredential.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.PublicKeyCredential.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - format_ = 0; - - key_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_PublicKeyCredential_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCredential getDefaultInstanceForType() { - return com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCredential build() { - com.google.cloud.iot.v1.PublicKeyCredential result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCredential buildPartial() { - com.google.cloud.iot.v1.PublicKeyCredential result = - new com.google.cloud.iot.v1.PublicKeyCredential(this); - result.format_ = format_; - result.key_ = key_; - 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.iot.v1.PublicKeyCredential) { - return mergeFrom((com.google.cloud.iot.v1.PublicKeyCredential) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.PublicKeyCredential other) { - if (other == com.google.cloud.iot.v1.PublicKeyCredential.getDefaultInstance()) return this; - if (other.format_ != 0) { - setFormatValue(other.getFormatValue()); - } - if (!other.getKey().isEmpty()) { - key_ = other.key_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 8: - { - format_ = input.readEnum(); - - break; - } // case 8 - case 18: - { - key_ = input.readStringRequireUtf8(); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int format_ = 0; - /** - * - * - *
-     * The format of the key.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @return The enum numeric value on the wire for format. - */ - @java.lang.Override - public int getFormatValue() { - return format_; - } - /** - * - * - *
-     * The format of the key.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @param value The enum numeric value on the wire for format to set. - * @return This builder for chaining. - */ - public Builder setFormatValue(int value) { - - format_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The format of the key.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @return The format. - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyFormat getFormat() { - @SuppressWarnings("deprecation") - com.google.cloud.iot.v1.PublicKeyFormat result = - com.google.cloud.iot.v1.PublicKeyFormat.valueOf(format_); - return result == null ? com.google.cloud.iot.v1.PublicKeyFormat.UNRECOGNIZED : result; - } - /** - * - * - *
-     * The format of the key.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @param value The format to set. - * @return This builder for chaining. - */ - public Builder setFormat(com.google.cloud.iot.v1.PublicKeyFormat value) { - if (value == null) { - throw new NullPointerException(); - } - - format_ = value.getNumber(); - onChanged(); - return this; - } - /** - * - * - *
-     * The format of the key.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @return This builder for chaining. - */ - public Builder clearFormat() { - - format_ = 0; - onChanged(); - return this; - } - - private java.lang.Object key_ = ""; - /** - * - * - *
-     * The key data.
-     * 
- * - * string key = 2; - * - * @return The key. - */ - public java.lang.String getKey() { - java.lang.Object ref = key_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - key_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The key data.
-     * 
- * - * string key = 2; - * - * @return The bytes for key. - */ - public com.google.protobuf.ByteString getKeyBytes() { - java.lang.Object ref = key_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - key_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The key data.
-     * 
- * - * string key = 2; - * - * @param value The key to set. - * @return This builder for chaining. - */ - public Builder setKey(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - key_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The key data.
-     * 
- * - * string key = 2; - * - * @return This builder for chaining. - */ - public Builder clearKey() { - - key_ = getDefaultInstance().getKey(); - onChanged(); - return this; - } - /** - * - * - *
-     * The key data.
-     * 
- * - * string key = 2; - * - * @param value The bytes for key to set. - * @return This builder for chaining. - */ - public Builder setKeyBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - key_ = 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.iot.v1.PublicKeyCredential) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.PublicKeyCredential) - private static final com.google.cloud.iot.v1.PublicKeyCredential DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.PublicKeyCredential(); - } - - public static com.google.cloud.iot.v1.PublicKeyCredential getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public PublicKeyCredential parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCredential getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCredentialOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCredentialOrBuilder.java deleted file mode 100644 index 948cd7c7..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCredentialOrBuilder.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface PublicKeyCredentialOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.PublicKeyCredential) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The format of the key.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @return The enum numeric value on the wire for format. - */ - int getFormatValue(); - /** - * - * - *
-   * The format of the key.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyFormat format = 1; - * - * @return The format. - */ - com.google.cloud.iot.v1.PublicKeyFormat getFormat(); - - /** - * - * - *
-   * The key data.
-   * 
- * - * string key = 2; - * - * @return The key. - */ - java.lang.String getKey(); - /** - * - * - *
-   * The key data.
-   * 
- * - * string key = 2; - * - * @return The bytes for key. - */ - com.google.protobuf.ByteString getKeyBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyFormat.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyFormat.java deleted file mode 100644 index 0b7315b6..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyFormat.java +++ /dev/null @@ -1,244 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The supported formats for the public key.
- * 
- * - * Protobuf enum {@code google.cloud.iot.v1.PublicKeyFormat} - */ -public enum PublicKeyFormat implements com.google.protobuf.ProtocolMessageEnum { - /** - * - * - *
-   * The format has not been specified. This is an invalid default value and
-   * must not be used.
-   * 
- * - * UNSPECIFIED_PUBLIC_KEY_FORMAT = 0; - */ - UNSPECIFIED_PUBLIC_KEY_FORMAT(0), - /** - * - * - *
-   * An RSA public key encoded in base64, and wrapped by
-   * `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----`. This can be
-   * used to verify `RS256` signatures in JWT tokens ([RFC7518](
-   * https://www.ietf.org/rfc/rfc7518.txt)).
-   * 
- * - * RSA_PEM = 3; - */ - RSA_PEM(3), - /** - * - * - *
-   * As RSA_PEM, but wrapped in an X.509v3 certificate ([RFC5280](
-   * https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by
-   * `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.
-   * 
- * - * RSA_X509_PEM = 1; - */ - RSA_X509_PEM(1), - /** - * - * - *
-   * Public key for the ECDSA algorithm using P-256 and SHA-256, encoded in
-   * base64, and wrapped by `-----BEGIN PUBLIC KEY-----` and `-----END
-   * PUBLIC KEY-----`. This can be used to verify JWT tokens with the `ES256`
-   * algorithm ([RFC7518](https://www.ietf.org/rfc/rfc7518.txt)). This curve is
-   * defined in [OpenSSL](https://www.openssl.org/) as the `prime256v1` curve.
-   * 
- * - * ES256_PEM = 2; - */ - ES256_PEM(2), - /** - * - * - *
-   * As ES256_PEM, but wrapped in an X.509v3 certificate ([RFC5280](
-   * https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by
-   * `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.
-   * 
- * - * ES256_X509_PEM = 4; - */ - ES256_X509_PEM(4), - UNRECOGNIZED(-1), - ; - - /** - * - * - *
-   * The format has not been specified. This is an invalid default value and
-   * must not be used.
-   * 
- * - * UNSPECIFIED_PUBLIC_KEY_FORMAT = 0; - */ - public static final int UNSPECIFIED_PUBLIC_KEY_FORMAT_VALUE = 0; - /** - * - * - *
-   * An RSA public key encoded in base64, and wrapped by
-   * `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----`. This can be
-   * used to verify `RS256` signatures in JWT tokens ([RFC7518](
-   * https://www.ietf.org/rfc/rfc7518.txt)).
-   * 
- * - * RSA_PEM = 3; - */ - public static final int RSA_PEM_VALUE = 3; - /** - * - * - *
-   * As RSA_PEM, but wrapped in an X.509v3 certificate ([RFC5280](
-   * https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by
-   * `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.
-   * 
- * - * RSA_X509_PEM = 1; - */ - public static final int RSA_X509_PEM_VALUE = 1; - /** - * - * - *
-   * Public key for the ECDSA algorithm using P-256 and SHA-256, encoded in
-   * base64, and wrapped by `-----BEGIN PUBLIC KEY-----` and `-----END
-   * PUBLIC KEY-----`. This can be used to verify JWT tokens with the `ES256`
-   * algorithm ([RFC7518](https://www.ietf.org/rfc/rfc7518.txt)). This curve is
-   * defined in [OpenSSL](https://www.openssl.org/) as the `prime256v1` curve.
-   * 
- * - * ES256_PEM = 2; - */ - public static final int ES256_PEM_VALUE = 2; - /** - * - * - *
-   * As ES256_PEM, but wrapped in an X.509v3 certificate ([RFC5280](
-   * https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by
-   * `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`.
-   * 
- * - * ES256_X509_PEM = 4; - */ - public static final int ES256_X509_PEM_VALUE = 4; - - public final int getNumber() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalArgumentException( - "Can't get the number of an unknown enum value."); - } - return value; - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - * @deprecated Use {@link #forNumber(int)} instead. - */ - @java.lang.Deprecated - public static PublicKeyFormat valueOf(int value) { - return forNumber(value); - } - - /** - * @param value The numeric wire value of the corresponding enum entry. - * @return The enum associated with the given numeric wire value. - */ - public static PublicKeyFormat forNumber(int value) { - switch (value) { - case 0: - return UNSPECIFIED_PUBLIC_KEY_FORMAT; - case 3: - return RSA_PEM; - case 1: - return RSA_X509_PEM; - case 2: - return ES256_PEM; - case 4: - return ES256_X509_PEM; - default: - return null; - } - } - - public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { - return internalValueMap; - } - - private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = - new com.google.protobuf.Internal.EnumLiteMap() { - public PublicKeyFormat findValueByNumber(int number) { - return PublicKeyFormat.forNumber(number); - } - }; - - public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { - if (this == UNRECOGNIZED) { - throw new java.lang.IllegalStateException( - "Can't get the descriptor of an unrecognized enum value."); - } - return getDescriptor().getValues().get(ordinal()); - } - - public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { - return getDescriptor(); - } - - public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto.getDescriptor().getEnumTypes().get(6); - } - - private static final PublicKeyFormat[] VALUES = values(); - - public static PublicKeyFormat valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { - if (desc.getType() != getDescriptor()) { - throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); - } - if (desc.getIndex() == -1) { - return UNRECOGNIZED; - } - return VALUES[desc.getIndex()]; - } - - private final int value; - - private PublicKeyFormat(int value) { - this.value = value; - } - - // @@protoc_insertion_point(enum_scope:google.cloud.iot.v1.PublicKeyFormat) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryCredential.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryCredential.java deleted file mode 100644 index bc019c16..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryCredential.java +++ /dev/null @@ -1,810 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * A server-stored registry credential used to validate device credentials.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.RegistryCredential} - */ -public final class RegistryCredential extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.RegistryCredential) - RegistryCredentialOrBuilder { - private static final long serialVersionUID = 0L; - // Use RegistryCredential.newBuilder() to construct. - private RegistryCredential(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private RegistryCredential() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new RegistryCredential(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_RegistryCredential_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_RegistryCredential_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.RegistryCredential.class, - com.google.cloud.iot.v1.RegistryCredential.Builder.class); - } - - private int credentialCase_ = 0; - private java.lang.Object credential_; - - public enum CredentialCase - implements - com.google.protobuf.Internal.EnumLite, - com.google.protobuf.AbstractMessage.InternalOneOfEnum { - PUBLIC_KEY_CERTIFICATE(1), - CREDENTIAL_NOT_SET(0); - private final int value; - - private CredentialCase(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 CredentialCase valueOf(int value) { - return forNumber(value); - } - - public static CredentialCase forNumber(int value) { - switch (value) { - case 1: - return PUBLIC_KEY_CERTIFICATE; - case 0: - return CREDENTIAL_NOT_SET; - default: - return null; - } - } - - public int getNumber() { - return this.value; - } - }; - - public CredentialCase getCredentialCase() { - return CredentialCase.forNumber(credentialCase_); - } - - public static final int PUBLIC_KEY_CERTIFICATE_FIELD_NUMBER = 1; - /** - * - * - *
-   * A public key certificate used to verify the device credentials.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - * - * @return Whether the publicKeyCertificate field is set. - */ - @java.lang.Override - public boolean hasPublicKeyCertificate() { - return credentialCase_ == 1; - } - /** - * - * - *
-   * A public key certificate used to verify the device credentials.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - * - * @return The publicKeyCertificate. - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificate getPublicKeyCertificate() { - if (credentialCase_ == 1) { - return (com.google.cloud.iot.v1.PublicKeyCertificate) credential_; - } - return com.google.cloud.iot.v1.PublicKeyCertificate.getDefaultInstance(); - } - /** - * - * - *
-   * A public key certificate used to verify the device credentials.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificateOrBuilder getPublicKeyCertificateOrBuilder() { - if (credentialCase_ == 1) { - return (com.google.cloud.iot.v1.PublicKeyCertificate) credential_; - } - return com.google.cloud.iot.v1.PublicKeyCertificate.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 (credentialCase_ == 1) { - output.writeMessage(1, (com.google.cloud.iot.v1.PublicKeyCertificate) credential_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (credentialCase_ == 1) { - size += - com.google.protobuf.CodedOutputStream.computeMessageSize( - 1, (com.google.cloud.iot.v1.PublicKeyCertificate) credential_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.RegistryCredential)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.RegistryCredential other = - (com.google.cloud.iot.v1.RegistryCredential) obj; - - if (!getCredentialCase().equals(other.getCredentialCase())) return false; - switch (credentialCase_) { - case 1: - if (!getPublicKeyCertificate().equals(other.getPublicKeyCertificate())) return false; - break; - case 0: - default: - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - switch (credentialCase_) { - case 1: - hash = (37 * hash) + PUBLIC_KEY_CERTIFICATE_FIELD_NUMBER; - hash = (53 * hash) + getPublicKeyCertificate().hashCode(); - break; - case 0: - default: - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.RegistryCredential parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.RegistryCredential 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.iot.v1.RegistryCredential parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.RegistryCredential 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.iot.v1.RegistryCredential parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.RegistryCredential parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.RegistryCredential parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.RegistryCredential 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.iot.v1.RegistryCredential parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.RegistryCredential 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.iot.v1.RegistryCredential parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.RegistryCredential 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.iot.v1.RegistryCredential 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 server-stored registry credential used to validate device credentials.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.RegistryCredential} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.RegistryCredential) - com.google.cloud.iot.v1.RegistryCredentialOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_RegistryCredential_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_RegistryCredential_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.RegistryCredential.class, - com.google.cloud.iot.v1.RegistryCredential.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.RegistryCredential.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (publicKeyCertificateBuilder_ != null) { - publicKeyCertificateBuilder_.clear(); - } - credentialCase_ = 0; - credential_ = null; - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_RegistryCredential_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.RegistryCredential getDefaultInstanceForType() { - return com.google.cloud.iot.v1.RegistryCredential.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.RegistryCredential build() { - com.google.cloud.iot.v1.RegistryCredential result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.RegistryCredential buildPartial() { - com.google.cloud.iot.v1.RegistryCredential result = - new com.google.cloud.iot.v1.RegistryCredential(this); - if (credentialCase_ == 1) { - if (publicKeyCertificateBuilder_ == null) { - result.credential_ = credential_; - } else { - result.credential_ = publicKeyCertificateBuilder_.build(); - } - } - result.credentialCase_ = credentialCase_; - 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.iot.v1.RegistryCredential) { - return mergeFrom((com.google.cloud.iot.v1.RegistryCredential) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.RegistryCredential other) { - if (other == com.google.cloud.iot.v1.RegistryCredential.getDefaultInstance()) return this; - switch (other.getCredentialCase()) { - case PUBLIC_KEY_CERTIFICATE: - { - mergePublicKeyCertificate(other.getPublicKeyCertificate()); - break; - } - case CREDENTIAL_NOT_SET: - { - break; - } - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage( - getPublicKeyCertificateFieldBuilder().getBuilder(), extensionRegistry); - credentialCase_ = 1; - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private int credentialCase_ = 0; - private java.lang.Object credential_; - - public CredentialCase getCredentialCase() { - return CredentialCase.forNumber(credentialCase_); - } - - public Builder clearCredential() { - credentialCase_ = 0; - credential_ = null; - onChanged(); - return this; - } - - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.PublicKeyCertificate, - com.google.cloud.iot.v1.PublicKeyCertificate.Builder, - com.google.cloud.iot.v1.PublicKeyCertificateOrBuilder> - publicKeyCertificateBuilder_; - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - * - * @return Whether the publicKeyCertificate field is set. - */ - @java.lang.Override - public boolean hasPublicKeyCertificate() { - return credentialCase_ == 1; - } - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - * - * @return The publicKeyCertificate. - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificate getPublicKeyCertificate() { - if (publicKeyCertificateBuilder_ == null) { - if (credentialCase_ == 1) { - return (com.google.cloud.iot.v1.PublicKeyCertificate) credential_; - } - return com.google.cloud.iot.v1.PublicKeyCertificate.getDefaultInstance(); - } else { - if (credentialCase_ == 1) { - return publicKeyCertificateBuilder_.getMessage(); - } - return com.google.cloud.iot.v1.PublicKeyCertificate.getDefaultInstance(); - } - } - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - public Builder setPublicKeyCertificate(com.google.cloud.iot.v1.PublicKeyCertificate value) { - if (publicKeyCertificateBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - credential_ = value; - onChanged(); - } else { - publicKeyCertificateBuilder_.setMessage(value); - } - credentialCase_ = 1; - return this; - } - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - public Builder setPublicKeyCertificate( - com.google.cloud.iot.v1.PublicKeyCertificate.Builder builderForValue) { - if (publicKeyCertificateBuilder_ == null) { - credential_ = builderForValue.build(); - onChanged(); - } else { - publicKeyCertificateBuilder_.setMessage(builderForValue.build()); - } - credentialCase_ = 1; - return this; - } - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - public Builder mergePublicKeyCertificate(com.google.cloud.iot.v1.PublicKeyCertificate value) { - if (publicKeyCertificateBuilder_ == null) { - if (credentialCase_ == 1 - && credential_ != com.google.cloud.iot.v1.PublicKeyCertificate.getDefaultInstance()) { - credential_ = - com.google.cloud.iot.v1.PublicKeyCertificate.newBuilder( - (com.google.cloud.iot.v1.PublicKeyCertificate) credential_) - .mergeFrom(value) - .buildPartial(); - } else { - credential_ = value; - } - onChanged(); - } else { - if (credentialCase_ == 1) { - publicKeyCertificateBuilder_.mergeFrom(value); - } else { - publicKeyCertificateBuilder_.setMessage(value); - } - } - credentialCase_ = 1; - return this; - } - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - public Builder clearPublicKeyCertificate() { - if (publicKeyCertificateBuilder_ == null) { - if (credentialCase_ == 1) { - credentialCase_ = 0; - credential_ = null; - onChanged(); - } - } else { - if (credentialCase_ == 1) { - credentialCase_ = 0; - credential_ = null; - } - publicKeyCertificateBuilder_.clear(); - } - return this; - } - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - public com.google.cloud.iot.v1.PublicKeyCertificate.Builder getPublicKeyCertificateBuilder() { - return getPublicKeyCertificateFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - @java.lang.Override - public com.google.cloud.iot.v1.PublicKeyCertificateOrBuilder - getPublicKeyCertificateOrBuilder() { - if ((credentialCase_ == 1) && (publicKeyCertificateBuilder_ != null)) { - return publicKeyCertificateBuilder_.getMessageOrBuilder(); - } else { - if (credentialCase_ == 1) { - return (com.google.cloud.iot.v1.PublicKeyCertificate) credential_; - } - return com.google.cloud.iot.v1.PublicKeyCertificate.getDefaultInstance(); - } - } - /** - * - * - *
-     * A public key certificate used to verify the device credentials.
-     * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.PublicKeyCertificate, - com.google.cloud.iot.v1.PublicKeyCertificate.Builder, - com.google.cloud.iot.v1.PublicKeyCertificateOrBuilder> - getPublicKeyCertificateFieldBuilder() { - if (publicKeyCertificateBuilder_ == null) { - if (!(credentialCase_ == 1)) { - credential_ = com.google.cloud.iot.v1.PublicKeyCertificate.getDefaultInstance(); - } - publicKeyCertificateBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.PublicKeyCertificate, - com.google.cloud.iot.v1.PublicKeyCertificate.Builder, - com.google.cloud.iot.v1.PublicKeyCertificateOrBuilder>( - (com.google.cloud.iot.v1.PublicKeyCertificate) credential_, - getParentForChildren(), - isClean()); - credential_ = null; - } - credentialCase_ = 1; - onChanged(); - ; - return publicKeyCertificateBuilder_; - } - - @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.iot.v1.RegistryCredential) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.RegistryCredential) - private static final com.google.cloud.iot.v1.RegistryCredential DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.RegistryCredential(); - } - - public static com.google.cloud.iot.v1.RegistryCredential getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public RegistryCredential parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.RegistryCredential getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryCredentialOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryCredentialOrBuilder.java deleted file mode 100644 index 4a8cac1e..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryCredentialOrBuilder.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface RegistryCredentialOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.RegistryCredential) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * A public key certificate used to verify the device credentials.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - * - * @return Whether the publicKeyCertificate field is set. - */ - boolean hasPublicKeyCertificate(); - /** - * - * - *
-   * A public key certificate used to verify the device credentials.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - * - * @return The publicKeyCertificate. - */ - com.google.cloud.iot.v1.PublicKeyCertificate getPublicKeyCertificate(); - /** - * - * - *
-   * A public key certificate used to verify the device credentials.
-   * 
- * - * .google.cloud.iot.v1.PublicKeyCertificate public_key_certificate = 1; - */ - com.google.cloud.iot.v1.PublicKeyCertificateOrBuilder getPublicKeyCertificateOrBuilder(); - - public com.google.cloud.iot.v1.RegistryCredential.CredentialCase getCredentialCase(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryName.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryName.java deleted file mode 100644 index 11dc867d..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryName.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.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 RegistryName implements ResourceName { - private static final PathTemplate PROJECT_LOCATION_REGISTRY = - PathTemplate.createWithoutUrlEncoding( - "projects/{project}/locations/{location}/registries/{registry}"); - private volatile Map fieldValuesMap; - private final String project; - private final String location; - private final String registry; - - @Deprecated - protected RegistryName() { - project = null; - location = null; - registry = null; - } - - private RegistryName(Builder builder) { - project = Preconditions.checkNotNull(builder.getProject()); - location = Preconditions.checkNotNull(builder.getLocation()); - registry = Preconditions.checkNotNull(builder.getRegistry()); - } - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getRegistry() { - return registry; - } - - public static Builder newBuilder() { - return new Builder(); - } - - public Builder toBuilder() { - return new Builder(this); - } - - public static RegistryName of(String project, String location, String registry) { - return newBuilder().setProject(project).setLocation(location).setRegistry(registry).build(); - } - - public static String format(String project, String location, String registry) { - return newBuilder() - .setProject(project) - .setLocation(location) - .setRegistry(registry) - .build() - .toString(); - } - - public static RegistryName parse(String formattedString) { - if (formattedString.isEmpty()) { - return null; - } - Map matchMap = - PROJECT_LOCATION_REGISTRY.validatedMatch( - formattedString, "RegistryName.parse: formattedString not in valid format"); - return of(matchMap.get("project"), matchMap.get("location"), matchMap.get("registry")); - } - - 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 (RegistryName value : values) { - if (value == null) { - list.add(""); - } else { - list.add(value.toString()); - } - } - return list; - } - - public static boolean isParsableFrom(String formattedString) { - return PROJECT_LOCATION_REGISTRY.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 (registry != null) { - fieldMapBuilder.put("registry", registry); - } - fieldValuesMap = fieldMapBuilder.build(); - } - } - } - return fieldValuesMap; - } - - public String getFieldValue(String fieldName) { - return getFieldValuesMap().get(fieldName); - } - - @Override - public String toString() { - return PROJECT_LOCATION_REGISTRY.instantiate( - "project", project, "location", location, "registry", registry); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if (o != null || getClass() == o.getClass()) { - RegistryName that = ((RegistryName) o); - return Objects.equals(this.project, that.project) - && Objects.equals(this.location, that.location) - && Objects.equals(this.registry, that.registry); - } - 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(registry); - return h; - } - - /** Builder for projects/{project}/locations/{location}/registries/{registry}. */ - public static class Builder { - private String project; - private String location; - private String registry; - - protected Builder() {} - - public String getProject() { - return project; - } - - public String getLocation() { - return location; - } - - public String getRegistry() { - return registry; - } - - public Builder setProject(String project) { - this.project = project; - return this; - } - - public Builder setLocation(String location) { - this.location = location; - return this; - } - - public Builder setRegistry(String registry) { - this.registry = registry; - return this; - } - - private Builder(RegistryName registryName) { - this.project = registryName.project; - this.location = registryName.location; - this.registry = registryName.registry; - } - - public RegistryName build() { - return new RegistryName(this); - } - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ResourcesProto.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ResourcesProto.java deleted file mode 100644 index b8663144..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ResourcesProto.java +++ /dev/null @@ -1,364 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public final class ResourcesProto { - private ResourcesProto() {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} - - public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { - registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); - } - - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_Device_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_Device_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_Device_MetadataEntry_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_Device_MetadataEntry_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_GatewayConfig_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_GatewayConfig_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_DeviceRegistry_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_MqttConfig_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_MqttConfig_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_HttpConfig_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_HttpConfig_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_EventNotificationConfig_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_EventNotificationConfig_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_StateNotificationConfig_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_StateNotificationConfig_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_RegistryCredential_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_RegistryCredential_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_X509CertificateDetails_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_X509CertificateDetails_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_PublicKeyCertificate_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_PublicKeyCertificate_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_DeviceCredential_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_DeviceCredential_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_PublicKeyCredential_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_PublicKeyCredential_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_DeviceConfig_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_DeviceConfig_fieldAccessorTable; - static final com.google.protobuf.Descriptors.Descriptor - internal_static_google_cloud_iot_v1_DeviceState_descriptor; - static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internal_static_google_cloud_iot_v1_DeviceState_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/iot/v1/resources.proto\022\023g" - + "oogle.cloud.iot.v1\032\031google/api/resource." - + "proto\032\037google/protobuf/timestamp.proto\032\027" - + "google/rpc/status.proto\"\260\007\n\006Device\022\n\n\002id" - + "\030\001 \001(\t\022\014\n\004name\030\002 \001(\t\022\016\n\006num_id\030\003 \001(\004\022:\n\013" - + "credentials\030\014 \003(\0132%.google.cloud.iot.v1." - + "DeviceCredential\0227\n\023last_heartbeat_time\030" - + "\007 \001(\0132\032.google.protobuf.Timestamp\0223\n\017las" - + "t_event_time\030\010 \001(\0132\032.google.protobuf.Tim" - + "estamp\0223\n\017last_state_time\030\024 \001(\0132\032.google" - + ".protobuf.Timestamp\0228\n\024last_config_ack_t" - + "ime\030\016 \001(\0132\032.google.protobuf.Timestamp\0229\n" - + "\025last_config_send_time\030\022 \001(\0132\032.google.pr" - + "otobuf.Timestamp\022\017\n\007blocked\030\023 \001(\010\0223\n\017las" - + "t_error_time\030\n \001(\0132\032.google.protobuf.Tim" - + "estamp\022-\n\021last_error_status\030\013 \001(\0132\022.goog" - + "le.rpc.Status\0221\n\006config\030\r \001(\0132!.google.c" - + "loud.iot.v1.DeviceConfig\022/\n\005state\030\020 \001(\0132" - + " .google.cloud.iot.v1.DeviceState\0220\n\tlog" - + "_level\030\025 \001(\0162\035.google.cloud.iot.v1.LogLe" - + "vel\022;\n\010metadata\030\021 \003(\0132).google.cloud.iot" - + ".v1.Device.MetadataEntry\022:\n\016gateway_conf" - + "ig\030\030 \001(\0132\".google.cloud.iot.v1.GatewayCo" - + "nfig\032/\n\rMetadataEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005va" - + "lue\030\002 \001(\t:\0028\001:s\352Ap\n\036cloudiot.googleapis." - + "com/Device\022Nprojects/{project}/locations" - + "/{location}/registries/{registry}/device" - + "s/{device}\"\356\001\n\rGatewayConfig\0226\n\014gateway_" - + "type\030\001 \001(\0162 .google.cloud.iot.v1.Gateway" - + "Type\022C\n\023gateway_auth_method\030\002 \001(\0162&.goog" - + "le.cloud.iot.v1.GatewayAuthMethod\022 \n\030las" - + "t_accessed_gateway_id\030\003 \001(\t\022>\n\032last_acce" - + "ssed_gateway_time\030\004 \001(\0132\032.google.protobu" - + "f.Timestamp\"\217\004\n\016DeviceRegistry\022\n\n\002id\030\001 \001" - + "(\t\022\014\n\004name\030\002 \001(\t\022P\n\032event_notification_c" - + "onfigs\030\n \003(\0132,.google.cloud.iot.v1.Event" - + "NotificationConfig\022O\n\031state_notification" - + "_config\030\007 \001(\0132,.google.cloud.iot.v1.Stat" - + "eNotificationConfig\0224\n\013mqtt_config\030\004 \001(\013" - + "2\037.google.cloud.iot.v1.MqttConfig\0224\n\013htt" - + "p_config\030\t \001(\0132\037.google.cloud.iot.v1.Htt" - + "pConfig\0220\n\tlog_level\030\013 \001(\0162\035.google.clou" - + "d.iot.v1.LogLevel\022<\n\013credentials\030\010 \003(\0132\'" - + ".google.cloud.iot.v1.RegistryCredential:" - + "d\352Aa\n cloudiot.googleapis.com/Registry\022=" - + "projects/{project}/locations/{location}/" - + "registries/{registry}\"H\n\nMqttConfig\022:\n\022m" - + "qtt_enabled_state\030\001 \001(\0162\036.google.cloud.i" - + "ot.v1.MqttState\"H\n\nHttpConfig\022:\n\022http_en" - + "abled_state\030\001 \001(\0162\036.google.cloud.iot.v1." - + "HttpState\"O\n\027EventNotificationConfig\022\031\n\021" - + "subfolder_matches\030\002 \001(\t\022\031\n\021pubsub_topic_" - + "name\030\001 \001(\t\"4\n\027StateNotificationConfig\022\031\n" - + "\021pubsub_topic_name\030\001 \001(\t\"o\n\022RegistryCred" - + "ential\022K\n\026public_key_certificate\030\001 \001(\0132)" - + ".google.cloud.iot.v1.PublicKeyCertificat" - + "eH\000B\014\n\ncredential\"\320\001\n\026X509CertificateDet" - + "ails\022\016\n\006issuer\030\001 \001(\t\022\017\n\007subject\030\002 \001(\t\022.\n" - + "\nstart_time\030\003 \001(\0132\032.google.protobuf.Time" - + "stamp\022/\n\013expiry_time\030\004 \001(\0132\032.google.prot" - + "obuf.Timestamp\022\033\n\023signature_algorithm\030\005 " - + "\001(\t\022\027\n\017public_key_type\030\006 \001(\t\"\257\001\n\024PublicK" - + "eyCertificate\022?\n\006format\030\001 \001(\0162/.google.c" - + "loud.iot.v1.PublicKeyCertificateFormat\022\023" - + "\n\013certificate\030\002 \001(\t\022A\n\014x509_details\030\003 \001(" - + "\0132+.google.cloud.iot.v1.X509CertificateD" - + "etails\"\225\001\n\020DeviceCredential\022>\n\npublic_ke" - + "y\030\002 \001(\0132(.google.cloud.iot.v1.PublicKeyC" - + "redentialH\000\0223\n\017expiration_time\030\006 \001(\0132\032.g" - + "oogle.protobuf.TimestampB\014\n\ncredential\"X" - + "\n\023PublicKeyCredential\0224\n\006format\030\001 \001(\0162$." - + "google.cloud.iot.v1.PublicKeyFormat\022\013\n\003k" - + "ey\030\002 \001(\t\"\240\001\n\014DeviceConfig\022\017\n\007version\030\001 \001" - + "(\003\0225\n\021cloud_update_time\030\002 \001(\0132\032.google.p" - + "rotobuf.Timestamp\0223\n\017device_ack_time\030\003 \001" - + "(\0132\032.google.protobuf.Timestamp\022\023\n\013binary" - + "_data\030\004 \001(\014\"S\n\013DeviceState\022/\n\013update_tim" - + "e\030\001 \001(\0132\032.google.protobuf.Timestamp\022\023\n\013b" - + "inary_data\030\002 \001(\014*L\n\tMqttState\022\032\n\026MQTT_ST" - + "ATE_UNSPECIFIED\020\000\022\020\n\014MQTT_ENABLED\020\001\022\021\n\rM" - + "QTT_DISABLED\020\002*L\n\tHttpState\022\032\n\026HTTP_STAT" - + "E_UNSPECIFIED\020\000\022\020\n\014HTTP_ENABLED\020\001\022\021\n\rHTT" - + "P_DISABLED\020\002*O\n\010LogLevel\022\031\n\025LOG_LEVEL_UN" - + "SPECIFIED\020\000\022\010\n\004NONE\020\n\022\t\n\005ERROR\020\024\022\010\n\004INFO" - + "\020\036\022\t\n\005DEBUG\020(*I\n\013GatewayType\022\034\n\030GATEWAY_" - + "TYPE_UNSPECIFIED\020\000\022\013\n\007GATEWAY\020\001\022\017\n\013NON_G" - + "ATEWAY\020\002*\221\001\n\021GatewayAuthMethod\022#\n\037GATEWA" - + "Y_AUTH_METHOD_UNSPECIFIED\020\000\022\024\n\020ASSOCIATI" - + "ON_ONLY\020\001\022\032\n\026DEVICE_AUTH_TOKEN_ONLY\020\002\022%\n" - + "!ASSOCIATION_AND_DEVICE_AUTH_TOKEN\020\003*e\n\032" - + "PublicKeyCertificateFormat\022-\n)UNSPECIFIE" - + "D_PUBLIC_KEY_CERTIFICATE_FORMAT\020\000\022\030\n\024X50" - + "9_CERTIFICATE_PEM\020\001*v\n\017PublicKeyFormat\022!" - + "\n\035UNSPECIFIED_PUBLIC_KEY_FORMAT\020\000\022\013\n\007RSA" - + "_PEM\020\003\022\020\n\014RSA_X509_PEM\020\001\022\r\n\tES256_PEM\020\002\022" - + "\022\n\016ES256_X509_PEM\020\004Bf\n\027com.google.cloud." - + "iot.v1B\016ResourcesProtoP\001Z6google.golang." - + "org/genproto/googleapis/cloud/iot/v1;iot" - + "\370\001\001b\006proto3" - }; - descriptor = - com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( - descriptorData, - new com.google.protobuf.Descriptors.FileDescriptor[] { - com.google.api.ResourceProto.getDescriptor(), - com.google.protobuf.TimestampProto.getDescriptor(), - com.google.rpc.StatusProto.getDescriptor(), - }); - internal_static_google_cloud_iot_v1_Device_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_google_cloud_iot_v1_Device_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_Device_descriptor, - new java.lang.String[] { - "Id", - "Name", - "NumId", - "Credentials", - "LastHeartbeatTime", - "LastEventTime", - "LastStateTime", - "LastConfigAckTime", - "LastConfigSendTime", - "Blocked", - "LastErrorTime", - "LastErrorStatus", - "Config", - "State", - "LogLevel", - "Metadata", - "GatewayConfig", - }); - internal_static_google_cloud_iot_v1_Device_MetadataEntry_descriptor = - internal_static_google_cloud_iot_v1_Device_descriptor.getNestedTypes().get(0); - internal_static_google_cloud_iot_v1_Device_MetadataEntry_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_Device_MetadataEntry_descriptor, - new java.lang.String[] { - "Key", "Value", - }); - internal_static_google_cloud_iot_v1_GatewayConfig_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_google_cloud_iot_v1_GatewayConfig_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_GatewayConfig_descriptor, - new java.lang.String[] { - "GatewayType", - "GatewayAuthMethod", - "LastAccessedGatewayId", - "LastAccessedGatewayTime", - }); - internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_google_cloud_iot_v1_DeviceRegistry_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_DeviceRegistry_descriptor, - new java.lang.String[] { - "Id", - "Name", - "EventNotificationConfigs", - "StateNotificationConfig", - "MqttConfig", - "HttpConfig", - "LogLevel", - "Credentials", - }); - internal_static_google_cloud_iot_v1_MqttConfig_descriptor = - getDescriptor().getMessageTypes().get(3); - internal_static_google_cloud_iot_v1_MqttConfig_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_MqttConfig_descriptor, - new java.lang.String[] { - "MqttEnabledState", - }); - internal_static_google_cloud_iot_v1_HttpConfig_descriptor = - getDescriptor().getMessageTypes().get(4); - internal_static_google_cloud_iot_v1_HttpConfig_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_HttpConfig_descriptor, - new java.lang.String[] { - "HttpEnabledState", - }); - internal_static_google_cloud_iot_v1_EventNotificationConfig_descriptor = - getDescriptor().getMessageTypes().get(5); - internal_static_google_cloud_iot_v1_EventNotificationConfig_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_EventNotificationConfig_descriptor, - new java.lang.String[] { - "SubfolderMatches", "PubsubTopicName", - }); - internal_static_google_cloud_iot_v1_StateNotificationConfig_descriptor = - getDescriptor().getMessageTypes().get(6); - internal_static_google_cloud_iot_v1_StateNotificationConfig_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_StateNotificationConfig_descriptor, - new java.lang.String[] { - "PubsubTopicName", - }); - internal_static_google_cloud_iot_v1_RegistryCredential_descriptor = - getDescriptor().getMessageTypes().get(7); - internal_static_google_cloud_iot_v1_RegistryCredential_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_RegistryCredential_descriptor, - new java.lang.String[] { - "PublicKeyCertificate", "Credential", - }); - internal_static_google_cloud_iot_v1_X509CertificateDetails_descriptor = - getDescriptor().getMessageTypes().get(8); - internal_static_google_cloud_iot_v1_X509CertificateDetails_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_X509CertificateDetails_descriptor, - new java.lang.String[] { - "Issuer", "Subject", "StartTime", "ExpiryTime", "SignatureAlgorithm", "PublicKeyType", - }); - internal_static_google_cloud_iot_v1_PublicKeyCertificate_descriptor = - getDescriptor().getMessageTypes().get(9); - internal_static_google_cloud_iot_v1_PublicKeyCertificate_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_PublicKeyCertificate_descriptor, - new java.lang.String[] { - "Format", "Certificate", "X509Details", - }); - internal_static_google_cloud_iot_v1_DeviceCredential_descriptor = - getDescriptor().getMessageTypes().get(10); - internal_static_google_cloud_iot_v1_DeviceCredential_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_DeviceCredential_descriptor, - new java.lang.String[] { - "PublicKey", "ExpirationTime", "Credential", - }); - internal_static_google_cloud_iot_v1_PublicKeyCredential_descriptor = - getDescriptor().getMessageTypes().get(11); - internal_static_google_cloud_iot_v1_PublicKeyCredential_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_PublicKeyCredential_descriptor, - new java.lang.String[] { - "Format", "Key", - }); - internal_static_google_cloud_iot_v1_DeviceConfig_descriptor = - getDescriptor().getMessageTypes().get(12); - internal_static_google_cloud_iot_v1_DeviceConfig_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_DeviceConfig_descriptor, - new java.lang.String[] { - "Version", "CloudUpdateTime", "DeviceAckTime", "BinaryData", - }); - internal_static_google_cloud_iot_v1_DeviceState_descriptor = - getDescriptor().getMessageTypes().get(13); - internal_static_google_cloud_iot_v1_DeviceState_fieldAccessorTable = - new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( - internal_static_google_cloud_iot_v1_DeviceState_descriptor, - new java.lang.String[] { - "UpdateTime", "BinaryData", - }); - com.google.protobuf.ExtensionRegistry registry = - com.google.protobuf.ExtensionRegistry.newInstance(); - registry.add(com.google.api.ResourceProto.resource); - com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( - descriptor, registry); - com.google.api.ResourceProto.getDescriptor(); - com.google.protobuf.TimestampProto.getDescriptor(); - com.google.rpc.StatusProto.getDescriptor(); - } - - // @@protoc_insertion_point(outer_class_scope) -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceRequest.java deleted file mode 100644 index 026783f8..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceRequest.java +++ /dev/null @@ -1,944 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `SendCommandToDevice`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.SendCommandToDeviceRequest} - */ -public final class SendCommandToDeviceRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.SendCommandToDeviceRequest) - SendCommandToDeviceRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use SendCommandToDeviceRequest.newBuilder() to construct. - private SendCommandToDeviceRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private SendCommandToDeviceRequest() { - name_ = ""; - binaryData_ = com.google.protobuf.ByteString.EMPTY; - subfolder_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new SendCommandToDeviceRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.SendCommandToDeviceRequest.class, - com.google.cloud.iot.v1.SendCommandToDeviceRequest.Builder.class); - } - - public static final int NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object name_; - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - @java.lang.Override - public java.lang.String getName() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - @java.lang.Override - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int BINARY_DATA_FIELD_NUMBER = 2; - private com.google.protobuf.ByteString binaryData_; - /** - * - * - *
-   * Required. The command data to send to the device.
-   * 
- * - * bytes binary_data = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The binaryData. - */ - @java.lang.Override - public com.google.protobuf.ByteString getBinaryData() { - return binaryData_; - } - - public static final int SUBFOLDER_FIELD_NUMBER = 3; - private volatile java.lang.Object subfolder_; - /** - * - * - *
-   * Optional subfolder for the command. If empty, the command will be delivered
-   * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-   * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-   * subfolders are allowed. This field must not have more than 256 characters,
-   * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-   * 
- * - * string subfolder = 3; - * - * @return The subfolder. - */ - @java.lang.Override - public java.lang.String getSubfolder() { - java.lang.Object ref = subfolder_; - 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(); - subfolder_ = s; - return s; - } - } - /** - * - * - *
-   * Optional subfolder for the command. If empty, the command will be delivered
-   * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-   * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-   * subfolders are allowed. This field must not have more than 256 characters,
-   * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-   * 
- * - * string subfolder = 3; - * - * @return The bytes for subfolder. - */ - @java.lang.Override - public com.google.protobuf.ByteString getSubfolderBytes() { - java.lang.Object ref = subfolder_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - subfolder_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); - } - if (!binaryData_.isEmpty()) { - output.writeBytes(2, binaryData_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(subfolder_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, subfolder_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); - } - if (!binaryData_.isEmpty()) { - size += com.google.protobuf.CodedOutputStream.computeBytesSize(2, binaryData_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(subfolder_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, subfolder_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.SendCommandToDeviceRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.SendCommandToDeviceRequest other = - (com.google.cloud.iot.v1.SendCommandToDeviceRequest) obj; - - if (!getName().equals(other.getName())) return false; - if (!getBinaryData().equals(other.getBinaryData())) return false; - if (!getSubfolder().equals(other.getSubfolder())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + NAME_FIELD_NUMBER; - hash = (53 * hash) + getName().hashCode(); - hash = (37 * hash) + BINARY_DATA_FIELD_NUMBER; - hash = (53 * hash) + getBinaryData().hashCode(); - hash = (37 * hash) + SUBFOLDER_FIELD_NUMBER; - hash = (53 * hash) + getSubfolder().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest 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.iot.v1.SendCommandToDeviceRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest 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.iot.v1.SendCommandToDeviceRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest 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.iot.v1.SendCommandToDeviceRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest 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.iot.v1.SendCommandToDeviceRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest 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.iot.v1.SendCommandToDeviceRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `SendCommandToDevice`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.SendCommandToDeviceRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.SendCommandToDeviceRequest) - com.google.cloud.iot.v1.SendCommandToDeviceRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.SendCommandToDeviceRequest.class, - com.google.cloud.iot.v1.SendCommandToDeviceRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.SendCommandToDeviceRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - name_ = ""; - - binaryData_ = com.google.protobuf.ByteString.EMPTY; - - subfolder_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.SendCommandToDeviceRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.SendCommandToDeviceRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.SendCommandToDeviceRequest build() { - com.google.cloud.iot.v1.SendCommandToDeviceRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.SendCommandToDeviceRequest buildPartial() { - com.google.cloud.iot.v1.SendCommandToDeviceRequest result = - new com.google.cloud.iot.v1.SendCommandToDeviceRequest(this); - result.name_ = name_; - result.binaryData_ = binaryData_; - result.subfolder_ = subfolder_; - 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.iot.v1.SendCommandToDeviceRequest) { - return mergeFrom((com.google.cloud.iot.v1.SendCommandToDeviceRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.SendCommandToDeviceRequest other) { - if (other == com.google.cloud.iot.v1.SendCommandToDeviceRequest.getDefaultInstance()) - return this; - if (!other.getName().isEmpty()) { - name_ = other.name_; - onChanged(); - } - if (other.getBinaryData() != com.google.protobuf.ByteString.EMPTY) { - setBinaryData(other.getBinaryData()); - } - if (!other.getSubfolder().isEmpty()) { - subfolder_ = other.subfolder_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - name_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - binaryData_ = input.readBytes(); - - break; - } // case 18 - case 26: - { - subfolder_ = input.readStringRequireUtf8(); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object name_ = ""; - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - public java.lang.String getName() { - java.lang.Object ref = name_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - name_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - public com.google.protobuf.ByteString getNameBytes() { - java.lang.Object ref = name_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - name_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The name to set. - * @return This builder for chaining. - */ - public Builder setName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - name_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearName() { - - name_ = getDefaultInstance().getName(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the device. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The bytes for name to set. - * @return This builder for chaining. - */ - public Builder setNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - name_ = value; - onChanged(); - return this; - } - - private com.google.protobuf.ByteString binaryData_ = com.google.protobuf.ByteString.EMPTY; - /** - * - * - *
-     * Required. The command data to send to the device.
-     * 
- * - * bytes binary_data = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The binaryData. - */ - @java.lang.Override - public com.google.protobuf.ByteString getBinaryData() { - return binaryData_; - } - /** - * - * - *
-     * Required. The command data to send to the device.
-     * 
- * - * bytes binary_data = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The binaryData to set. - * @return This builder for chaining. - */ - public Builder setBinaryData(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - - binaryData_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The command data to send to the device.
-     * 
- * - * bytes binary_data = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return This builder for chaining. - */ - public Builder clearBinaryData() { - - binaryData_ = getDefaultInstance().getBinaryData(); - onChanged(); - return this; - } - - private java.lang.Object subfolder_ = ""; - /** - * - * - *
-     * Optional subfolder for the command. If empty, the command will be delivered
-     * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-     * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-     * subfolders are allowed. This field must not have more than 256 characters,
-     * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-     * 
- * - * string subfolder = 3; - * - * @return The subfolder. - */ - public java.lang.String getSubfolder() { - java.lang.Object ref = subfolder_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - subfolder_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Optional subfolder for the command. If empty, the command will be delivered
-     * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-     * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-     * subfolders are allowed. This field must not have more than 256 characters,
-     * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-     * 
- * - * string subfolder = 3; - * - * @return The bytes for subfolder. - */ - public com.google.protobuf.ByteString getSubfolderBytes() { - java.lang.Object ref = subfolder_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - subfolder_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Optional subfolder for the command. If empty, the command will be delivered
-     * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-     * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-     * subfolders are allowed. This field must not have more than 256 characters,
-     * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-     * 
- * - * string subfolder = 3; - * - * @param value The subfolder to set. - * @return This builder for chaining. - */ - public Builder setSubfolder(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - subfolder_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Optional subfolder for the command. If empty, the command will be delivered
-     * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-     * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-     * subfolders are allowed. This field must not have more than 256 characters,
-     * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-     * 
- * - * string subfolder = 3; - * - * @return This builder for chaining. - */ - public Builder clearSubfolder() { - - subfolder_ = getDefaultInstance().getSubfolder(); - onChanged(); - return this; - } - /** - * - * - *
-     * Optional subfolder for the command. If empty, the command will be delivered
-     * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-     * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-     * subfolders are allowed. This field must not have more than 256 characters,
-     * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-     * 
- * - * string subfolder = 3; - * - * @param value The bytes for subfolder to set. - * @return This builder for chaining. - */ - public Builder setSubfolderBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - subfolder_ = 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.iot.v1.SendCommandToDeviceRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.SendCommandToDeviceRequest) - private static final com.google.cloud.iot.v1.SendCommandToDeviceRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.SendCommandToDeviceRequest(); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public SendCommandToDeviceRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.SendCommandToDeviceRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceRequestOrBuilder.java deleted file mode 100644 index a801f4f1..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceRequestOrBuilder.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface SendCommandToDeviceRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.SendCommandToDeviceRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The name. - */ - java.lang.String getName(); - /** - * - * - *
-   * Required. The name of the device. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0` or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * - * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for name. - */ - com.google.protobuf.ByteString getNameBytes(); - - /** - * - * - *
-   * Required. The command data to send to the device.
-   * 
- * - * bytes binary_data = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The binaryData. - */ - com.google.protobuf.ByteString getBinaryData(); - - /** - * - * - *
-   * Optional subfolder for the command. If empty, the command will be delivered
-   * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-   * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-   * subfolders are allowed. This field must not have more than 256 characters,
-   * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-   * 
- * - * string subfolder = 3; - * - * @return The subfolder. - */ - java.lang.String getSubfolder(); - /** - * - * - *
-   * Optional subfolder for the command. If empty, the command will be delivered
-   * to the /devices/{device-id}/commands topic, otherwise it will be delivered
-   * to the /devices/{device-id}/commands/{subfolder} topic. Multi-level
-   * subfolders are allowed. This field must not have more than 256 characters,
-   * and must not contain any MQTT wildcards ("+" or "#") or null characters.
-   * 
- * - * string subfolder = 3; - * - * @return The bytes for subfolder. - */ - com.google.protobuf.ByteString getSubfolderBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceResponse.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceResponse.java deleted file mode 100644 index 9ef82605..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceResponse.java +++ /dev/null @@ -1,436 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Response for `SendCommandToDevice`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.SendCommandToDeviceResponse} - */ -public final class SendCommandToDeviceResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.SendCommandToDeviceResponse) - SendCommandToDeviceResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use SendCommandToDeviceResponse.newBuilder() to construct. - private SendCommandToDeviceResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private SendCommandToDeviceResponse() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new SendCommandToDeviceResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.SendCommandToDeviceResponse.class, - com.google.cloud.iot.v1.SendCommandToDeviceResponse.Builder.class); - } - - 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 { - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.SendCommandToDeviceResponse)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.SendCommandToDeviceResponse other = - (com.google.cloud.iot.v1.SendCommandToDeviceResponse) obj; - - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse 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.iot.v1.SendCommandToDeviceResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse 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.iot.v1.SendCommandToDeviceResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse 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.iot.v1.SendCommandToDeviceResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse 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.iot.v1.SendCommandToDeviceResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse 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.iot.v1.SendCommandToDeviceResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Response for `SendCommandToDevice`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.SendCommandToDeviceResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.SendCommandToDeviceResponse) - com.google.cloud.iot.v1.SendCommandToDeviceResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.SendCommandToDeviceResponse.class, - com.google.cloud.iot.v1.SendCommandToDeviceResponse.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.SendCommandToDeviceResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_SendCommandToDeviceResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.SendCommandToDeviceResponse getDefaultInstanceForType() { - return com.google.cloud.iot.v1.SendCommandToDeviceResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.SendCommandToDeviceResponse build() { - com.google.cloud.iot.v1.SendCommandToDeviceResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.SendCommandToDeviceResponse buildPartial() { - com.google.cloud.iot.v1.SendCommandToDeviceResponse result = - new com.google.cloud.iot.v1.SendCommandToDeviceResponse(this); - 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.iot.v1.SendCommandToDeviceResponse) { - return mergeFrom((com.google.cloud.iot.v1.SendCommandToDeviceResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.SendCommandToDeviceResponse other) { - if (other == com.google.cloud.iot.v1.SendCommandToDeviceResponse.getDefaultInstance()) - return this; - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - @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.iot.v1.SendCommandToDeviceResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.SendCommandToDeviceResponse) - private static final com.google.cloud.iot.v1.SendCommandToDeviceResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.SendCommandToDeviceResponse(); - } - - public static com.google.cloud.iot.v1.SendCommandToDeviceResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public SendCommandToDeviceResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.SendCommandToDeviceResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceResponseOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceResponseOrBuilder.java deleted file mode 100644 index 2358336d..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceResponseOrBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface SendCommandToDeviceResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.SendCommandToDeviceResponse) - com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/StateNotificationConfig.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/StateNotificationConfig.java deleted file mode 100644 index b18bffae..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/StateNotificationConfig.java +++ /dev/null @@ -1,622 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * The configuration for notification of new states received from the device.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.StateNotificationConfig} - */ -public final class StateNotificationConfig extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.StateNotificationConfig) - StateNotificationConfigOrBuilder { - private static final long serialVersionUID = 0L; - // Use StateNotificationConfig.newBuilder() to construct. - private StateNotificationConfig(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private StateNotificationConfig() { - pubsubTopicName_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new StateNotificationConfig(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_StateNotificationConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_StateNotificationConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.StateNotificationConfig.class, - com.google.cloud.iot.v1.StateNotificationConfig.Builder.class); - } - - public static final int PUBSUB_TOPIC_NAME_FIELD_NUMBER = 1; - private volatile java.lang.Object pubsubTopicName_; - /** - * - * - *
-   * A Cloud Pub/Sub topic name. For example,
-   * `projects/myProject/topics/deviceEvents`.
-   * 
- * - * string pubsub_topic_name = 1; - * - * @return The pubsubTopicName. - */ - @java.lang.Override - public java.lang.String getPubsubTopicName() { - java.lang.Object ref = pubsubTopicName_; - 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(); - pubsubTopicName_ = s; - return s; - } - } - /** - * - * - *
-   * A Cloud Pub/Sub topic name. For example,
-   * `projects/myProject/topics/deviceEvents`.
-   * 
- * - * string pubsub_topic_name = 1; - * - * @return The bytes for pubsubTopicName. - */ - @java.lang.Override - public com.google.protobuf.ByteString getPubsubTopicNameBytes() { - java.lang.Object ref = pubsubTopicName_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - pubsubTopicName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pubsubTopicName_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pubsubTopicName_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pubsubTopicName_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pubsubTopicName_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.StateNotificationConfig)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.StateNotificationConfig other = - (com.google.cloud.iot.v1.StateNotificationConfig) obj; - - if (!getPubsubTopicName().equals(other.getPubsubTopicName())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + PUBSUB_TOPIC_NAME_FIELD_NUMBER; - hash = (53 * hash) + getPubsubTopicName().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.StateNotificationConfig parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.StateNotificationConfig 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.iot.v1.StateNotificationConfig parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.StateNotificationConfig 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.iot.v1.StateNotificationConfig parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.StateNotificationConfig parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.StateNotificationConfig parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.StateNotificationConfig 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.iot.v1.StateNotificationConfig parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.StateNotificationConfig 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.iot.v1.StateNotificationConfig parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.StateNotificationConfig 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.iot.v1.StateNotificationConfig 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 configuration for notification of new states received from the device.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.StateNotificationConfig} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.StateNotificationConfig) - com.google.cloud.iot.v1.StateNotificationConfigOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_StateNotificationConfig_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_StateNotificationConfig_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.StateNotificationConfig.class, - com.google.cloud.iot.v1.StateNotificationConfig.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.StateNotificationConfig.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - pubsubTopicName_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_StateNotificationConfig_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.StateNotificationConfig getDefaultInstanceForType() { - return com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.StateNotificationConfig build() { - com.google.cloud.iot.v1.StateNotificationConfig result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.StateNotificationConfig buildPartial() { - com.google.cloud.iot.v1.StateNotificationConfig result = - new com.google.cloud.iot.v1.StateNotificationConfig(this); - result.pubsubTopicName_ = pubsubTopicName_; - 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.iot.v1.StateNotificationConfig) { - return mergeFrom((com.google.cloud.iot.v1.StateNotificationConfig) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.StateNotificationConfig other) { - if (other == com.google.cloud.iot.v1.StateNotificationConfig.getDefaultInstance()) - return this; - if (!other.getPubsubTopicName().isEmpty()) { - pubsubTopicName_ = other.pubsubTopicName_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - pubsubTopicName_ = input.readStringRequireUtf8(); - - break; - } // case 10 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object pubsubTopicName_ = ""; - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @return The pubsubTopicName. - */ - public java.lang.String getPubsubTopicName() { - java.lang.Object ref = pubsubTopicName_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - pubsubTopicName_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @return The bytes for pubsubTopicName. - */ - public com.google.protobuf.ByteString getPubsubTopicNameBytes() { - java.lang.Object ref = pubsubTopicName_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - pubsubTopicName_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @param value The pubsubTopicName to set. - * @return This builder for chaining. - */ - public Builder setPubsubTopicName(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - pubsubTopicName_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @return This builder for chaining. - */ - public Builder clearPubsubTopicName() { - - pubsubTopicName_ = getDefaultInstance().getPubsubTopicName(); - onChanged(); - return this; - } - /** - * - * - *
-     * A Cloud Pub/Sub topic name. For example,
-     * `projects/myProject/topics/deviceEvents`.
-     * 
- * - * string pubsub_topic_name = 1; - * - * @param value The bytes for pubsubTopicName to set. - * @return This builder for chaining. - */ - public Builder setPubsubTopicNameBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - pubsubTopicName_ = 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.iot.v1.StateNotificationConfig) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.StateNotificationConfig) - private static final com.google.cloud.iot.v1.StateNotificationConfig DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.StateNotificationConfig(); - } - - public static com.google.cloud.iot.v1.StateNotificationConfig getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public StateNotificationConfig parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.StateNotificationConfig getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/StateNotificationConfigOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/StateNotificationConfigOrBuilder.java deleted file mode 100644 index af4e3e56..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/StateNotificationConfigOrBuilder.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface StateNotificationConfigOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.StateNotificationConfig) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * A Cloud Pub/Sub topic name. For example,
-   * `projects/myProject/topics/deviceEvents`.
-   * 
- * - * string pubsub_topic_name = 1; - * - * @return The pubsubTopicName. - */ - java.lang.String getPubsubTopicName(); - /** - * - * - *
-   * A Cloud Pub/Sub topic name. For example,
-   * `projects/myProject/topics/deviceEvents`.
-   * 
- * - * string pubsub_topic_name = 1; - * - * @return The bytes for pubsubTopicName. - */ - com.google.protobuf.ByteString getPubsubTopicNameBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayRequest.java deleted file mode 100644 index b79319d0..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayRequest.java +++ /dev/null @@ -1,1015 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `UnbindDeviceFromGateway`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.UnbindDeviceFromGatewayRequest} - */ -public final class UnbindDeviceFromGatewayRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.UnbindDeviceFromGatewayRequest) - UnbindDeviceFromGatewayRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use UnbindDeviceFromGatewayRequest.newBuilder() to construct. - private UnbindDeviceFromGatewayRequest( - com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private UnbindDeviceFromGatewayRequest() { - parent_ = ""; - gatewayId_ = ""; - deviceId_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new UnbindDeviceFromGatewayRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest.class, - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest.Builder.class); - } - - public static final int PARENT_FIELD_NUMBER = 1; - private volatile java.lang.Object parent_; - /** - * - * - *
-   * Required. The name of the registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - @java.lang.Override - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (ref instanceof java.lang.String) { - return (java.lang.String) ref; - } else { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The name of the registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * 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 GATEWAY_ID_FIELD_NUMBER = 2; - private volatile java.lang.Object gatewayId_; - /** - * - * - *
-   * Required. The value of `gateway_id` can be either the device numeric ID or the
-   * user-defined device identifier.
-   * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The gatewayId. - */ - @java.lang.Override - public java.lang.String getGatewayId() { - java.lang.Object ref = gatewayId_; - 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(); - gatewayId_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The value of `gateway_id` can be either the device numeric ID or the
-   * user-defined device identifier.
-   * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for gatewayId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getGatewayIdBytes() { - java.lang.Object ref = gatewayId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - gatewayId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int DEVICE_ID_FIELD_NUMBER = 3; - private volatile java.lang.Object deviceId_; - /** - * - * - *
-   * Required. The device to disassociate from the specified gateway. The value of
-   * `device_id` can be either the device numeric ID or the user-defined device
-   * identifier.
-   * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The deviceId. - */ - @java.lang.Override - public java.lang.String getDeviceId() { - java.lang.Object ref = deviceId_; - 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(); - deviceId_ = s; - return s; - } - } - /** - * - * - *
-   * Required. The device to disassociate from the specified gateway. The value of
-   * `device_id` can be either the device numeric ID or the user-defined device
-   * identifier.
-   * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for deviceId. - */ - @java.lang.Override - public com.google.protobuf.ByteString getDeviceIdBytes() { - java.lang.Object ref = deviceId_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - deviceId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(gatewayId_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, gatewayId_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deviceId_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 3, deviceId_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(gatewayId_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, gatewayId_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deviceId_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, deviceId_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest other = - (com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest) obj; - - if (!getParent().equals(other.getParent())) return false; - if (!getGatewayId().equals(other.getGatewayId())) return false; - if (!getDeviceId().equals(other.getDeviceId())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + PARENT_FIELD_NUMBER; - hash = (53 * hash) + getParent().hashCode(); - hash = (37 * hash) + GATEWAY_ID_FIELD_NUMBER; - hash = (53 * hash) + getGatewayId().hashCode(); - hash = (37 * hash) + DEVICE_ID_FIELD_NUMBER; - hash = (53 * hash) + getDeviceId().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest 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.iot.v1.UnbindDeviceFromGatewayRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest 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.iot.v1.UnbindDeviceFromGatewayRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest 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.iot.v1.UnbindDeviceFromGatewayRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest 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.iot.v1.UnbindDeviceFromGatewayRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest 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.iot.v1.UnbindDeviceFromGatewayRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `UnbindDeviceFromGateway`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.UnbindDeviceFromGatewayRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.UnbindDeviceFromGatewayRequest) - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest.class, - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - parent_ = ""; - - gatewayId_ = ""; - - deviceId_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest build() { - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest buildPartial() { - com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest result = - new com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest(this); - result.parent_ = parent_; - result.gatewayId_ = gatewayId_; - result.deviceId_ = deviceId_; - 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.iot.v1.UnbindDeviceFromGatewayRequest) { - return mergeFrom((com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest other) { - if (other == com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest.getDefaultInstance()) - return this; - if (!other.getParent().isEmpty()) { - parent_ = other.parent_; - onChanged(); - } - if (!other.getGatewayId().isEmpty()) { - gatewayId_ = other.gatewayId_; - onChanged(); - } - if (!other.getDeviceId().isEmpty()) { - deviceId_ = other.deviceId_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - parent_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - gatewayId_ = input.readStringRequireUtf8(); - - break; - } // case 18 - case 26: - { - deviceId_ = input.readStringRequireUtf8(); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object parent_ = ""; - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - public java.lang.String getParent() { - java.lang.Object ref = parent_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - parent_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - public com.google.protobuf.ByteString getParentBytes() { - java.lang.Object ref = parent_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - parent_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The parent to set. - * @return This builder for chaining. - */ - public Builder setParent(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - parent_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return This builder for chaining. - */ - public Builder clearParent() { - - parent_ = getDefaultInstance().getParent(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The name of the registry. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @param value The bytes for parent to set. - * @return This builder for chaining. - */ - public Builder setParentBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - parent_ = value; - onChanged(); - return this; - } - - private java.lang.Object gatewayId_ = ""; - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The gatewayId. - */ - public java.lang.String getGatewayId() { - java.lang.Object ref = gatewayId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - gatewayId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for gatewayId. - */ - public com.google.protobuf.ByteString getGatewayIdBytes() { - java.lang.Object ref = gatewayId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - gatewayId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The gatewayId to set. - * @return This builder for chaining. - */ - public Builder setGatewayId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - gatewayId_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return This builder for chaining. - */ - public Builder clearGatewayId() { - - gatewayId_ = getDefaultInstance().getGatewayId(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The value of `gateway_id` can be either the device numeric ID or the
-     * user-defined device identifier.
-     * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The bytes for gatewayId to set. - * @return This builder for chaining. - */ - public Builder setGatewayIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - gatewayId_ = value; - onChanged(); - return this; - } - - private java.lang.Object deviceId_ = ""; - /** - * - * - *
-     * Required. The device to disassociate from the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The deviceId. - */ - public java.lang.String getDeviceId() { - java.lang.Object ref = deviceId_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - deviceId_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * Required. The device to disassociate from the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for deviceId. - */ - public com.google.protobuf.ByteString getDeviceIdBytes() { - java.lang.Object ref = deviceId_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - deviceId_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * Required. The device to disassociate from the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The deviceId to set. - * @return This builder for chaining. - */ - public Builder setDeviceId(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - deviceId_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The device to disassociate from the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return This builder for chaining. - */ - public Builder clearDeviceId() { - - deviceId_ = getDefaultInstance().getDeviceId(); - onChanged(); - return this; - } - /** - * - * - *
-     * Required. The device to disassociate from the specified gateway. The value of
-     * `device_id` can be either the device numeric ID or the user-defined device
-     * identifier.
-     * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @param value The bytes for deviceId to set. - * @return This builder for chaining. - */ - public Builder setDeviceIdBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - deviceId_ = 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.iot.v1.UnbindDeviceFromGatewayRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.UnbindDeviceFromGatewayRequest) - private static final com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest(); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public UnbindDeviceFromGatewayRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayRequestOrBuilder.java deleted file mode 100644 index db01b831..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayRequestOrBuilder.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface UnbindDeviceFromGatewayRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.UnbindDeviceFromGatewayRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The name of the registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The parent. - */ - java.lang.String getParent(); - /** - * - * - *
-   * Required. The name of the registry. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } - * - * - * @return The bytes for parent. - */ - com.google.protobuf.ByteString getParentBytes(); - - /** - * - * - *
-   * Required. The value of `gateway_id` can be either the device numeric ID or the
-   * user-defined device identifier.
-   * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The gatewayId. - */ - java.lang.String getGatewayId(); - /** - * - * - *
-   * Required. The value of `gateway_id` can be either the device numeric ID or the
-   * user-defined device identifier.
-   * 
- * - * string gateway_id = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for gatewayId. - */ - com.google.protobuf.ByteString getGatewayIdBytes(); - - /** - * - * - *
-   * Required. The device to disassociate from the specified gateway. The value of
-   * `device_id` can be either the device numeric ID or the user-defined device
-   * identifier.
-   * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The deviceId. - */ - java.lang.String getDeviceId(); - /** - * - * - *
-   * Required. The device to disassociate from the specified gateway. The value of
-   * `device_id` can be either the device numeric ID or the user-defined device
-   * identifier.
-   * 
- * - * string device_id = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The bytes for deviceId. - */ - com.google.protobuf.ByteString getDeviceIdBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayResponse.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayResponse.java deleted file mode 100644 index 2567e43e..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayResponse.java +++ /dev/null @@ -1,438 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Response for `UnbindDeviceFromGateway`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.UnbindDeviceFromGatewayResponse} - */ -public final class UnbindDeviceFromGatewayResponse extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) - UnbindDeviceFromGatewayResponseOrBuilder { - private static final long serialVersionUID = 0L; - // Use UnbindDeviceFromGatewayResponse.newBuilder() to construct. - private UnbindDeviceFromGatewayResponse( - com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private UnbindDeviceFromGatewayResponse() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new UnbindDeviceFromGatewayResponse(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse.class, - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse.Builder.class); - } - - 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 { - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse other = - (com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) obj; - - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse 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.iot.v1.UnbindDeviceFromGatewayResponse parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse 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.iot.v1.UnbindDeviceFromGatewayResponse parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse 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.iot.v1.UnbindDeviceFromGatewayResponse parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse 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.iot.v1.UnbindDeviceFromGatewayResponse parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse 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.iot.v1.UnbindDeviceFromGatewayResponse prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Response for `UnbindDeviceFromGateway`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.UnbindDeviceFromGatewayResponse} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponseOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse.class, - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UnbindDeviceFromGatewayResponse_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse getDefaultInstanceForType() { - return com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse build() { - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse buildPartial() { - com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse result = - new com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse(this); - 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.iot.v1.UnbindDeviceFromGatewayResponse) { - return mergeFrom((com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse other) { - if (other == com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse.getDefaultInstance()) - return this; - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - @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.iot.v1.UnbindDeviceFromGatewayResponse) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) - private static final com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse(); - } - - public static com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public UnbindDeviceFromGatewayResponse parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayResponseOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayResponseOrBuilder.java deleted file mode 100644 index 52c1371e..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayResponseOrBuilder.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface UnbindDeviceFromGatewayResponseOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.UnbindDeviceFromGatewayResponse) - com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRegistryRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRegistryRequest.java deleted file mode 100644 index 5ea31620..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRegistryRequest.java +++ /dev/null @@ -1,1075 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `UpdateDeviceRegistry`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.UpdateDeviceRegistryRequest} - */ -public final class UpdateDeviceRegistryRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.UpdateDeviceRegistryRequest) - UpdateDeviceRegistryRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use UpdateDeviceRegistryRequest.newBuilder() to construct. - private UpdateDeviceRegistryRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private UpdateDeviceRegistryRequest() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new UpdateDeviceRegistryRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest.class, - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest.Builder.class); - } - - public static final int DEVICE_REGISTRY_FIELD_NUMBER = 1; - private com.google.cloud.iot.v1.DeviceRegistry deviceRegistry_; - /** - * - * - *
-   * Required. The new values for the device registry. The `id` field must be empty, and
-   * the `name` field must indicate the path of the resource. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the deviceRegistry field is set. - */ - @java.lang.Override - public boolean hasDeviceRegistry() { - return deviceRegistry_ != null; - } - /** - * - * - *
-   * Required. The new values for the device registry. The `id` field must be empty, and
-   * the `name` field must indicate the path of the resource. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The deviceRegistry. - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistry() { - return deviceRegistry_ == null - ? com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance() - : deviceRegistry_; - } - /** - * - * - *
-   * Required. The new values for the device registry. The `id` field must be empty, and
-   * the `name` field must indicate the path of the resource. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistryOrBuilder() { - return getDeviceRegistry(); - } - - public static final int UPDATE_MASK_FIELD_NUMBER = 2; - private com.google.protobuf.FieldMask updateMask_; - /** - * - * - *
-   * Required. Only updates the `device_registry` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `event_notification_config`, `http_config`,
-   * `mqtt_config`, and `state_notification_config`.
-   * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the updateMask field is set. - */ - @java.lang.Override - public boolean hasUpdateMask() { - return updateMask_ != null; - } - /** - * - * - *
-   * Required. Only updates the `device_registry` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `event_notification_config`, `http_config`,
-   * `mqtt_config`, and `state_notification_config`.
-   * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The updateMask. - */ - @java.lang.Override - public com.google.protobuf.FieldMask getUpdateMask() { - return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; - } - /** - * - * - *
-   * Required. Only updates the `device_registry` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `event_notification_config`, `http_config`,
-   * `mqtt_config`, and `state_notification_config`.
-   * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { - return getUpdateMask(); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (deviceRegistry_ != null) { - output.writeMessage(1, getDeviceRegistry()); - } - if (updateMask_ != null) { - output.writeMessage(2, getUpdateMask()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (deviceRegistry_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getDeviceRegistry()); - } - if (updateMask_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.UpdateDeviceRegistryRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest other = - (com.google.cloud.iot.v1.UpdateDeviceRegistryRequest) obj; - - if (hasDeviceRegistry() != other.hasDeviceRegistry()) return false; - if (hasDeviceRegistry()) { - if (!getDeviceRegistry().equals(other.getDeviceRegistry())) return false; - } - if (hasUpdateMask() != other.hasUpdateMask()) return false; - if (hasUpdateMask()) { - if (!getUpdateMask().equals(other.getUpdateMask())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDeviceRegistry()) { - hash = (37 * hash) + DEVICE_REGISTRY_FIELD_NUMBER; - hash = (53 * hash) + getDeviceRegistry().hashCode(); - } - if (hasUpdateMask()) { - hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; - hash = (53 * hash) + getUpdateMask().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest parseFrom( - java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest 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.iot.v1.UpdateDeviceRegistryRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest 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.iot.v1.UpdateDeviceRegistryRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest parseFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest 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.iot.v1.UpdateDeviceRegistryRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest 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.iot.v1.UpdateDeviceRegistryRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest 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.iot.v1.UpdateDeviceRegistryRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `UpdateDeviceRegistry`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.UpdateDeviceRegistryRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.UpdateDeviceRegistryRequest) - com.google.cloud.iot.v1.UpdateDeviceRegistryRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest.class, - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.UpdateDeviceRegistryRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (deviceRegistryBuilder_ == null) { - deviceRegistry_ = null; - } else { - deviceRegistry_ = null; - deviceRegistryBuilder_ = null; - } - if (updateMaskBuilder_ == null) { - updateMask_ = null; - } else { - updateMask_ = null; - updateMaskBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRegistryRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UpdateDeviceRegistryRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.UpdateDeviceRegistryRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.UpdateDeviceRegistryRequest build() { - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UpdateDeviceRegistryRequest buildPartial() { - com.google.cloud.iot.v1.UpdateDeviceRegistryRequest result = - new com.google.cloud.iot.v1.UpdateDeviceRegistryRequest(this); - if (deviceRegistryBuilder_ == null) { - result.deviceRegistry_ = deviceRegistry_; - } else { - result.deviceRegistry_ = deviceRegistryBuilder_.build(); - } - if (updateMaskBuilder_ == null) { - result.updateMask_ = updateMask_; - } else { - result.updateMask_ = updateMaskBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.UpdateDeviceRegistryRequest) { - return mergeFrom((com.google.cloud.iot.v1.UpdateDeviceRegistryRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.UpdateDeviceRegistryRequest other) { - if (other == com.google.cloud.iot.v1.UpdateDeviceRegistryRequest.getDefaultInstance()) - return this; - if (other.hasDeviceRegistry()) { - mergeDeviceRegistry(other.getDeviceRegistry()); - } - if (other.hasUpdateMask()) { - mergeUpdateMask(other.getUpdateMask()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - input.readMessage(getDeviceRegistryFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 10 - case 18: - { - input.readMessage(getUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 18 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.cloud.iot.v1.DeviceRegistry deviceRegistry_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder> - deviceRegistryBuilder_; - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the deviceRegistry field is set. - */ - public boolean hasDeviceRegistry() { - return deviceRegistryBuilder_ != null || deviceRegistry_ != null; - } - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The deviceRegistry. - */ - public com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistry() { - if (deviceRegistryBuilder_ == null) { - return deviceRegistry_ == null - ? com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance() - : deviceRegistry_; - } else { - return deviceRegistryBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDeviceRegistry(com.google.cloud.iot.v1.DeviceRegistry value) { - if (deviceRegistryBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - deviceRegistry_ = value; - onChanged(); - } else { - deviceRegistryBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDeviceRegistry( - com.google.cloud.iot.v1.DeviceRegistry.Builder builderForValue) { - if (deviceRegistryBuilder_ == null) { - deviceRegistry_ = builderForValue.build(); - onChanged(); - } else { - deviceRegistryBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDeviceRegistry(com.google.cloud.iot.v1.DeviceRegistry value) { - if (deviceRegistryBuilder_ == null) { - if (deviceRegistry_ != null) { - deviceRegistry_ = - com.google.cloud.iot.v1.DeviceRegistry.newBuilder(deviceRegistry_) - .mergeFrom(value) - .buildPartial(); - } else { - deviceRegistry_ = value; - } - onChanged(); - } else { - deviceRegistryBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDeviceRegistry() { - if (deviceRegistryBuilder_ == null) { - deviceRegistry_ = null; - onChanged(); - } else { - deviceRegistry_ = null; - deviceRegistryBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.iot.v1.DeviceRegistry.Builder getDeviceRegistryBuilder() { - - onChanged(); - return getDeviceRegistryFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistryOrBuilder() { - if (deviceRegistryBuilder_ != null) { - return deviceRegistryBuilder_.getMessageOrBuilder(); - } else { - return deviceRegistry_ == null - ? com.google.cloud.iot.v1.DeviceRegistry.getDefaultInstance() - : deviceRegistry_; - } - } - /** - * - * - *
-     * Required. The new values for the device registry. The `id` field must be empty, and
-     * the `name` field must indicate the path of the resource. For example,
-     * `projects/example-project/locations/us-central1/registries/my-registry`.
-     * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder> - getDeviceRegistryFieldBuilder() { - if (deviceRegistryBuilder_ == null) { - deviceRegistryBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.DeviceRegistry, - com.google.cloud.iot.v1.DeviceRegistry.Builder, - com.google.cloud.iot.v1.DeviceRegistryOrBuilder>( - getDeviceRegistry(), getParentForChildren(), isClean()); - deviceRegistry_ = null; - } - return deviceRegistryBuilder_; - } - - 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_; - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the updateMask field is set. - */ - public boolean hasUpdateMask() { - return updateMaskBuilder_ != null || updateMask_ != null; - } - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @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(); - } - } - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - } - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { - if (updateMaskBuilder_ == null) { - updateMask_ = builderForValue.build(); - onChanged(); - } else { - updateMaskBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - } - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearUpdateMask() { - if (updateMaskBuilder_ == null) { - updateMask_ = null; - onChanged(); - } else { - updateMask_ = null; - updateMaskBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { - - onChanged(); - return getUpdateMaskFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { - if (updateMaskBuilder_ != null) { - return updateMaskBuilder_.getMessageOrBuilder(); - } else { - return updateMask_ == null - ? com.google.protobuf.FieldMask.getDefaultInstance() - : updateMask_; - } - } - /** - * - * - *
-     * Required. Only updates the `device_registry` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `event_notification_config`, `http_config`,
-     * `mqtt_config`, and `state_notification_config`.
-     * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder> - getUpdateMaskFieldBuilder() { - if (updateMaskBuilder_ == null) { - updateMaskBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder>( - getUpdateMask(), getParentForChildren(), isClean()); - updateMask_ = null; - } - return updateMaskBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.UpdateDeviceRegistryRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.UpdateDeviceRegistryRequest) - private static final com.google.cloud.iot.v1.UpdateDeviceRegistryRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.UpdateDeviceRegistryRequest(); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRegistryRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public UpdateDeviceRegistryRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UpdateDeviceRegistryRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRegistryRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRegistryRequestOrBuilder.java deleted file mode 100644 index 7fcb8a25..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRegistryRequestOrBuilder.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface UpdateDeviceRegistryRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.UpdateDeviceRegistryRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The new values for the device registry. The `id` field must be empty, and
-   * the `name` field must indicate the path of the resource. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the deviceRegistry field is set. - */ - boolean hasDeviceRegistry(); - /** - * - * - *
-   * Required. The new values for the device registry. The `id` field must be empty, and
-   * the `name` field must indicate the path of the resource. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The deviceRegistry. - */ - com.google.cloud.iot.v1.DeviceRegistry getDeviceRegistry(); - /** - * - * - *
-   * Required. The new values for the device registry. The `id` field must be empty, and
-   * the `name` field must indicate the path of the resource. For example,
-   * `projects/example-project/locations/us-central1/registries/my-registry`.
-   * 
- * - * - * .google.cloud.iot.v1.DeviceRegistry device_registry = 1 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.cloud.iot.v1.DeviceRegistryOrBuilder getDeviceRegistryOrBuilder(); - - /** - * - * - *
-   * Required. Only updates the `device_registry` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `event_notification_config`, `http_config`,
-   * `mqtt_config`, and `state_notification_config`.
-   * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the updateMask field is set. - */ - boolean hasUpdateMask(); - /** - * - * - *
-   * Required. Only updates the `device_registry` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `event_notification_config`, `http_config`,
-   * `mqtt_config`, and `state_notification_config`.
-   * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The updateMask. - */ - com.google.protobuf.FieldMask getUpdateMask(); - /** - * - * - *
-   * Required. Only updates the `device_registry` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `event_notification_config`, `http_config`,
-   * `mqtt_config`, and `state_notification_config`.
-   * 
- * - * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRequest.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRequest.java deleted file mode 100644 index 2dc91ad7..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRequest.java +++ /dev/null @@ -1,1050 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Request for `UpdateDevice`.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.UpdateDeviceRequest} - */ -public final class UpdateDeviceRequest extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.UpdateDeviceRequest) - UpdateDeviceRequestOrBuilder { - private static final long serialVersionUID = 0L; - // Use UpdateDeviceRequest.newBuilder() to construct. - private UpdateDeviceRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private UpdateDeviceRequest() {} - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new UpdateDeviceRequest(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.UpdateDeviceRequest.class, - com.google.cloud.iot.v1.UpdateDeviceRequest.Builder.class); - } - - public static final int DEVICE_FIELD_NUMBER = 2; - private com.google.cloud.iot.v1.Device device_; - /** - * - * - *
-   * Required. The new values for the device. The `id` and `num_id` fields must
-   * be empty, and the field `name` must specify the name path. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return Whether the device field is set. - */ - @java.lang.Override - public boolean hasDevice() { - return device_ != null; - } - /** - * - * - *
-   * Required. The new values for the device. The `id` and `num_id` fields must
-   * be empty, and the field `name` must specify the name path. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The device. - */ - @java.lang.Override - public com.google.cloud.iot.v1.Device getDevice() { - return device_ == null ? com.google.cloud.iot.v1.Device.getDefaultInstance() : device_; - } - /** - * - * - *
-   * Required. The new values for the device. The `id` and `num_id` fields must
-   * be empty, and the field `name` must specify the name path. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - @java.lang.Override - public com.google.cloud.iot.v1.DeviceOrBuilder getDeviceOrBuilder() { - return getDevice(); - } - - public static final int UPDATE_MASK_FIELD_NUMBER = 3; - private com.google.protobuf.FieldMask updateMask_; - /** - * - * - *
-   * Required. Only updates the `device` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-   * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the updateMask field is set. - */ - @java.lang.Override - public boolean hasUpdateMask() { - return updateMask_ != null; - } - /** - * - * - *
-   * Required. Only updates the `device` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-   * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The updateMask. - */ - @java.lang.Override - public com.google.protobuf.FieldMask getUpdateMask() { - return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; - } - /** - * - * - *
-   * Required. Only updates the `device` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-   * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - @java.lang.Override - public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { - return getUpdateMask(); - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (device_ != null) { - output.writeMessage(2, getDevice()); - } - if (updateMask_ != null) { - output.writeMessage(3, getUpdateMask()); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (device_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getDevice()); - } - if (updateMask_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getUpdateMask()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.UpdateDeviceRequest)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.UpdateDeviceRequest other = - (com.google.cloud.iot.v1.UpdateDeviceRequest) obj; - - if (hasDevice() != other.hasDevice()) return false; - if (hasDevice()) { - if (!getDevice().equals(other.getDevice())) return false; - } - if (hasUpdateMask() != other.hasUpdateMask()) return false; - if (hasUpdateMask()) { - if (!getUpdateMask().equals(other.getUpdateMask())) return false; - } - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - if (hasDevice()) { - hash = (37 * hash) + DEVICE_FIELD_NUMBER; - hash = (53 * hash) + getDevice().hashCode(); - } - if (hasUpdateMask()) { - hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; - hash = (53 * hash) + getUpdateMask().hashCode(); - } - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest 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.iot.v1.UpdateDeviceRequest parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest 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.iot.v1.UpdateDeviceRequest parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest 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.iot.v1.UpdateDeviceRequest parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest 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.iot.v1.UpdateDeviceRequest parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest 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.iot.v1.UpdateDeviceRequest prototype) { - return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); - } - - @java.lang.Override - public Builder toBuilder() { - return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); - } - - @java.lang.Override - protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - Builder builder = new Builder(parent); - return builder; - } - /** - * - * - *
-   * Request for `UpdateDevice`.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.UpdateDeviceRequest} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.UpdateDeviceRequest) - com.google.cloud.iot.v1.UpdateDeviceRequestOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRequest_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRequest_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.UpdateDeviceRequest.class, - com.google.cloud.iot.v1.UpdateDeviceRequest.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.UpdateDeviceRequest.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - if (deviceBuilder_ == null) { - device_ = null; - } else { - device_ = null; - deviceBuilder_ = null; - } - if (updateMaskBuilder_ == null) { - updateMask_ = null; - } else { - updateMask_ = null; - updateMaskBuilder_ = null; - } - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.DeviceManagerProto - .internal_static_google_cloud_iot_v1_UpdateDeviceRequest_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UpdateDeviceRequest getDefaultInstanceForType() { - return com.google.cloud.iot.v1.UpdateDeviceRequest.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.UpdateDeviceRequest build() { - com.google.cloud.iot.v1.UpdateDeviceRequest result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UpdateDeviceRequest buildPartial() { - com.google.cloud.iot.v1.UpdateDeviceRequest result = - new com.google.cloud.iot.v1.UpdateDeviceRequest(this); - if (deviceBuilder_ == null) { - result.device_ = device_; - } else { - result.device_ = deviceBuilder_.build(); - } - if (updateMaskBuilder_ == null) { - result.updateMask_ = updateMask_; - } else { - result.updateMask_ = updateMaskBuilder_.build(); - } - onBuilt(); - return result; - } - - @java.lang.Override - public Builder clone() { - return super.clone(); - } - - @java.lang.Override - public Builder setField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.setField(field, value); - } - - @java.lang.Override - public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { - return super.clearField(field); - } - - @java.lang.Override - public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { - return super.clearOneof(oneof); - } - - @java.lang.Override - public Builder setRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { - return super.setRepeatedField(field, index, value); - } - - @java.lang.Override - public Builder addRepeatedField( - com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { - return super.addRepeatedField(field, value); - } - - @java.lang.Override - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof com.google.cloud.iot.v1.UpdateDeviceRequest) { - return mergeFrom((com.google.cloud.iot.v1.UpdateDeviceRequest) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.UpdateDeviceRequest other) { - if (other == com.google.cloud.iot.v1.UpdateDeviceRequest.getDefaultInstance()) return this; - if (other.hasDevice()) { - mergeDevice(other.getDevice()); - } - if (other.hasUpdateMask()) { - mergeUpdateMask(other.getUpdateMask()); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 18: - { - input.readMessage(getDeviceFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 18 - case 26: - { - input.readMessage(getUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 26 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private com.google.cloud.iot.v1.Device device_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder> - deviceBuilder_; - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the device field is set. - */ - public boolean hasDevice() { - return deviceBuilder_ != null || device_ != null; - } - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The device. - */ - public com.google.cloud.iot.v1.Device getDevice() { - if (deviceBuilder_ == null) { - return device_ == null ? com.google.cloud.iot.v1.Device.getDefaultInstance() : device_; - } else { - return deviceBuilder_.getMessage(); - } - } - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDevice(com.google.cloud.iot.v1.Device value) { - if (deviceBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - device_ = value; - onChanged(); - } else { - deviceBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setDevice(com.google.cloud.iot.v1.Device.Builder builderForValue) { - if (deviceBuilder_ == null) { - device_ = builderForValue.build(); - onChanged(); - } else { - deviceBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder mergeDevice(com.google.cloud.iot.v1.Device value) { - if (deviceBuilder_ == null) { - if (device_ != null) { - device_ = - com.google.cloud.iot.v1.Device.newBuilder(device_).mergeFrom(value).buildPartial(); - } else { - device_ = value; - } - onChanged(); - } else { - deviceBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearDevice() { - if (deviceBuilder_ == null) { - device_ = null; - onChanged(); - } else { - device_ = null; - deviceBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.iot.v1.Device.Builder getDeviceBuilder() { - - onChanged(); - return getDeviceFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.cloud.iot.v1.DeviceOrBuilder getDeviceOrBuilder() { - if (deviceBuilder_ != null) { - return deviceBuilder_.getMessageOrBuilder(); - } else { - return device_ == null ? com.google.cloud.iot.v1.Device.getDefaultInstance() : device_; - } - } - /** - * - * - *
-     * Required. The new values for the device. The `id` and `num_id` fields must
-     * be empty, and the field `name` must specify the name path. For example,
-     * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-     * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-     * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder> - getDeviceFieldBuilder() { - if (deviceBuilder_ == null) { - deviceBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.cloud.iot.v1.Device, - com.google.cloud.iot.v1.Device.Builder, - com.google.cloud.iot.v1.DeviceOrBuilder>( - getDevice(), getParentForChildren(), isClean()); - device_ = null; - } - return deviceBuilder_; - } - - 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_; - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the updateMask field is set. - */ - public boolean hasUpdateMask() { - return updateMaskBuilder_ != null || updateMask_ != null; - } - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @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(); - } - } - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - } - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { - if (updateMaskBuilder_ == null) { - updateMask_ = builderForValue.build(); - onChanged(); - } else { - updateMaskBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - 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; - } - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public Builder clearUpdateMask() { - if (updateMaskBuilder_ == null) { - updateMask_ = null; - onChanged(); - } else { - updateMask_ = null; - updateMaskBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { - - onChanged(); - return getUpdateMaskFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { - if (updateMaskBuilder_ != null) { - return updateMaskBuilder_.getMessageOrBuilder(); - } else { - return updateMask_ == null - ? com.google.protobuf.FieldMask.getDefaultInstance() - : updateMask_; - } - } - /** - * - * - *
-     * Required. Only updates the `device` fields indicated by this mask.
-     * The field mask must not be empty, and it must not contain fields that
-     * are immutable or only set by the server.
-     * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-     * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder> - getUpdateMaskFieldBuilder() { - if (updateMaskBuilder_ == null) { - updateMaskBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.FieldMask, - com.google.protobuf.FieldMask.Builder, - com.google.protobuf.FieldMaskOrBuilder>( - getUpdateMask(), getParentForChildren(), isClean()); - updateMask_ = null; - } - return updateMaskBuilder_; - } - - @java.lang.Override - public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.setUnknownFields(unknownFields); - } - - @java.lang.Override - public final Builder mergeUnknownFields( - final com.google.protobuf.UnknownFieldSet unknownFields) { - return super.mergeUnknownFields(unknownFields); - } - - // @@protoc_insertion_point(builder_scope:google.cloud.iot.v1.UpdateDeviceRequest) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.UpdateDeviceRequest) - private static final com.google.cloud.iot.v1.UpdateDeviceRequest DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.UpdateDeviceRequest(); - } - - public static com.google.cloud.iot.v1.UpdateDeviceRequest getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public UpdateDeviceRequest parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.UpdateDeviceRequest getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRequestOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRequestOrBuilder.java deleted file mode 100644 index 8d26fb3f..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRequestOrBuilder.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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/iot/v1/device_manager.proto - -package com.google.cloud.iot.v1; - -public interface UpdateDeviceRequestOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.UpdateDeviceRequest) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * Required. The new values for the device. The `id` and `num_id` fields must
-   * be empty, and the field `name` must specify the name path. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return Whether the device field is set. - */ - boolean hasDevice(); - /** - * - * - *
-   * Required. The new values for the device. The `id` and `num_id` fields must
-   * be empty, and the field `name` must specify the name path. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - * - * @return The device. - */ - com.google.cloud.iot.v1.Device getDevice(); - /** - * - * - *
-   * Required. The new values for the device. The `id` and `num_id` fields must
-   * be empty, and the field `name` must specify the name path. For example,
-   * `projects/p0/locations/us-central1/registries/registry0/devices/device0`or
-   * `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`.
-   * 
- * - * .google.cloud.iot.v1.Device device = 2 [(.google.api.field_behavior) = REQUIRED]; - */ - com.google.cloud.iot.v1.DeviceOrBuilder getDeviceOrBuilder(); - - /** - * - * - *
-   * Required. Only updates the `device` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-   * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return Whether the updateMask field is set. - */ - boolean hasUpdateMask(); - /** - * - * - *
-   * Required. Only updates the `device` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-   * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - * - * @return The updateMask. - */ - com.google.protobuf.FieldMask getUpdateMask(); - /** - * - * - *
-   * Required. Only updates the `device` fields indicated by this mask.
-   * The field mask must not be empty, and it must not contain fields that
-   * are immutable or only set by the server.
-   * Mutable top-level fields: `credentials`, `blocked`, and `metadata`
-   * 
- * - * .google.protobuf.FieldMask update_mask = 3 [(.google.api.field_behavior) = REQUIRED]; - * - */ - com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/X509CertificateDetails.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/X509CertificateDetails.java deleted file mode 100644 index 8f67eac4..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/X509CertificateDetails.java +++ /dev/null @@ -1,1670 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -/** - * - * - *
- * Details of an X.509 certificate. For informational purposes only.
- * 
- * - * Protobuf type {@code google.cloud.iot.v1.X509CertificateDetails} - */ -public final class X509CertificateDetails extends com.google.protobuf.GeneratedMessageV3 - implements - // @@protoc_insertion_point(message_implements:google.cloud.iot.v1.X509CertificateDetails) - X509CertificateDetailsOrBuilder { - private static final long serialVersionUID = 0L; - // Use X509CertificateDetails.newBuilder() to construct. - private X509CertificateDetails(com.google.protobuf.GeneratedMessageV3.Builder builder) { - super(builder); - } - - private X509CertificateDetails() { - issuer_ = ""; - subject_ = ""; - signatureAlgorithm_ = ""; - publicKeyType_ = ""; - } - - @java.lang.Override - @SuppressWarnings({"unused"}) - protected java.lang.Object newInstance(UnusedPrivateParameter unused) { - return new X509CertificateDetails(); - } - - @java.lang.Override - public final com.google.protobuf.UnknownFieldSet getUnknownFields() { - return this.unknownFields; - } - - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_X509CertificateDetails_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_X509CertificateDetails_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.X509CertificateDetails.class, - com.google.cloud.iot.v1.X509CertificateDetails.Builder.class); - } - - public static final int ISSUER_FIELD_NUMBER = 1; - private volatile java.lang.Object issuer_; - /** - * - * - *
-   * The entity that signed the certificate.
-   * 
- * - * string issuer = 1; - * - * @return The issuer. - */ - @java.lang.Override - public java.lang.String getIssuer() { - java.lang.Object ref = issuer_; - 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(); - issuer_ = s; - return s; - } - } - /** - * - * - *
-   * The entity that signed the certificate.
-   * 
- * - * string issuer = 1; - * - * @return The bytes for issuer. - */ - @java.lang.Override - public com.google.protobuf.ByteString getIssuerBytes() { - java.lang.Object ref = issuer_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - issuer_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int SUBJECT_FIELD_NUMBER = 2; - private volatile java.lang.Object subject_; - /** - * - * - *
-   * The entity the certificate and public key belong to.
-   * 
- * - * string subject = 2; - * - * @return The subject. - */ - @java.lang.Override - public java.lang.String getSubject() { - java.lang.Object ref = subject_; - 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(); - subject_ = s; - return s; - } - } - /** - * - * - *
-   * The entity the certificate and public key belong to.
-   * 
- * - * string subject = 2; - * - * @return The bytes for subject. - */ - @java.lang.Override - public com.google.protobuf.ByteString getSubjectBytes() { - java.lang.Object ref = subject_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - subject_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int START_TIME_FIELD_NUMBER = 3; - private com.google.protobuf.Timestamp startTime_; - /** - * - * - *
-   * The time the certificate becomes valid.
-   * 
- * - * .google.protobuf.Timestamp start_time = 3; - * - * @return Whether the startTime field is set. - */ - @java.lang.Override - public boolean hasStartTime() { - return startTime_ != null; - } - /** - * - * - *
-   * The time the certificate becomes valid.
-   * 
- * - * .google.protobuf.Timestamp start_time = 3; - * - * @return The startTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getStartTime() { - return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; - } - /** - * - * - *
-   * The time the certificate becomes valid.
-   * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { - return getStartTime(); - } - - public static final int EXPIRY_TIME_FIELD_NUMBER = 4; - private com.google.protobuf.Timestamp expiryTime_; - /** - * - * - *
-   * The time the certificate becomes invalid.
-   * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - * - * @return Whether the expiryTime field is set. - */ - @java.lang.Override - public boolean hasExpiryTime() { - return expiryTime_ != null; - } - /** - * - * - *
-   * The time the certificate becomes invalid.
-   * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - * - * @return The expiryTime. - */ - @java.lang.Override - public com.google.protobuf.Timestamp getExpiryTime() { - return expiryTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : expiryTime_; - } - /** - * - * - *
-   * The time the certificate becomes invalid.
-   * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - @java.lang.Override - public com.google.protobuf.TimestampOrBuilder getExpiryTimeOrBuilder() { - return getExpiryTime(); - } - - public static final int SIGNATURE_ALGORITHM_FIELD_NUMBER = 5; - private volatile java.lang.Object signatureAlgorithm_; - /** - * - * - *
-   * The algorithm used to sign the certificate.
-   * 
- * - * string signature_algorithm = 5; - * - * @return The signatureAlgorithm. - */ - @java.lang.Override - public java.lang.String getSignatureAlgorithm() { - java.lang.Object ref = signatureAlgorithm_; - 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(); - signatureAlgorithm_ = s; - return s; - } - } - /** - * - * - *
-   * The algorithm used to sign the certificate.
-   * 
- * - * string signature_algorithm = 5; - * - * @return The bytes for signatureAlgorithm. - */ - @java.lang.Override - public com.google.protobuf.ByteString getSignatureAlgorithmBytes() { - java.lang.Object ref = signatureAlgorithm_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - signatureAlgorithm_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - public static final int PUBLIC_KEY_TYPE_FIELD_NUMBER = 6; - private volatile java.lang.Object publicKeyType_; - /** - * - * - *
-   * The type of public key in the certificate.
-   * 
- * - * string public_key_type = 6; - * - * @return The publicKeyType. - */ - @java.lang.Override - public java.lang.String getPublicKeyType() { - java.lang.Object ref = publicKeyType_; - 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(); - publicKeyType_ = s; - return s; - } - } - /** - * - * - *
-   * The type of public key in the certificate.
-   * 
- * - * string public_key_type = 6; - * - * @return The bytes for publicKeyType. - */ - @java.lang.Override - public com.google.protobuf.ByteString getPublicKeyTypeBytes() { - java.lang.Object ref = publicKeyType_; - if (ref instanceof java.lang.String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - publicKeyType_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - - private byte memoizedIsInitialized = -1; - - @java.lang.Override - public final boolean isInitialized() { - byte isInitialized = memoizedIsInitialized; - if (isInitialized == 1) return true; - if (isInitialized == 0) return false; - - memoizedIsInitialized = 1; - return true; - } - - @java.lang.Override - public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(issuer_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 1, issuer_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(subject_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 2, subject_); - } - if (startTime_ != null) { - output.writeMessage(3, getStartTime()); - } - if (expiryTime_ != null) { - output.writeMessage(4, getExpiryTime()); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(signatureAlgorithm_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 5, signatureAlgorithm_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(publicKeyType_)) { - com.google.protobuf.GeneratedMessageV3.writeString(output, 6, publicKeyType_); - } - getUnknownFields().writeTo(output); - } - - @java.lang.Override - public int getSerializedSize() { - int size = memoizedSize; - if (size != -1) return size; - - size = 0; - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(issuer_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, issuer_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(subject_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, subject_); - } - if (startTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getStartTime()); - } - if (expiryTime_ != null) { - size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getExpiryTime()); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(signatureAlgorithm_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, signatureAlgorithm_); - } - if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(publicKeyType_)) { - size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, publicKeyType_); - } - size += getUnknownFields().getSerializedSize(); - memoizedSize = size; - return size; - } - - @java.lang.Override - public boolean equals(final java.lang.Object obj) { - if (obj == this) { - return true; - } - if (!(obj instanceof com.google.cloud.iot.v1.X509CertificateDetails)) { - return super.equals(obj); - } - com.google.cloud.iot.v1.X509CertificateDetails other = - (com.google.cloud.iot.v1.X509CertificateDetails) obj; - - if (!getIssuer().equals(other.getIssuer())) return false; - if (!getSubject().equals(other.getSubject())) return false; - if (hasStartTime() != other.hasStartTime()) return false; - if (hasStartTime()) { - if (!getStartTime().equals(other.getStartTime())) return false; - } - if (hasExpiryTime() != other.hasExpiryTime()) return false; - if (hasExpiryTime()) { - if (!getExpiryTime().equals(other.getExpiryTime())) return false; - } - if (!getSignatureAlgorithm().equals(other.getSignatureAlgorithm())) return false; - if (!getPublicKeyType().equals(other.getPublicKeyType())) return false; - if (!getUnknownFields().equals(other.getUnknownFields())) return false; - return true; - } - - @java.lang.Override - public int hashCode() { - if (memoizedHashCode != 0) { - return memoizedHashCode; - } - int hash = 41; - hash = (19 * hash) + getDescriptor().hashCode(); - hash = (37 * hash) + ISSUER_FIELD_NUMBER; - hash = (53 * hash) + getIssuer().hashCode(); - hash = (37 * hash) + SUBJECT_FIELD_NUMBER; - hash = (53 * hash) + getSubject().hashCode(); - if (hasStartTime()) { - hash = (37 * hash) + START_TIME_FIELD_NUMBER; - hash = (53 * hash) + getStartTime().hashCode(); - } - if (hasExpiryTime()) { - hash = (37 * hash) + EXPIRY_TIME_FIELD_NUMBER; - hash = (53 * hash) + getExpiryTime().hashCode(); - } - hash = (37 * hash) + SIGNATURE_ALGORITHM_FIELD_NUMBER; - hash = (53 * hash) + getSignatureAlgorithm().hashCode(); - hash = (37 * hash) + PUBLIC_KEY_TYPE_FIELD_NUMBER; - hash = (53 * hash) + getPublicKeyType().hashCode(); - hash = (29 * hash) + getUnknownFields().hashCode(); - memoizedHashCode = hash; - return hash; - } - - public static com.google.cloud.iot.v1.X509CertificateDetails parseFrom(java.nio.ByteBuffer data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.X509CertificateDetails 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.iot.v1.X509CertificateDetails parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.X509CertificateDetails 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.iot.v1.X509CertificateDetails parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data); - } - - public static com.google.cloud.iot.v1.X509CertificateDetails parseFrom( - byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - return PARSER.parseFrom(data, extensionRegistry); - } - - public static com.google.cloud.iot.v1.X509CertificateDetails parseFrom(java.io.InputStream input) - throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.X509CertificateDetails 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.iot.v1.X509CertificateDetails parseDelimitedFrom( - java.io.InputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.X509CertificateDetails 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.iot.v1.X509CertificateDetails parseFrom( - com.google.protobuf.CodedInputStream input) throws java.io.IOException { - return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); - } - - public static com.google.cloud.iot.v1.X509CertificateDetails 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.iot.v1.X509CertificateDetails 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; - } - /** - * - * - *
-   * Details of an X.509 certificate. For informational purposes only.
-   * 
- * - * Protobuf type {@code google.cloud.iot.v1.X509CertificateDetails} - */ - public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder - implements - // @@protoc_insertion_point(builder_implements:google.cloud.iot.v1.X509CertificateDetails) - com.google.cloud.iot.v1.X509CertificateDetailsOrBuilder { - public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_X509CertificateDetails_descriptor; - } - - @java.lang.Override - protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable - internalGetFieldAccessorTable() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_X509CertificateDetails_fieldAccessorTable - .ensureFieldAccessorsInitialized( - com.google.cloud.iot.v1.X509CertificateDetails.class, - com.google.cloud.iot.v1.X509CertificateDetails.Builder.class); - } - - // Construct using com.google.cloud.iot.v1.X509CertificateDetails.newBuilder() - private Builder() {} - - private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { - super(parent); - } - - @java.lang.Override - public Builder clear() { - super.clear(); - issuer_ = ""; - - subject_ = ""; - - if (startTimeBuilder_ == null) { - startTime_ = null; - } else { - startTime_ = null; - startTimeBuilder_ = null; - } - if (expiryTimeBuilder_ == null) { - expiryTime_ = null; - } else { - expiryTime_ = null; - expiryTimeBuilder_ = null; - } - signatureAlgorithm_ = ""; - - publicKeyType_ = ""; - - return this; - } - - @java.lang.Override - public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return com.google.cloud.iot.v1.ResourcesProto - .internal_static_google_cloud_iot_v1_X509CertificateDetails_descriptor; - } - - @java.lang.Override - public com.google.cloud.iot.v1.X509CertificateDetails getDefaultInstanceForType() { - return com.google.cloud.iot.v1.X509CertificateDetails.getDefaultInstance(); - } - - @java.lang.Override - public com.google.cloud.iot.v1.X509CertificateDetails build() { - com.google.cloud.iot.v1.X509CertificateDetails result = buildPartial(); - if (!result.isInitialized()) { - throw newUninitializedMessageException(result); - } - return result; - } - - @java.lang.Override - public com.google.cloud.iot.v1.X509CertificateDetails buildPartial() { - com.google.cloud.iot.v1.X509CertificateDetails result = - new com.google.cloud.iot.v1.X509CertificateDetails(this); - result.issuer_ = issuer_; - result.subject_ = subject_; - if (startTimeBuilder_ == null) { - result.startTime_ = startTime_; - } else { - result.startTime_ = startTimeBuilder_.build(); - } - if (expiryTimeBuilder_ == null) { - result.expiryTime_ = expiryTime_; - } else { - result.expiryTime_ = expiryTimeBuilder_.build(); - } - result.signatureAlgorithm_ = signatureAlgorithm_; - result.publicKeyType_ = publicKeyType_; - 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.iot.v1.X509CertificateDetails) { - return mergeFrom((com.google.cloud.iot.v1.X509CertificateDetails) other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(com.google.cloud.iot.v1.X509CertificateDetails other) { - if (other == com.google.cloud.iot.v1.X509CertificateDetails.getDefaultInstance()) return this; - if (!other.getIssuer().isEmpty()) { - issuer_ = other.issuer_; - onChanged(); - } - if (!other.getSubject().isEmpty()) { - subject_ = other.subject_; - onChanged(); - } - if (other.hasStartTime()) { - mergeStartTime(other.getStartTime()); - } - if (other.hasExpiryTime()) { - mergeExpiryTime(other.getExpiryTime()); - } - if (!other.getSignatureAlgorithm().isEmpty()) { - signatureAlgorithm_ = other.signatureAlgorithm_; - onChanged(); - } - if (!other.getPublicKeyType().isEmpty()) { - publicKeyType_ = other.publicKeyType_; - onChanged(); - } - this.mergeUnknownFields(other.getUnknownFields()); - onChanged(); - return this; - } - - @java.lang.Override - public final boolean isInitialized() { - return true; - } - - @java.lang.Override - public Builder mergeFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws java.io.IOException { - if (extensionRegistry == null) { - throw new java.lang.NullPointerException(); - } - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - case 10: - { - issuer_ = input.readStringRequireUtf8(); - - break; - } // case 10 - case 18: - { - subject_ = input.readStringRequireUtf8(); - - break; - } // case 18 - case 26: - { - input.readMessage(getStartTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 26 - case 34: - { - input.readMessage(getExpiryTimeFieldBuilder().getBuilder(), extensionRegistry); - - break; - } // case 34 - case 42: - { - signatureAlgorithm_ = input.readStringRequireUtf8(); - - break; - } // case 42 - case 50: - { - publicKeyType_ = input.readStringRequireUtf8(); - - break; - } // case 50 - default: - { - if (!super.parseUnknownField(input, extensionRegistry, tag)) { - done = true; // was an endgroup tag - } - break; - } // default: - } // switch (tag) - } // while (!done) - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.unwrapIOException(); - } finally { - onChanged(); - } // finally - return this; - } - - private java.lang.Object issuer_ = ""; - /** - * - * - *
-     * The entity that signed the certificate.
-     * 
- * - * string issuer = 1; - * - * @return The issuer. - */ - public java.lang.String getIssuer() { - java.lang.Object ref = issuer_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - issuer_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The entity that signed the certificate.
-     * 
- * - * string issuer = 1; - * - * @return The bytes for issuer. - */ - public com.google.protobuf.ByteString getIssuerBytes() { - java.lang.Object ref = issuer_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - issuer_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The entity that signed the certificate.
-     * 
- * - * string issuer = 1; - * - * @param value The issuer to set. - * @return This builder for chaining. - */ - public Builder setIssuer(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - issuer_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The entity that signed the certificate.
-     * 
- * - * string issuer = 1; - * - * @return This builder for chaining. - */ - public Builder clearIssuer() { - - issuer_ = getDefaultInstance().getIssuer(); - onChanged(); - return this; - } - /** - * - * - *
-     * The entity that signed the certificate.
-     * 
- * - * string issuer = 1; - * - * @param value The bytes for issuer to set. - * @return This builder for chaining. - */ - public Builder setIssuerBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - issuer_ = value; - onChanged(); - return this; - } - - private java.lang.Object subject_ = ""; - /** - * - * - *
-     * The entity the certificate and public key belong to.
-     * 
- * - * string subject = 2; - * - * @return The subject. - */ - public java.lang.String getSubject() { - java.lang.Object ref = subject_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - subject_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The entity the certificate and public key belong to.
-     * 
- * - * string subject = 2; - * - * @return The bytes for subject. - */ - public com.google.protobuf.ByteString getSubjectBytes() { - java.lang.Object ref = subject_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - subject_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The entity the certificate and public key belong to.
-     * 
- * - * string subject = 2; - * - * @param value The subject to set. - * @return This builder for chaining. - */ - public Builder setSubject(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - subject_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The entity the certificate and public key belong to.
-     * 
- * - * string subject = 2; - * - * @return This builder for chaining. - */ - public Builder clearSubject() { - - subject_ = getDefaultInstance().getSubject(); - onChanged(); - return this; - } - /** - * - * - *
-     * The entity the certificate and public key belong to.
-     * 
- * - * string subject = 2; - * - * @param value The bytes for subject to set. - * @return This builder for chaining. - */ - public Builder setSubjectBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - subject_ = value; - onChanged(); - return this; - } - - private com.google.protobuf.Timestamp startTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - startTimeBuilder_; - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - * - * @return Whether the startTime field is set. - */ - public boolean hasStartTime() { - return startTimeBuilder_ != null || startTime_ != null; - } - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - * - * @return The startTime. - */ - public com.google.protobuf.Timestamp getStartTime() { - if (startTimeBuilder_ == null) { - return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; - } else { - return startTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - public Builder setStartTime(com.google.protobuf.Timestamp value) { - if (startTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - startTime_ = value; - onChanged(); - } else { - startTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (startTimeBuilder_ == null) { - startTime_ = builderForValue.build(); - onChanged(); - } else { - startTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - public Builder mergeStartTime(com.google.protobuf.Timestamp value) { - if (startTimeBuilder_ == null) { - if (startTime_ != null) { - startTime_ = - com.google.protobuf.Timestamp.newBuilder(startTime_).mergeFrom(value).buildPartial(); - } else { - startTime_ = value; - } - onChanged(); - } else { - startTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - public Builder clearStartTime() { - if (startTimeBuilder_ == null) { - startTime_ = null; - onChanged(); - } else { - startTime_ = null; - startTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { - - onChanged(); - return getStartTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { - if (startTimeBuilder_ != null) { - return startTimeBuilder_.getMessageOrBuilder(); - } else { - return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; - } - } - /** - * - * - *
-     * The time the certificate becomes valid.
-     * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getStartTimeFieldBuilder() { - if (startTimeBuilder_ == null) { - startTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getStartTime(), getParentForChildren(), isClean()); - startTime_ = null; - } - return startTimeBuilder_; - } - - private com.google.protobuf.Timestamp expiryTime_; - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - expiryTimeBuilder_; - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - * - * @return Whether the expiryTime field is set. - */ - public boolean hasExpiryTime() { - return expiryTimeBuilder_ != null || expiryTime_ != null; - } - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - * - * @return The expiryTime. - */ - public com.google.protobuf.Timestamp getExpiryTime() { - if (expiryTimeBuilder_ == null) { - return expiryTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : expiryTime_; - } else { - return expiryTimeBuilder_.getMessage(); - } - } - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - public Builder setExpiryTime(com.google.protobuf.Timestamp value) { - if (expiryTimeBuilder_ == null) { - if (value == null) { - throw new NullPointerException(); - } - expiryTime_ = value; - onChanged(); - } else { - expiryTimeBuilder_.setMessage(value); - } - - return this; - } - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - public Builder setExpiryTime(com.google.protobuf.Timestamp.Builder builderForValue) { - if (expiryTimeBuilder_ == null) { - expiryTime_ = builderForValue.build(); - onChanged(); - } else { - expiryTimeBuilder_.setMessage(builderForValue.build()); - } - - return this; - } - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - public Builder mergeExpiryTime(com.google.protobuf.Timestamp value) { - if (expiryTimeBuilder_ == null) { - if (expiryTime_ != null) { - expiryTime_ = - com.google.protobuf.Timestamp.newBuilder(expiryTime_).mergeFrom(value).buildPartial(); - } else { - expiryTime_ = value; - } - onChanged(); - } else { - expiryTimeBuilder_.mergeFrom(value); - } - - return this; - } - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - public Builder clearExpiryTime() { - if (expiryTimeBuilder_ == null) { - expiryTime_ = null; - onChanged(); - } else { - expiryTime_ = null; - expiryTimeBuilder_ = null; - } - - return this; - } - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - public com.google.protobuf.Timestamp.Builder getExpiryTimeBuilder() { - - onChanged(); - return getExpiryTimeFieldBuilder().getBuilder(); - } - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - public com.google.protobuf.TimestampOrBuilder getExpiryTimeOrBuilder() { - if (expiryTimeBuilder_ != null) { - return expiryTimeBuilder_.getMessageOrBuilder(); - } else { - return expiryTime_ == null - ? com.google.protobuf.Timestamp.getDefaultInstance() - : expiryTime_; - } - } - /** - * - * - *
-     * The time the certificate becomes invalid.
-     * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - private com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder> - getExpiryTimeFieldBuilder() { - if (expiryTimeBuilder_ == null) { - expiryTimeBuilder_ = - new com.google.protobuf.SingleFieldBuilderV3< - com.google.protobuf.Timestamp, - com.google.protobuf.Timestamp.Builder, - com.google.protobuf.TimestampOrBuilder>( - getExpiryTime(), getParentForChildren(), isClean()); - expiryTime_ = null; - } - return expiryTimeBuilder_; - } - - private java.lang.Object signatureAlgorithm_ = ""; - /** - * - * - *
-     * The algorithm used to sign the certificate.
-     * 
- * - * string signature_algorithm = 5; - * - * @return The signatureAlgorithm. - */ - public java.lang.String getSignatureAlgorithm() { - java.lang.Object ref = signatureAlgorithm_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - signatureAlgorithm_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The algorithm used to sign the certificate.
-     * 
- * - * string signature_algorithm = 5; - * - * @return The bytes for signatureAlgorithm. - */ - public com.google.protobuf.ByteString getSignatureAlgorithmBytes() { - java.lang.Object ref = signatureAlgorithm_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - signatureAlgorithm_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The algorithm used to sign the certificate.
-     * 
- * - * string signature_algorithm = 5; - * - * @param value The signatureAlgorithm to set. - * @return This builder for chaining. - */ - public Builder setSignatureAlgorithm(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - signatureAlgorithm_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The algorithm used to sign the certificate.
-     * 
- * - * string signature_algorithm = 5; - * - * @return This builder for chaining. - */ - public Builder clearSignatureAlgorithm() { - - signatureAlgorithm_ = getDefaultInstance().getSignatureAlgorithm(); - onChanged(); - return this; - } - /** - * - * - *
-     * The algorithm used to sign the certificate.
-     * 
- * - * string signature_algorithm = 5; - * - * @param value The bytes for signatureAlgorithm to set. - * @return This builder for chaining. - */ - public Builder setSignatureAlgorithmBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - signatureAlgorithm_ = value; - onChanged(); - return this; - } - - private java.lang.Object publicKeyType_ = ""; - /** - * - * - *
-     * The type of public key in the certificate.
-     * 
- * - * string public_key_type = 6; - * - * @return The publicKeyType. - */ - public java.lang.String getPublicKeyType() { - java.lang.Object ref = publicKeyType_; - if (!(ref instanceof java.lang.String)) { - com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; - java.lang.String s = bs.toStringUtf8(); - publicKeyType_ = s; - return s; - } else { - return (java.lang.String) ref; - } - } - /** - * - * - *
-     * The type of public key in the certificate.
-     * 
- * - * string public_key_type = 6; - * - * @return The bytes for publicKeyType. - */ - public com.google.protobuf.ByteString getPublicKeyTypeBytes() { - java.lang.Object ref = publicKeyType_; - if (ref instanceof String) { - com.google.protobuf.ByteString b = - com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); - publicKeyType_ = b; - return b; - } else { - return (com.google.protobuf.ByteString) ref; - } - } - /** - * - * - *
-     * The type of public key in the certificate.
-     * 
- * - * string public_key_type = 6; - * - * @param value The publicKeyType to set. - * @return This builder for chaining. - */ - public Builder setPublicKeyType(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - - publicKeyType_ = value; - onChanged(); - return this; - } - /** - * - * - *
-     * The type of public key in the certificate.
-     * 
- * - * string public_key_type = 6; - * - * @return This builder for chaining. - */ - public Builder clearPublicKeyType() { - - publicKeyType_ = getDefaultInstance().getPublicKeyType(); - onChanged(); - return this; - } - /** - * - * - *
-     * The type of public key in the certificate.
-     * 
- * - * string public_key_type = 6; - * - * @param value The bytes for publicKeyType to set. - * @return This builder for chaining. - */ - public Builder setPublicKeyTypeBytes(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - checkByteStringIsUtf8(value); - - publicKeyType_ = 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.iot.v1.X509CertificateDetails) - } - - // @@protoc_insertion_point(class_scope:google.cloud.iot.v1.X509CertificateDetails) - private static final com.google.cloud.iot.v1.X509CertificateDetails DEFAULT_INSTANCE; - - static { - DEFAULT_INSTANCE = new com.google.cloud.iot.v1.X509CertificateDetails(); - } - - public static com.google.cloud.iot.v1.X509CertificateDetails getDefaultInstance() { - return DEFAULT_INSTANCE; - } - - private static final com.google.protobuf.Parser PARSER = - new com.google.protobuf.AbstractParser() { - @java.lang.Override - public X509CertificateDetails parsePartialFrom( - com.google.protobuf.CodedInputStream input, - com.google.protobuf.ExtensionRegistryLite extensionRegistry) - throws com.google.protobuf.InvalidProtocolBufferException { - Builder builder = newBuilder(); - try { - builder.mergeFrom(input, extensionRegistry); - } catch (com.google.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(builder.buildPartial()); - } catch (com.google.protobuf.UninitializedMessageException e) { - throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); - } catch (java.io.IOException e) { - throw new com.google.protobuf.InvalidProtocolBufferException(e) - .setUnfinishedMessage(builder.buildPartial()); - } - return builder.buildPartial(); - } - }; - - public static com.google.protobuf.Parser parser() { - return PARSER; - } - - @java.lang.Override - public com.google.protobuf.Parser getParserForType() { - return PARSER; - } - - @java.lang.Override - public com.google.cloud.iot.v1.X509CertificateDetails getDefaultInstanceForType() { - return DEFAULT_INSTANCE; - } -} diff --git a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/X509CertificateDetailsOrBuilder.java b/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/X509CertificateDetailsOrBuilder.java deleted file mode 100644 index 743fff38..00000000 --- a/proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/X509CertificateDetailsOrBuilder.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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/iot/v1/resources.proto - -package com.google.cloud.iot.v1; - -public interface X509CertificateDetailsOrBuilder - extends - // @@protoc_insertion_point(interface_extends:google.cloud.iot.v1.X509CertificateDetails) - com.google.protobuf.MessageOrBuilder { - - /** - * - * - *
-   * The entity that signed the certificate.
-   * 
- * - * string issuer = 1; - * - * @return The issuer. - */ - java.lang.String getIssuer(); - /** - * - * - *
-   * The entity that signed the certificate.
-   * 
- * - * string issuer = 1; - * - * @return The bytes for issuer. - */ - com.google.protobuf.ByteString getIssuerBytes(); - - /** - * - * - *
-   * The entity the certificate and public key belong to.
-   * 
- * - * string subject = 2; - * - * @return The subject. - */ - java.lang.String getSubject(); - /** - * - * - *
-   * The entity the certificate and public key belong to.
-   * 
- * - * string subject = 2; - * - * @return The bytes for subject. - */ - com.google.protobuf.ByteString getSubjectBytes(); - - /** - * - * - *
-   * The time the certificate becomes valid.
-   * 
- * - * .google.protobuf.Timestamp start_time = 3; - * - * @return Whether the startTime field is set. - */ - boolean hasStartTime(); - /** - * - * - *
-   * The time the certificate becomes valid.
-   * 
- * - * .google.protobuf.Timestamp start_time = 3; - * - * @return The startTime. - */ - com.google.protobuf.Timestamp getStartTime(); - /** - * - * - *
-   * The time the certificate becomes valid.
-   * 
- * - * .google.protobuf.Timestamp start_time = 3; - */ - com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); - - /** - * - * - *
-   * The time the certificate becomes invalid.
-   * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - * - * @return Whether the expiryTime field is set. - */ - boolean hasExpiryTime(); - /** - * - * - *
-   * The time the certificate becomes invalid.
-   * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - * - * @return The expiryTime. - */ - com.google.protobuf.Timestamp getExpiryTime(); - /** - * - * - *
-   * The time the certificate becomes invalid.
-   * 
- * - * .google.protobuf.Timestamp expiry_time = 4; - */ - com.google.protobuf.TimestampOrBuilder getExpiryTimeOrBuilder(); - - /** - * - * - *
-   * The algorithm used to sign the certificate.
-   * 
- * - * string signature_algorithm = 5; - * - * @return The signatureAlgorithm. - */ - java.lang.String getSignatureAlgorithm(); - /** - * - * - *
-   * The algorithm used to sign the certificate.
-   * 
- * - * string signature_algorithm = 5; - * - * @return The bytes for signatureAlgorithm. - */ - com.google.protobuf.ByteString getSignatureAlgorithmBytes(); - - /** - * - * - *
-   * The type of public key in the certificate.
-   * 
- * - * string public_key_type = 6; - * - * @return The publicKeyType. - */ - java.lang.String getPublicKeyType(); - /** - * - * - *
-   * The type of public key in the certificate.
-   * 
- * - * string public_key_type = 6; - * - * @return The bytes for publicKeyType. - */ - com.google.protobuf.ByteString getPublicKeyTypeBytes(); -} diff --git a/proto-google-cloud-iot-v1/src/main/proto/google/cloud/iot/v1/device_manager.proto b/proto-google-cloud-iot-v1/src/main/proto/google/cloud/iot/v1/device_manager.proto deleted file mode 100644 index b28140ce..00000000 --- a/proto-google-cloud-iot-v1/src/main/proto/google/cloud/iot/v1/device_manager.proto +++ /dev/null @@ -1,651 +0,0 @@ -// 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. - -syntax = "proto3"; - -package google.cloud.iot.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/iot/v1/resources.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/iot/v1;iot"; -option java_multiple_files = true; -option java_outer_classname = "DeviceManagerProto"; -option java_package = "com.google.cloud.iot.v1"; - -// Internet of Things (IoT) service. Securely connect and manage IoT devices. -service DeviceManager { - option (google.api.default_host) = "cloudiot.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/cloudiot"; - - // Creates a device registry that contains devices. - rpc CreateDeviceRegistry(CreateDeviceRegistryRequest) returns (DeviceRegistry) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/registries" - body: "device_registry" - }; - option (google.api.method_signature) = "parent,device_registry"; - } - - // Gets a device registry configuration. - rpc GetDeviceRegistry(GetDeviceRegistryRequest) returns (DeviceRegistry) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/registries/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a device registry configuration. - rpc UpdateDeviceRegistry(UpdateDeviceRegistryRequest) returns (DeviceRegistry) { - option (google.api.http) = { - patch: "/v1/{device_registry.name=projects/*/locations/*/registries/*}" - body: "device_registry" - }; - option (google.api.method_signature) = "device_registry,update_mask"; - } - - // Deletes a device registry configuration. - rpc DeleteDeviceRegistry(DeleteDeviceRegistryRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/registries/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists device registries. - rpc ListDeviceRegistries(ListDeviceRegistriesRequest) returns (ListDeviceRegistriesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/registries" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a device in a device registry. - rpc CreateDevice(CreateDeviceRequest) returns (Device) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/registries/*}/devices" - body: "device" - }; - option (google.api.method_signature) = "parent,device"; - } - - // Gets details about a device. - rpc GetDevice(GetDeviceRequest) returns (Device) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}" - } - }; - option (google.api.method_signature) = "name"; - } - - // Updates a device. - rpc UpdateDevice(UpdateDeviceRequest) returns (Device) { - option (google.api.http) = { - patch: "/v1/{device.name=projects/*/locations/*/registries/*/devices/*}" - body: "device" - additional_bindings { - patch: "/v1/{device.name=projects/*/locations/*/registries/*/groups/*/devices/*}" - body: "device" - } - }; - option (google.api.method_signature) = "device,update_mask"; - } - - // Deletes a device. - rpc DeleteDevice(DeleteDeviceRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/registries/*/devices/*}" - }; - option (google.api.method_signature) = "name"; - } - - // List devices in a device registry. - rpc ListDevices(ListDevicesRequest) returns (ListDevicesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/registries/*}/devices" - additional_bindings { - get: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}/devices" - } - }; - option (google.api.method_signature) = "parent"; - } - - // Modifies the configuration for the device, which is eventually sent from - // the Cloud IoT Core servers. Returns the modified configuration version and - // its metadata. - rpc ModifyCloudToDeviceConfig(ModifyCloudToDeviceConfigRequest) returns (DeviceConfig) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/registries/*/devices/*}:modifyCloudToDeviceConfig" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:modifyCloudToDeviceConfig" - body: "*" - } - }; - option (google.api.method_signature) = "name,binary_data"; - } - - // Lists the last few versions of the device configuration in descending - // order (i.e.: newest first). - rpc ListDeviceConfigVersions(ListDeviceConfigVersionsRequest) returns (ListDeviceConfigVersionsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}/configVersions" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/configVersions" - } - }; - option (google.api.method_signature) = "name"; - } - - // Lists the last few versions of the device state in descending order (i.e.: - // newest first). - rpc ListDeviceStates(ListDeviceStatesRequest) returns (ListDeviceStatesResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/registries/*/devices/*}/states" - additional_bindings { - get: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}/states" - } - }; - option (google.api.method_signature) = "name"; - } - - // Sets the access control policy on the specified resource. Replaces any - // existing policy. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/registries/*}:setIamPolicy" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:setIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource,policy"; - } - - // Gets the access control policy for a resource. - // Returns an empty policy if the resource exists and does not have a policy - // set. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/registries/*}:getIamPolicy" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:getIamPolicy" - body: "*" - } - }; - option (google.api.method_signature) = "resource"; - } - - // Returns permissions that a caller has on the specified resource. - // If the resource does not exist, this will return an empty set of - // permissions, not a NOT_FOUND error. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/locations/*/registries/*}:testIamPermissions" - body: "*" - additional_bindings { - post: "/v1/{resource=projects/*/locations/*/registries/*/groups/*}:testIamPermissions" - body: "*" - } - }; - option (google.api.method_signature) = "resource,permissions"; - } - - // Sends a command to the specified device. In order for a device to be able - // to receive commands, it must: - // 1) be connected to Cloud IoT Core using the MQTT protocol, and - // 2) be subscribed to the group of MQTT topics specified by - // /devices/{device-id}/commands/#. This subscription will receive commands - // at the top-level topic /devices/{device-id}/commands as well as commands - // for subfolders, like /devices/{device-id}/commands/subfolder. - // Note that subscribing to specific subfolders is not supported. - // If the command could not be delivered to the device, this method will - // return an error; in particular, if the device is not subscribed, this - // method will return FAILED_PRECONDITION. Otherwise, this method will - // return OK. If the subscription is QoS 1, at least once delivery will be - // guaranteed; for QoS 0, no acknowledgment will be expected from the device. - rpc SendCommandToDevice(SendCommandToDeviceRequest) returns (SendCommandToDeviceResponse) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/registries/*/devices/*}:sendCommandToDevice" - body: "*" - additional_bindings { - post: "/v1/{name=projects/*/locations/*/registries/*/groups/*/devices/*}:sendCommandToDevice" - body: "*" - } - }; - option (google.api.method_signature) = "name,binary_data"; - option (google.api.method_signature) = "name,binary_data,subfolder"; - } - - // Associates the device with the gateway. - rpc BindDeviceToGateway(BindDeviceToGatewayRequest) returns (BindDeviceToGatewayResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/registries/*}:bindDeviceToGateway" - body: "*" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:bindDeviceToGateway" - body: "*" - } - }; - option (google.api.method_signature) = "parent,gateway_id,device_id"; - } - - // Deletes the association between the device and the gateway. - rpc UnbindDeviceFromGateway(UnbindDeviceFromGatewayRequest) returns (UnbindDeviceFromGatewayResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/registries/*}:unbindDeviceFromGateway" - body: "*" - additional_bindings { - post: "/v1/{parent=projects/*/locations/*/registries/*/groups/*}:unbindDeviceFromGateway" - body: "*" - } - }; - option (google.api.method_signature) = "parent,gateway_id,device_id"; - } -} - -// Request for `CreateDeviceRegistry`. -message CreateDeviceRegistryRequest { - // Required. The project and cloud region where this device registry must be created. - // For example, `projects/example-project/locations/us-central1`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The device registry. The field `name` must be empty. The server will - // generate that field from the device registry `id` provided and the - // `parent` field. - DeviceRegistry device_registry = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `GetDeviceRegistry`. -message GetDeviceRegistryRequest { - // Required. The name of the device registry. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; -} - -// Request for `DeleteDeviceRegistry`. -message DeleteDeviceRegistryRequest { - // Required. The name of the device registry. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; -} - -// Request for `UpdateDeviceRegistry`. -message UpdateDeviceRegistryRequest { - // Required. The new values for the device registry. The `id` field must be empty, and - // the `name` field must indicate the path of the resource. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - DeviceRegistry device_registry = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only updates the `device_registry` fields indicated by this mask. - // The field mask must not be empty, and it must not contain fields that - // are immutable or only set by the server. - // Mutable top-level fields: `event_notification_config`, `http_config`, - // `mqtt_config`, and `state_notification_config`. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `ListDeviceRegistries`. -message ListDeviceRegistriesRequest { - // Required. The project and cloud region path. For example, - // `projects/example-project/locations/us-central1`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of registries to return in the response. If this value - // is zero, the service will select a default size. A call may return fewer - // objects than requested. A non-empty `next_page_token` in the response - // indicates that more data is available. - int32 page_size = 2; - - // The value returned by the last `ListDeviceRegistriesResponse`; indicates - // that this is a continuation of a prior `ListDeviceRegistries` call and - // the system should return the next page of data. - string page_token = 3; -} - -// Response for `ListDeviceRegistries`. -message ListDeviceRegistriesResponse { - // The registries that matched the query. - repeated DeviceRegistry device_registries = 1; - - // If not empty, indicates that there may be more registries that match the - // request; this value should be passed in a new - // `ListDeviceRegistriesRequest`. - string next_page_token = 2; -} - -// Request for `CreateDevice`. -message CreateDeviceRequest { - // Required. The name of the device registry where this device should be created. - // For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; - - // Required. The device registration details. The field `name` must be empty. The server - // generates `name` from the device registry `id` and the - // `parent` field. - Device device = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `GetDevice`. -message GetDeviceRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // The fields of the `Device` resource to be returned in the response. If the - // field mask is unset or empty, all fields are returned. Fields have to be - // provided in snake_case format, for example: `last_heartbeat_time`. - google.protobuf.FieldMask field_mask = 2; -} - -// Request for `UpdateDevice`. -message UpdateDeviceRequest { - // Required. The new values for the device. The `id` and `num_id` fields must - // be empty, and the field `name` must specify the name path. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0`or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - Device device = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Only updates the `device` fields indicated by this mask. - // The field mask must not be empty, and it must not contain fields that - // are immutable or only set by the server. - // Mutable top-level fields: `credentials`, `blocked`, and `metadata` - google.protobuf.FieldMask update_mask = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `DeleteDevice`. -message DeleteDeviceRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; -} - -// Request for `ListDevices`. -message ListDevicesRequest { - // Required. The device registry path. Required. For example, - // `projects/my-project/locations/us-central1/registries/my-registry`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; - - // A list of device numeric IDs. If empty, this field is ignored. Maximum - // IDs: 10,000. - repeated uint64 device_num_ids = 2; - - // A list of device string IDs. For example, `['device0', 'device12']`. - // If empty, this field is ignored. Maximum IDs: 10,000 - repeated string device_ids = 3; - - // The fields of the `Device` resource to be returned in the response. The - // fields `id` and `num_id` are always returned, along with any - // other fields specified in snake_case format, for example: - // `last_heartbeat_time`. - google.protobuf.FieldMask field_mask = 4; - - // Options related to gateways. - GatewayListOptions gateway_list_options = 6; - - // The maximum number of devices to return in the response. If this value - // is zero, the service will select a default size. A call may return fewer - // objects than requested. A non-empty `next_page_token` in the response - // indicates that more data is available. - int32 page_size = 100; - - // The value returned by the last `ListDevicesResponse`; indicates - // that this is a continuation of a prior `ListDevices` call and - // the system should return the next page of data. - string page_token = 101; -} - -// Options for limiting the list based on gateway type and associations. -message GatewayListOptions { - // If not set, all devices and gateways are returned. If set, the list is - // filtered based on gateway type and associations. - oneof filter { - // If `GATEWAY` is specified, only gateways are returned. If `NON_GATEWAY` - // is specified, only non-gateway devices are returned. If - // `GATEWAY_TYPE_UNSPECIFIED` is specified, all devices are returned. - GatewayType gateway_type = 1; - - // If set, only devices associated with the specified gateway are returned. - // The gateway ID can be numeric (`num_id`) or the user-defined string - // (`id`). For example, if `123` is specified, only devices bound to the - // gateway with `num_id` 123 are returned. - string associations_gateway_id = 2; - - // If set, returns only the gateways with which the specified device is - // associated. The device ID can be numeric (`num_id`) or the user-defined - // string (`id`). For example, if `456` is specified, returns only the - // gateways to which the device with `num_id` 456 is bound. - string associations_device_id = 3; - } -} - -// Response for `ListDevices`. -message ListDevicesResponse { - // The devices that match the request. - repeated Device devices = 1; - - // If not empty, indicates that there may be more devices that match the - // request; this value should be passed in a new `ListDevicesRequest`. - string next_page_token = 2; -} - -// Request for `ModifyCloudToDeviceConfig`. -message ModifyCloudToDeviceConfigRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // The version number to update. If this value is zero, it will not check the - // version number of the server and will always update the current version; - // otherwise, this update will fail if the version number found on the server - // does not match this version number. This is used to support multiple - // simultaneous updates without losing data. - int64 version_to_update = 2; - - // Required. The configuration data for the device. - bytes binary_data = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for `ListDeviceConfigVersions`. -message ListDeviceConfigVersionsRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // The number of versions to list. Versions are listed in decreasing order of - // the version number. The maximum number of versions retained is 10. If this - // value is zero, it will return all the versions available. - int32 num_versions = 2; -} - -// Response for `ListDeviceConfigVersions`. -message ListDeviceConfigVersionsResponse { - // The device configuration for the last few versions. Versions are listed - // in decreasing order, starting from the most recent one. - repeated DeviceConfig device_configs = 1; -} - -// Request for `ListDeviceStates`. -message ListDeviceStatesRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // The number of states to list. States are listed in descending order of - // update time. The maximum number of states retained is 10. If this - // value is zero, it will return all the states available. - int32 num_states = 2; -} - -// Response for `ListDeviceStates`. -message ListDeviceStatesResponse { - // The last few device states. States are listed in descending order of server - // update time, starting from the most recent one. - repeated DeviceState device_states = 1; -} - -// Request for `SendCommandToDevice`. -message SendCommandToDeviceRequest { - // Required. The name of the device. For example, - // `projects/p0/locations/us-central1/registries/registry0/devices/device0` or - // `projects/p0/locations/us-central1/registries/registry0/devices/{num_id}`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Device" - } - ]; - - // Required. The command data to send to the device. - bytes binary_data = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional subfolder for the command. If empty, the command will be delivered - // to the /devices/{device-id}/commands topic, otherwise it will be delivered - // to the /devices/{device-id}/commands/{subfolder} topic. Multi-level - // subfolders are allowed. This field must not have more than 256 characters, - // and must not contain any MQTT wildcards ("+" or "#") or null characters. - string subfolder = 3; -} - -// Response for `SendCommandToDevice`. -message SendCommandToDeviceResponse { - -} - -// Request for `BindDeviceToGateway`. -message BindDeviceToGatewayRequest { - // Required. The name of the registry. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; - - // Required. The value of `gateway_id` can be either the device numeric ID or the - // user-defined device identifier. - string gateway_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The device to associate with the specified gateway. The value of - // `device_id` can be either the device numeric ID or the user-defined device - // identifier. - string device_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for `BindDeviceToGateway`. -message BindDeviceToGatewayResponse { - -} - -// Request for `UnbindDeviceFromGateway`. -message UnbindDeviceFromGatewayRequest { - // Required. The name of the registry. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudiot.googleapis.com/Registry" - } - ]; - - // Required. The value of `gateway_id` can be either the device numeric ID or the - // user-defined device identifier. - string gateway_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The device to disassociate from the specified gateway. The value of - // `device_id` can be either the device numeric ID or the user-defined device - // identifier. - string device_id = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for `UnbindDeviceFromGateway`. -message UnbindDeviceFromGatewayResponse { - -} diff --git a/proto-google-cloud-iot-v1/src/main/proto/google/cloud/iot/v1/resources.proto b/proto-google-cloud-iot-v1/src/main/proto/google/cloud/iot/v1/resources.proto deleted file mode 100644 index a14fc027..00000000 --- a/proto-google-cloud-iot-v1/src/main/proto/google/cloud/iot/v1/resources.proto +++ /dev/null @@ -1,483 +0,0 @@ -// 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. - -syntax = "proto3"; - -package google.cloud.iot.v1; - -import "google/api/resource.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option cc_enable_arenas = true; -option go_package = "google.golang.org/genproto/googleapis/cloud/iot/v1;iot"; -option java_multiple_files = true; -option java_outer_classname = "ResourcesProto"; -option java_package = "com.google.cloud.iot.v1"; - -// The device resource. -message Device { - option (google.api.resource) = { - type: "cloudiot.googleapis.com/Device" - pattern: "projects/{project}/locations/{location}/registries/{registry}/devices/{device}" - }; - - // The user-defined device identifier. The device ID must be unique - // within a device registry. - string id = 1; - - // The resource path name. For example, - // `projects/p1/locations/us-central1/registries/registry0/devices/dev0` or - // `projects/p1/locations/us-central1/registries/registry0/devices/{num_id}`. - // When `name` is populated as a response from the service, it always ends - // in the device numeric ID. - string name = 2; - - // [Output only] A server-defined unique numeric ID for the device. This is a - // more compact way to identify devices, and it is globally unique. - uint64 num_id = 3; - - // The credentials used to authenticate this device. To allow credential - // rotation without interruption, multiple device credentials can be bound to - // this device. No more than 3 credentials can be bound to a single device at - // a time. When new credentials are added to a device, they are verified - // against the registry credentials. For details, see the description of the - // `DeviceRegistry.credentials` field. - repeated DeviceCredential credentials = 12; - - // [Output only] The last time an MQTT `PINGREQ` was received. This field - // applies only to devices connecting through MQTT. MQTT clients usually only - // send `PINGREQ` messages if the connection is idle, and no other messages - // have been sent. Timestamps are periodically collected and written to - // storage; they may be stale by a few minutes. - google.protobuf.Timestamp last_heartbeat_time = 7; - - // [Output only] The last time a telemetry event was received. Timestamps are - // periodically collected and written to storage; they may be stale by a few - // minutes. - google.protobuf.Timestamp last_event_time = 8; - - // [Output only] The last time a state event was received. Timestamps are - // periodically collected and written to storage; they may be stale by a few - // minutes. - google.protobuf.Timestamp last_state_time = 20; - - // [Output only] The last time a cloud-to-device config version acknowledgment - // was received from the device. This field is only for configurations - // sent through MQTT. - google.protobuf.Timestamp last_config_ack_time = 14; - - // [Output only] The last time a cloud-to-device config version was sent to - // the device. - google.protobuf.Timestamp last_config_send_time = 18; - - // If a device is blocked, connections or requests from this device will fail. - // Can be used to temporarily prevent the device from connecting if, for - // example, the sensor is generating bad data and needs maintenance. - bool blocked = 19; - - // [Output only] The time the most recent error occurred, such as a failure to - // publish to Cloud Pub/Sub. This field is the timestamp of - // 'last_error_status'. - google.protobuf.Timestamp last_error_time = 10; - - // [Output only] The error message of the most recent error, such as a failure - // to publish to Cloud Pub/Sub. 'last_error_time' is the timestamp of this - // field. If no errors have occurred, this field has an empty message - // and the status code 0 == OK. Otherwise, this field is expected to have a - // status code other than OK. - google.rpc.Status last_error_status = 11; - - // The most recent device configuration, which is eventually sent from - // Cloud IoT Core to the device. If not present on creation, the - // configuration will be initialized with an empty payload and version value - // of `1`. To update this field after creation, use the - // `DeviceManager.ModifyCloudToDeviceConfig` method. - DeviceConfig config = 13; - - // [Output only] The state most recently received from the device. If no state - // has been reported, this field is not present. - DeviceState state = 16; - - // **Beta Feature** - // - // The logging verbosity for device activity. If unspecified, - // DeviceRegistry.log_level will be used. - LogLevel log_level = 21; - - // The metadata key-value pairs assigned to the device. This metadata is not - // interpreted or indexed by Cloud IoT Core. It can be used to add contextual - // information for the device. - // - // Keys must conform to the regular expression [a-zA-Z][a-zA-Z0-9-_.+~%]+ and - // be less than 128 bytes in length. - // - // Values are free-form strings. Each value must be less than or equal to 32 - // KB in size. - // - // The total size of all keys and values must be less than 256 KB, and the - // maximum number of key-value pairs is 500. - map metadata = 17; - - // Gateway-related configuration and state. - GatewayConfig gateway_config = 24; -} - -// Gateway-related configuration and state. -message GatewayConfig { - // Indicates whether the device is a gateway. - GatewayType gateway_type = 1; - - // Indicates how to authorize and/or authenticate devices to access the - // gateway. - GatewayAuthMethod gateway_auth_method = 2; - - // [Output only] The ID of the gateway the device accessed most recently. - string last_accessed_gateway_id = 3; - - // [Output only] The most recent time at which the device accessed the gateway - // specified in `last_accessed_gateway`. - google.protobuf.Timestamp last_accessed_gateway_time = 4; -} - -// A container for a group of devices. -message DeviceRegistry { - option (google.api.resource) = { - type: "cloudiot.googleapis.com/Registry" - pattern: "projects/{project}/locations/{location}/registries/{registry}" - }; - - // The identifier of this device registry. For example, `myRegistry`. - string id = 1; - - // The resource path name. For example, - // `projects/example-project/locations/us-central1/registries/my-registry`. - string name = 2; - - // The configuration for notification of telemetry events received from the - // device. All telemetry events that were successfully published by the - // device and acknowledged by Cloud IoT Core are guaranteed to be - // delivered to Cloud Pub/Sub. If multiple configurations match a message, - // only the first matching configuration is used. If you try to publish a - // device telemetry event using MQTT without specifying a Cloud Pub/Sub topic - // for the device's registry, the connection closes automatically. If you try - // to do so using an HTTP connection, an error is returned. Up to 10 - // configurations may be provided. - repeated EventNotificationConfig event_notification_configs = 10; - - // The configuration for notification of new states received from the device. - // State updates are guaranteed to be stored in the state history, but - // notifications to Cloud Pub/Sub are not guaranteed. For example, if - // permissions are misconfigured or the specified topic doesn't exist, no - // notification will be published but the state will still be stored in Cloud - // IoT Core. - StateNotificationConfig state_notification_config = 7; - - // The MQTT configuration for this device registry. - MqttConfig mqtt_config = 4; - - // The DeviceService (HTTP) configuration for this device registry. - HttpConfig http_config = 9; - - // **Beta Feature** - // - // The default logging verbosity for activity from devices in this registry. - // The verbosity level can be overridden by Device.log_level. - LogLevel log_level = 11; - - // The credentials used to verify the device credentials. No more than 10 - // credentials can be bound to a single registry at a time. The verification - // process occurs at the time of device creation or update. If this field is - // empty, no verification is performed. Otherwise, the credentials of a newly - // created device or added credentials of an updated device should be signed - // with one of these registry credentials. - // - // Note, however, that existing devices will never be affected by - // modifications to this list of credentials: after a device has been - // successfully created in a registry, it should be able to connect even if - // its registry credentials are revoked, deleted, or modified. - repeated RegistryCredential credentials = 8; -} - -// The configuration of MQTT for a device registry. -message MqttConfig { - // If enabled, allows connections using the MQTT protocol. Otherwise, MQTT - // connections to this registry will fail. - MqttState mqtt_enabled_state = 1; -} - -// Indicates whether an MQTT connection is enabled or disabled. See the field -// description for details. -enum MqttState { - // No MQTT state specified. If not specified, MQTT will be enabled by default. - MQTT_STATE_UNSPECIFIED = 0; - - // Enables a MQTT connection. - MQTT_ENABLED = 1; - - // Disables a MQTT connection. - MQTT_DISABLED = 2; -} - -// The configuration of the HTTP bridge for a device registry. -message HttpConfig { - // If enabled, allows devices to use DeviceService via the HTTP protocol. - // Otherwise, any requests to DeviceService will fail for this registry. - HttpState http_enabled_state = 1; -} - -// Indicates whether DeviceService (HTTP) is enabled or disabled for the -// registry. See the field description for details. -enum HttpState { - // No HTTP state specified. If not specified, DeviceService will be - // enabled by default. - HTTP_STATE_UNSPECIFIED = 0; - - // Enables DeviceService (HTTP) service for the registry. - HTTP_ENABLED = 1; - - // Disables DeviceService (HTTP) service for the registry. - HTTP_DISABLED = 2; -} - -// **Beta Feature** -// -// The logging verbosity for device activity. Specifies which events should be -// written to logs. For example, if the LogLevel is ERROR, only events that -// terminate in errors will be logged. LogLevel is inclusive; enabling INFO -// logging will also enable ERROR logging. -enum LogLevel { - // No logging specified. If not specified, logging will be disabled. - LOG_LEVEL_UNSPECIFIED = 0; - - // Disables logging. - NONE = 10; - - // Error events will be logged. - ERROR = 20; - - // Informational events will be logged, such as connections and - // disconnections. - INFO = 30; - - // All events will be logged. - DEBUG = 40; -} - -// Gateway type. -enum GatewayType { - // If unspecified, the device is considered a non-gateway device. - GATEWAY_TYPE_UNSPECIFIED = 0; - - // The device is a gateway. - GATEWAY = 1; - - // The device is not a gateway. - NON_GATEWAY = 2; -} - -// The gateway authorization/authentication method. This setting determines how -// Cloud IoT Core authorizes/authenticate devices to access the gateway. -enum GatewayAuthMethod { - // No authentication/authorization method specified. No devices are allowed to - // access the gateway. - GATEWAY_AUTH_METHOD_UNSPECIFIED = 0; - - // The device is authenticated through the gateway association only. Device - // credentials are ignored even if provided. - ASSOCIATION_ONLY = 1; - - // The device is authenticated through its own credentials. Gateway - // association is not checked. - DEVICE_AUTH_TOKEN_ONLY = 2; - - // The device is authenticated through both device credentials and gateway - // association. The device must be bound to the gateway and must provide its - // own credentials. - ASSOCIATION_AND_DEVICE_AUTH_TOKEN = 3; -} - -// The configuration for forwarding telemetry events. -message EventNotificationConfig { - // If the subfolder name matches this string exactly, this configuration will - // be used. The string must not include the leading '/' character. If empty, - // all strings are matched. This field is used only for telemetry events; - // subfolders are not supported for state changes. - string subfolder_matches = 2; - - // A Cloud Pub/Sub topic name. For example, - // `projects/myProject/topics/deviceEvents`. - string pubsub_topic_name = 1; -} - -// The configuration for notification of new states received from the device. -message StateNotificationConfig { - // A Cloud Pub/Sub topic name. For example, - // `projects/myProject/topics/deviceEvents`. - string pubsub_topic_name = 1; -} - -// A server-stored registry credential used to validate device credentials. -message RegistryCredential { - // The credential data. Reserved for expansion in the future. - oneof credential { - // A public key certificate used to verify the device credentials. - PublicKeyCertificate public_key_certificate = 1; - } -} - -// Details of an X.509 certificate. For informational purposes only. -message X509CertificateDetails { - // The entity that signed the certificate. - string issuer = 1; - - // The entity the certificate and public key belong to. - string subject = 2; - - // The time the certificate becomes valid. - google.protobuf.Timestamp start_time = 3; - - // The time the certificate becomes invalid. - google.protobuf.Timestamp expiry_time = 4; - - // The algorithm used to sign the certificate. - string signature_algorithm = 5; - - // The type of public key in the certificate. - string public_key_type = 6; -} - -// A public key certificate format and data. -message PublicKeyCertificate { - // The certificate format. - PublicKeyCertificateFormat format = 1; - - // The certificate data. - string certificate = 2; - - // [Output only] The certificate details. Used only for X.509 certificates. - X509CertificateDetails x509_details = 3; -} - -// The supported formats for the public key. -enum PublicKeyCertificateFormat { - // The format has not been specified. This is an invalid default value and - // must not be used. - UNSPECIFIED_PUBLIC_KEY_CERTIFICATE_FORMAT = 0; - - // An X.509v3 certificate ([RFC5280](https://www.ietf.org/rfc/rfc5280.txt)), - // encoded in base64, and wrapped by `-----BEGIN CERTIFICATE-----` and - // `-----END CERTIFICATE-----`. - X509_CERTIFICATE_PEM = 1; -} - -// A server-stored device credential used for authentication. -message DeviceCredential { - // The credential data. Reserved for expansion in the future. - oneof credential { - // A public key used to verify the signature of JSON Web Tokens (JWTs). - // When adding a new device credential, either via device creation or via - // modifications, this public key credential may be required to be signed by - // one of the registry level certificates. More specifically, if the - // registry contains at least one certificate, any new device credential - // must be signed by one of the registry certificates. As a result, - // when the registry contains certificates, only X.509 certificates are - // accepted as device credentials. However, if the registry does - // not contain a certificate, self-signed certificates and public keys will - // be accepted. New device credentials must be different from every - // registry-level certificate. - PublicKeyCredential public_key = 2; - } - - // [Optional] The time at which this credential becomes invalid. This - // credential will be ignored for new client authentication requests after - // this timestamp; however, it will not be automatically deleted. - google.protobuf.Timestamp expiration_time = 6; -} - -// A public key format and data. -message PublicKeyCredential { - // The format of the key. - PublicKeyFormat format = 1; - - // The key data. - string key = 2; -} - -// The supported formats for the public key. -enum PublicKeyFormat { - // The format has not been specified. This is an invalid default value and - // must not be used. - UNSPECIFIED_PUBLIC_KEY_FORMAT = 0; - - // An RSA public key encoded in base64, and wrapped by - // `-----BEGIN PUBLIC KEY-----` and `-----END PUBLIC KEY-----`. This can be - // used to verify `RS256` signatures in JWT tokens ([RFC7518]( - // https://www.ietf.org/rfc/rfc7518.txt)). - RSA_PEM = 3; - - // As RSA_PEM, but wrapped in an X.509v3 certificate ([RFC5280]( - // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by - // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`. - RSA_X509_PEM = 1; - - // Public key for the ECDSA algorithm using P-256 and SHA-256, encoded in - // base64, and wrapped by `-----BEGIN PUBLIC KEY-----` and `-----END - // PUBLIC KEY-----`. This can be used to verify JWT tokens with the `ES256` - // algorithm ([RFC7518](https://www.ietf.org/rfc/rfc7518.txt)). This curve is - // defined in [OpenSSL](https://www.openssl.org/) as the `prime256v1` curve. - ES256_PEM = 2; - - // As ES256_PEM, but wrapped in an X.509v3 certificate ([RFC5280]( - // https://www.ietf.org/rfc/rfc5280.txt)), encoded in base64, and wrapped by - // `-----BEGIN CERTIFICATE-----` and `-----END CERTIFICATE-----`. - ES256_X509_PEM = 4; -} - -// The device configuration. Eventually delivered to devices. -message DeviceConfig { - // [Output only] The version of this update. The version number is assigned by - // the server, and is always greater than 0 after device creation. The - // version must be 0 on the `CreateDevice` request if a `config` is - // specified; the response of `CreateDevice` will always have a value of 1. - int64 version = 1; - - // [Output only] The time at which this configuration version was updated in - // Cloud IoT Core. This timestamp is set by the server. - google.protobuf.Timestamp cloud_update_time = 2; - - // [Output only] The time at which Cloud IoT Core received the - // acknowledgment from the device, indicating that the device has received - // this configuration version. If this field is not present, the device has - // not yet acknowledged that it received this version. Note that when - // the config was sent to the device, many config versions may have been - // available in Cloud IoT Core while the device was disconnected, and on - // connection, only the latest version is sent to the device. Some - // versions may never be sent to the device, and therefore are never - // acknowledged. This timestamp is set by Cloud IoT Core. - google.protobuf.Timestamp device_ack_time = 3; - - // The device configuration data. - bytes binary_data = 4; -} - -// The device state, as reported by the device. -message DeviceState { - // [Output only] The time at which this state version was updated in Cloud - // IoT Core. - google.protobuf.Timestamp update_time = 1; - - // The device state data. - bytes binary_data = 2; -} diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 6fa7afa4..00000000 --- a/renovate.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "extends": [ - ":separateMajorReleases", - ":combinePatchMinorReleases", - ":ignoreUnstable", - ":prImmediately", - ":updateNotScheduled", - ":automergeDisabled", - ":ignoreModulesAndTests", - ":maintainLockFilesDisabled", - ":autodetectPinVersions" - ], - "ignorePaths": [".kokoro/requirements.txt"], - "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-iot", - "^com.google.cloud:libraries-bom", - "^com.google.cloud.samples:shared-configuration" - ], - "semanticCommitType": "chore", - "semanticCommitScope": "deps" - }, - { - "packagePatterns": [ - "^junit:junit", - "^com.google.truth:truth", - "^org.mockito:mockito-core", - "^org.objenesis:objenesis", - "^com.google.cloud:google-cloud-conformance-tests" - ], - "semanticCommitType": "test", - "semanticCommitScope": "deps" - }, - { - "packagePatterns": [ - "^com.google.cloud:google-cloud-" - ], - "ignoreUnstable": false - }, - { - "packagePatterns": [ - "^com.fasterxml.jackson.core" - ], - "groupName": "jackson dependencies" - } - ], - "semanticCommits": true, - "dependencyDashboard": true -} diff --git a/samples/install-without-bom/pom.xml b/samples/install-without-bom/pom.xml deleted file mode 100644 index ade4ee06..00000000 --- a/samples/install-without-bom/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - 4.0.0 - com.google.cloud - cloudiot-install-without-bom - jar - Google Google Cloud Internet of Things (IoT) Core Install Without Bom - https://github.com/googleapis/java-iot - - - - com.google.cloud.samples - shared-configuration - 1.2.0 - - - - 1.8 - 1.8 - UTF-8 - - - - - - - com.google.cloud - google-cloud-iot - 2.3.4 - - - - - junit - junit - 4.13.2 - test - - - com.google.truth - truth - 1.1.3 - test - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.3.0 - - - add-snippets-source - - add-source - - - - ../snippets/src/main/java - - - - - add-snippets-tests - - add-test-source - - - - ../snippets/src/test/java - - - - - - - - diff --git a/samples/pom.xml b/samples/pom.xml deleted file mode 100644 index 6f87504e..00000000 --- a/samples/pom.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - 4.0.0 - com.google.cloud - google-cloud-cloudiot-samples - 0.0.1-SNAPSHOT - pom - Google Google Cloud Internet of Things (IoT) Core Samples Parent - https://github.com/googleapis/java-iot - - Java idiomatic client for Google Cloud Platform services. - - - - - com.google.cloud.samples - shared-configuration - 1.2.0 - - - - 1.8 - 1.8 - UTF-8 - - - - install-without-bom - snapshot - snippets - - - - - - org.apache.maven.plugins - maven-deploy-plugin - 3.0.0 - - true - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - - true - - - - - diff --git a/samples/snapshot/pom.xml b/samples/snapshot/pom.xml deleted file mode 100644 index b6ca7539..00000000 --- a/samples/snapshot/pom.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - 4.0.0 - com.google.cloud - cloudiot-snapshot - jar - Google Google Cloud Internet of Things (IoT) Core Snapshot Samples - https://github.com/googleapis/java-iot - - - - com.google.cloud.samples - shared-configuration - 1.2.0 - - - - 1.8 - 1.8 - UTF-8 - - - - - - com.google.cloud - google-cloud-iot - 2.3.4 - - - - junit - junit - 4.13.2 - test - - - com.google.truth - truth - 1.1.3 - test - - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 3.3.0 - - - add-snippets-source - - add-source - - - - ../snippets/src/main/java - - - - - add-snippets-tests - - add-test-source - - - - ../snippets/src/test/java - - - - - - - - \ No newline at end of file diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/AsyncBindDeviceToGateway.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/AsyncBindDeviceToGateway.java deleted file mode 100644 index bf0600eb..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/AsyncBindDeviceToGateway.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_binddevicetogateway_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.BindDeviceToGatewayRequest; -import com.google.cloud.iot.v1.BindDeviceToGatewayResponse; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class AsyncBindDeviceToGateway { - - public static void main(String[] args) throws Exception { - asyncBindDeviceToGateway(); - } - - public static void asyncBindDeviceToGateway() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - BindDeviceToGatewayRequest request = - BindDeviceToGatewayRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setGatewayId("gatewayId-1354641793") - .setDeviceId("deviceId1109191185") - .build(); - ApiFuture future = - deviceManagerClient.bindDeviceToGatewayCallable().futureCall(request); - // Do something. - BindDeviceToGatewayResponse response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_binddevicetogateway_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGateway.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGateway.java deleted file mode 100644 index 93b5e8b6..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGateway.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_binddevicetogateway_sync] -import com.google.cloud.iot.v1.BindDeviceToGatewayRequest; -import com.google.cloud.iot.v1.BindDeviceToGatewayResponse; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncBindDeviceToGateway { - - public static void main(String[] args) throws Exception { - syncBindDeviceToGateway(); - } - - public static void syncBindDeviceToGateway() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - BindDeviceToGatewayRequest request = - BindDeviceToGatewayRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setGatewayId("gatewayId-1354641793") - .setDeviceId("deviceId1109191185") - .build(); - BindDeviceToGatewayResponse response = deviceManagerClient.bindDeviceToGateway(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_binddevicetogateway_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGatewayRegistrynameStringString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGatewayRegistrynameStringString.java deleted file mode 100644 index f9aa834a..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGatewayRegistrynameStringString.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_binddevicetogateway_registrynamestringstring_sync] -import com.google.cloud.iot.v1.BindDeviceToGatewayResponse; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncBindDeviceToGatewayRegistrynameStringString { - - public static void main(String[] args) throws Exception { - syncBindDeviceToGatewayRegistrynameStringString(); - } - - public static void syncBindDeviceToGatewayRegistrynameStringString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - BindDeviceToGatewayResponse response = - deviceManagerClient.bindDeviceToGateway(parent, gatewayId, deviceId); - } - } -} -// [END iot_v1_generated_devicemanagerclient_binddevicetogateway_registrynamestringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGatewayStringStringString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGatewayStringStringString.java deleted file mode 100644 index 3320bcdb..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/binddevicetogateway/SyncBindDeviceToGatewayStringStringString.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_binddevicetogateway_stringstringstring_sync] -import com.google.cloud.iot.v1.BindDeviceToGatewayResponse; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncBindDeviceToGatewayStringStringString { - - public static void main(String[] args) throws Exception { - syncBindDeviceToGatewayStringStringString(); - } - - public static void syncBindDeviceToGatewayStringStringString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString(); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - BindDeviceToGatewayResponse response = - deviceManagerClient.bindDeviceToGateway(parent, gatewayId, deviceId); - } - } -} -// [END iot_v1_generated_devicemanagerclient_binddevicetogateway_stringstringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetCredentialsProvider.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetCredentialsProvider.java deleted file mode 100644 index 285f027e..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetCredentialsProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_create_setcredentialsprovider_sync] -import com.google.api.gax.core.FixedCredentialsProvider; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceManagerSettings; -import com.google.cloud.iot.v1.myCredentials; - -public class SyncCreateSetCredentialsProvider { - - public static void main(String[] args) throws Exception { - syncCreateSetCredentialsProvider(); - } - - public static void syncCreateSetCredentialsProvider() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - DeviceManagerSettings deviceManagerSettings = - DeviceManagerSettings.newBuilder() - .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) - .build(); - DeviceManagerClient deviceManagerClient = DeviceManagerClient.create(deviceManagerSettings); - } -} -// [END iot_v1_generated_devicemanagerclient_create_setcredentialsprovider_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetCredentialsProvider1.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetCredentialsProvider1.java deleted file mode 100644 index c5109cf4..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetCredentialsProvider1.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_create_setcredentialsprovider1_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceManagerSettings; - -public class SyncCreateSetCredentialsProvider1 { - - public static void main(String[] args) throws Exception { - syncCreateSetCredentialsProvider1(); - } - - public static void syncCreateSetCredentialsProvider1() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - DeviceManagerSettings deviceManagerSettings = - DeviceManagerSettings.newBuilder() - .setTransportChannelProvider( - DeviceManagerSettings.defaultHttpJsonTransportProviderBuilder().build()) - .build(); - DeviceManagerClient deviceManagerClient = DeviceManagerClient.create(deviceManagerSettings); - } -} -// [END iot_v1_generated_devicemanagerclient_create_setcredentialsprovider1_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetEndpoint.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetEndpoint.java deleted file mode 100644 index 5fddcdd7..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/create/SyncCreateSetEndpoint.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_create_setendpoint_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceManagerSettings; -import com.google.cloud.iot.v1.myEndpoint; - -public class SyncCreateSetEndpoint { - - public static void main(String[] args) throws Exception { - syncCreateSetEndpoint(); - } - - public static void syncCreateSetEndpoint() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - DeviceManagerSettings deviceManagerSettings = - DeviceManagerSettings.newBuilder().setEndpoint(myEndpoint).build(); - DeviceManagerClient deviceManagerClient = DeviceManagerClient.create(deviceManagerSettings); - } -} -// [END iot_v1_generated_devicemanagerclient_create_setendpoint_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/AsyncCreateDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/AsyncCreateDevice.java deleted file mode 100644 index c32dd9f7..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/AsyncCreateDevice.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_createdevice_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.CreateDeviceRequest; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class AsyncCreateDevice { - - public static void main(String[] args) throws Exception { - asyncCreateDevice(); - } - - public static void asyncCreateDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - CreateDeviceRequest request = - CreateDeviceRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setDevice(Device.newBuilder().build()) - .build(); - ApiFuture future = deviceManagerClient.createDeviceCallable().futureCall(request); - // Do something. - Device response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_createdevice_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDevice.java deleted file mode 100644 index ed4c38ef..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDevice.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_createdevice_sync] -import com.google.cloud.iot.v1.CreateDeviceRequest; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncCreateDevice { - - public static void main(String[] args) throws Exception { - syncCreateDevice(); - } - - public static void syncCreateDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - CreateDeviceRequest request = - CreateDeviceRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setDevice(Device.newBuilder().build()) - .build(); - Device response = deviceManagerClient.createDevice(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_createdevice_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDeviceRegistrynameDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDeviceRegistrynameDevice.java deleted file mode 100644 index 0668b8e9..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDeviceRegistrynameDevice.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_createdevice_registrynamedevice_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncCreateDeviceRegistrynameDevice { - - public static void main(String[] args) throws Exception { - syncCreateDeviceRegistrynameDevice(); - } - - public static void syncCreateDeviceRegistrynameDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Device device = Device.newBuilder().build(); - Device response = deviceManagerClient.createDevice(parent, device); - } - } -} -// [END iot_v1_generated_devicemanagerclient_createdevice_registrynamedevice_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDeviceStringDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDeviceStringDevice.java deleted file mode 100644 index 1b9d6368..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdevice/SyncCreateDeviceStringDevice.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_createdevice_stringdevice_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncCreateDeviceStringDevice { - - public static void main(String[] args) throws Exception { - syncCreateDeviceStringDevice(); - } - - public static void syncCreateDeviceStringDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString(); - Device device = Device.newBuilder().build(); - Device response = deviceManagerClient.createDevice(parent, device); - } - } -} -// [END iot_v1_generated_devicemanagerclient_createdevice_stringdevice_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/AsyncCreateDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/AsyncCreateDeviceRegistry.java deleted file mode 100644 index 4e86e807..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/AsyncCreateDeviceRegistry.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_createdeviceregistry_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.CreateDeviceRegistryRequest; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.LocationName; - -public class AsyncCreateDeviceRegistry { - - public static void main(String[] args) throws Exception { - asyncCreateDeviceRegistry(); - } - - public static void asyncCreateDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - CreateDeviceRegistryRequest request = - CreateDeviceRegistryRequest.newBuilder() - .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) - .setDeviceRegistry(DeviceRegistry.newBuilder().build()) - .build(); - ApiFuture future = - deviceManagerClient.createDeviceRegistryCallable().futureCall(request); - // Do something. - DeviceRegistry response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_createdeviceregistry_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistry.java deleted file mode 100644 index f006a234..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistry.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_createdeviceregistry_sync] -import com.google.cloud.iot.v1.CreateDeviceRegistryRequest; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.LocationName; - -public class SyncCreateDeviceRegistry { - - public static void main(String[] args) throws Exception { - syncCreateDeviceRegistry(); - } - - public static void syncCreateDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - CreateDeviceRegistryRequest request = - CreateDeviceRegistryRequest.newBuilder() - .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) - .setDeviceRegistry(DeviceRegistry.newBuilder().build()) - .build(); - DeviceRegistry response = deviceManagerClient.createDeviceRegistry(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_createdeviceregistry_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistryLocationnameDeviceregistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistryLocationnameDeviceregistry.java deleted file mode 100644 index aec64c2c..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistryLocationnameDeviceregistry.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_createdeviceregistry_locationnamedeviceregistry_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.LocationName; - -public class SyncCreateDeviceRegistryLocationnameDeviceregistry { - - public static void main(String[] args) throws Exception { - syncCreateDeviceRegistryLocationnameDeviceregistry(); - } - - public static void syncCreateDeviceRegistryLocationnameDeviceregistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - DeviceRegistry response = deviceManagerClient.createDeviceRegistry(parent, deviceRegistry); - } - } -} -// [END iot_v1_generated_devicemanagerclient_createdeviceregistry_locationnamedeviceregistry_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistryStringDeviceregistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistryStringDeviceregistry.java deleted file mode 100644 index 53edea10..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/createdeviceregistry/SyncCreateDeviceRegistryStringDeviceregistry.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_createdeviceregistry_stringdeviceregistry_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.LocationName; - -public class SyncCreateDeviceRegistryStringDeviceregistry { - - public static void main(String[] args) throws Exception { - syncCreateDeviceRegistryStringDeviceregistry(); - } - - public static void syncCreateDeviceRegistryStringDeviceregistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - DeviceRegistry response = deviceManagerClient.createDeviceRegistry(parent, deviceRegistry); - } - } -} -// [END iot_v1_generated_devicemanagerclient_createdeviceregistry_stringdeviceregistry_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/AsyncDeleteDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/AsyncDeleteDevice.java deleted file mode 100644 index 4fe186ce..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/AsyncDeleteDevice.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_deletedevice_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeleteDeviceRequest; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.protobuf.Empty; - -public class AsyncDeleteDevice { - - public static void main(String[] args) throws Exception { - asyncDeleteDevice(); - } - - public static void asyncDeleteDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeleteDeviceRequest request = - DeleteDeviceRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .build(); - ApiFuture future = deviceManagerClient.deleteDeviceCallable().futureCall(request); - // Do something. - future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_deletedevice_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDevice.java deleted file mode 100644 index 672164f4..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDevice.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_deletedevice_sync] -import com.google.cloud.iot.v1.DeleteDeviceRequest; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.protobuf.Empty; - -public class SyncDeleteDevice { - - public static void main(String[] args) throws Exception { - syncDeleteDevice(); - } - - public static void syncDeleteDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeleteDeviceRequest request = - DeleteDeviceRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .build(); - deviceManagerClient.deleteDevice(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_deletedevice_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDeviceDevicename.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDeviceDevicename.java deleted file mode 100644 index b0d90aeb..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDeviceDevicename.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_deletedevice_devicename_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.protobuf.Empty; - -public class SyncDeleteDeviceDevicename { - - public static void main(String[] args) throws Exception { - syncDeleteDeviceDevicename(); - } - - public static void syncDeleteDeviceDevicename() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - deviceManagerClient.deleteDevice(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_deletedevice_devicename_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDeviceString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDeviceString.java deleted file mode 100644 index e76460d9..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedevice/SyncDeleteDeviceString.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_deletedevice_string_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.protobuf.Empty; - -public class SyncDeleteDeviceString { - - public static void main(String[] args) throws Exception { - syncDeleteDeviceString(); - } - - public static void syncDeleteDeviceString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - deviceManagerClient.deleteDevice(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_deletedevice_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/AsyncDeleteDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/AsyncDeleteDeviceRegistry.java deleted file mode 100644 index eb0c74f9..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/AsyncDeleteDeviceRegistry.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_deletedeviceregistry_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeleteDeviceRegistryRequest; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.protobuf.Empty; - -public class AsyncDeleteDeviceRegistry { - - public static void main(String[] args) throws Exception { - asyncDeleteDeviceRegistry(); - } - - public static void asyncDeleteDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeleteDeviceRegistryRequest request = - DeleteDeviceRegistryRequest.newBuilder() - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .build(); - ApiFuture future = - deviceManagerClient.deleteDeviceRegistryCallable().futureCall(request); - // Do something. - future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_deletedeviceregistry_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistry.java deleted file mode 100644 index 8e2faadf..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistry.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_deletedeviceregistry_sync] -import com.google.cloud.iot.v1.DeleteDeviceRegistryRequest; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.protobuf.Empty; - -public class SyncDeleteDeviceRegistry { - - public static void main(String[] args) throws Exception { - syncDeleteDeviceRegistry(); - } - - public static void syncDeleteDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeleteDeviceRegistryRequest request = - DeleteDeviceRegistryRequest.newBuilder() - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .build(); - deviceManagerClient.deleteDeviceRegistry(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_deletedeviceregistry_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistryRegistryname.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistryRegistryname.java deleted file mode 100644 index c789b761..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistryRegistryname.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_deletedeviceregistry_registryname_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.protobuf.Empty; - -public class SyncDeleteDeviceRegistryRegistryname { - - public static void main(String[] args) throws Exception { - syncDeleteDeviceRegistryRegistryname(); - } - - public static void syncDeleteDeviceRegistryRegistryname() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - deviceManagerClient.deleteDeviceRegistry(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_deletedeviceregistry_registryname_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistryString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistryString.java deleted file mode 100644 index 1c52d298..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/deletedeviceregistry/SyncDeleteDeviceRegistryString.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_deletedeviceregistry_string_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.protobuf.Empty; - -public class SyncDeleteDeviceRegistryString { - - public static void main(String[] args) throws Exception { - syncDeleteDeviceRegistryString(); - } - - public static void syncDeleteDeviceRegistryString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString(); - deviceManagerClient.deleteDeviceRegistry(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_deletedeviceregistry_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/AsyncGetDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/AsyncGetDevice.java deleted file mode 100644 index 6ed1480d..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/AsyncGetDevice.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getdevice_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.GetDeviceRequest; -import com.google.protobuf.FieldMask; - -public class AsyncGetDevice { - - public static void main(String[] args) throws Exception { - asyncGetDevice(); - } - - public static void asyncGetDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - GetDeviceRequest request = - GetDeviceRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setFieldMask(FieldMask.newBuilder().build()) - .build(); - ApiFuture future = deviceManagerClient.getDeviceCallable().futureCall(request); - // Do something. - Device response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getdevice_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDevice.java deleted file mode 100644 index f512ba34..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDevice.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getdevice_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.GetDeviceRequest; -import com.google.protobuf.FieldMask; - -public class SyncGetDevice { - - public static void main(String[] args) throws Exception { - syncGetDevice(); - } - - public static void syncGetDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - GetDeviceRequest request = - GetDeviceRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setFieldMask(FieldMask.newBuilder().build()) - .build(); - Device response = deviceManagerClient.getDevice(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getdevice_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDeviceDevicename.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDeviceDevicename.java deleted file mode 100644 index 329c3f63..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDeviceDevicename.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getdevice_devicename_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; - -public class SyncGetDeviceDevicename { - - public static void main(String[] args) throws Exception { - syncGetDeviceDevicename(); - } - - public static void syncGetDeviceDevicename() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - Device response = deviceManagerClient.getDevice(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getdevice_devicename_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDeviceString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDeviceString.java deleted file mode 100644 index 59a9bcaf..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdevice/SyncGetDeviceString.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getdevice_string_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; - -public class SyncGetDeviceString { - - public static void main(String[] args) throws Exception { - syncGetDeviceString(); - } - - public static void syncGetDeviceString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - Device response = deviceManagerClient.getDevice(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getdevice_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/AsyncGetDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/AsyncGetDeviceRegistry.java deleted file mode 100644 index 4db67f49..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/AsyncGetDeviceRegistry.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getdeviceregistry_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.GetDeviceRegistryRequest; -import com.google.cloud.iot.v1.RegistryName; - -public class AsyncGetDeviceRegistry { - - public static void main(String[] args) throws Exception { - asyncGetDeviceRegistry(); - } - - public static void asyncGetDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - GetDeviceRegistryRequest request = - GetDeviceRegistryRequest.newBuilder() - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .build(); - ApiFuture future = - deviceManagerClient.getDeviceRegistryCallable().futureCall(request); - // Do something. - DeviceRegistry response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getdeviceregistry_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistry.java deleted file mode 100644 index 97b7b58c..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistry.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getdeviceregistry_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.GetDeviceRegistryRequest; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncGetDeviceRegistry { - - public static void main(String[] args) throws Exception { - syncGetDeviceRegistry(); - } - - public static void syncGetDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - GetDeviceRegistryRequest request = - GetDeviceRegistryRequest.newBuilder() - .setName(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .build(); - DeviceRegistry response = deviceManagerClient.getDeviceRegistry(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getdeviceregistry_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistryRegistryname.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistryRegistryname.java deleted file mode 100644 index 93391ae8..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistryRegistryname.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getdeviceregistry_registryname_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncGetDeviceRegistryRegistryname { - - public static void main(String[] args) throws Exception { - syncGetDeviceRegistryRegistryname(); - } - - public static void syncGetDeviceRegistryRegistryname() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - RegistryName name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - DeviceRegistry response = deviceManagerClient.getDeviceRegistry(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getdeviceregistry_registryname_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistryString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistryString.java deleted file mode 100644 index 11b118e0..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getdeviceregistry/SyncGetDeviceRegistryString.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getdeviceregistry_string_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncGetDeviceRegistryString { - - public static void main(String[] args) throws Exception { - syncGetDeviceRegistryString(); - } - - public static void syncGetDeviceRegistryString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString(); - DeviceRegistry response = deviceManagerClient.getDeviceRegistry(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getdeviceregistry_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/AsyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/AsyncGetIamPolicy.java deleted file mode 100644 index dadf1c5f..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/AsyncGetIamPolicy.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getiampolicy_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.GetPolicyOptions; -import com.google.iam.v1.Policy; - -public class AsyncGetIamPolicy { - - public static void main(String[] args) throws Exception { - asyncGetIamPolicy(); - } - - public static void asyncGetIamPolicy() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - GetIamPolicyRequest request = - GetIamPolicyRequest.newBuilder() - .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setOptions(GetPolicyOptions.newBuilder().build()) - .build(); - ApiFuture future = deviceManagerClient.getIamPolicyCallable().futureCall(request); - // Do something. - Policy response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicy.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicy.java deleted file mode 100644 index d39aaef8..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicy.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getiampolicy_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.GetIamPolicyRequest; -import com.google.iam.v1.GetPolicyOptions; -import com.google.iam.v1.Policy; - -public class SyncGetIamPolicy { - - public static void main(String[] args) throws Exception { - syncGetIamPolicy(); - } - - public static void syncGetIamPolicy() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - GetIamPolicyRequest request = - GetIamPolicyRequest.newBuilder() - .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setOptions(GetPolicyOptions.newBuilder().build()) - .build(); - Policy response = deviceManagerClient.getIamPolicy(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicyResourcename.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicyResourcename.java deleted file mode 100644 index afd18cc1..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicyResourcename.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getiampolicy_resourcename_sync] -import com.google.api.resourcenames.ResourceName; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.Policy; - -public class SyncGetIamPolicyResourcename { - - public static void main(String[] args) throws Exception { - syncGetIamPolicyResourcename(); - } - - public static void syncGetIamPolicyResourcename() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Policy response = deviceManagerClient.getIamPolicy(resource); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getiampolicy_resourcename_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicyString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicyString.java deleted file mode 100644 index 325b52bc..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/getiampolicy/SyncGetIamPolicyString.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_getiampolicy_string_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.iam.v1.Policy; - -public class SyncGetIamPolicyString { - - public static void main(String[] args) throws Exception { - syncGetIamPolicyString(); - } - - public static void syncGetIamPolicyString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String resource = - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - Policy response = deviceManagerClient.getIamPolicy(resource); - } - } -} -// [END iot_v1_generated_devicemanagerclient_getiampolicy_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/AsyncListDeviceConfigVersions.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/AsyncListDeviceConfigVersions.java deleted file mode 100644 index 3bc78f65..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/AsyncListDeviceConfigVersions.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceconfigversions_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; - -public class AsyncListDeviceConfigVersions { - - public static void main(String[] args) throws Exception { - asyncListDeviceConfigVersions(); - } - - public static void asyncListDeviceConfigVersions() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDeviceConfigVersionsRequest request = - ListDeviceConfigVersionsRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumVersions(-315385036) - .build(); - ApiFuture future = - deviceManagerClient.listDeviceConfigVersionsCallable().futureCall(request); - // Do something. - ListDeviceConfigVersionsResponse response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceconfigversions_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersions.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersions.java deleted file mode 100644 index 099c31bc..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersions.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceconfigversions_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsRequest; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; - -public class SyncListDeviceConfigVersions { - - public static void main(String[] args) throws Exception { - syncListDeviceConfigVersions(); - } - - public static void syncListDeviceConfigVersions() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDeviceConfigVersionsRequest request = - ListDeviceConfigVersionsRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumVersions(-315385036) - .build(); - ListDeviceConfigVersionsResponse response = - deviceManagerClient.listDeviceConfigVersions(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceconfigversions_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersionsDevicename.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersionsDevicename.java deleted file mode 100644 index f1b1ab27..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersionsDevicename.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceconfigversions_devicename_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; - -public class SyncListDeviceConfigVersionsDevicename { - - public static void main(String[] args) throws Exception { - syncListDeviceConfigVersionsDevicename(); - } - - public static void syncListDeviceConfigVersionsDevicename() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ListDeviceConfigVersionsResponse response = - deviceManagerClient.listDeviceConfigVersions(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceconfigversions_devicename_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersionsString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersionsString.java deleted file mode 100644 index ce453141..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceconfigversions/SyncListDeviceConfigVersionsString.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceconfigversions_string_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ListDeviceConfigVersionsResponse; - -public class SyncListDeviceConfigVersionsString { - - public static void main(String[] args) throws Exception { - syncListDeviceConfigVersionsString(); - } - - public static void syncListDeviceConfigVersionsString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - ListDeviceConfigVersionsResponse response = - deviceManagerClient.listDeviceConfigVersions(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceconfigversions_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/AsyncListDeviceRegistries.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/AsyncListDeviceRegistries.java deleted file mode 100644 index 1505390e..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/AsyncListDeviceRegistries.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceregistries_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.ListDeviceRegistriesRequest; -import com.google.cloud.iot.v1.LocationName; - -public class AsyncListDeviceRegistries { - - public static void main(String[] args) throws Exception { - asyncListDeviceRegistries(); - } - - public static void asyncListDeviceRegistries() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDeviceRegistriesRequest request = - ListDeviceRegistriesRequest.newBuilder() - .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - ApiFuture future = - deviceManagerClient.listDeviceRegistriesPagedCallable().futureCall(request); - // Do something. - for (DeviceRegistry element : future.get().iterateAll()) { - // doThingsWith(element); - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceregistries_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/AsyncListDeviceRegistriesPaged.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/AsyncListDeviceRegistriesPaged.java deleted file mode 100644 index 1d15147f..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/AsyncListDeviceRegistriesPaged.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceregistries_paged_async] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.ListDeviceRegistriesRequest; -import com.google.cloud.iot.v1.ListDeviceRegistriesResponse; -import com.google.cloud.iot.v1.LocationName; -import com.google.common.base.Strings; - -public class AsyncListDeviceRegistriesPaged { - - public static void main(String[] args) throws Exception { - asyncListDeviceRegistriesPaged(); - } - - public static void asyncListDeviceRegistriesPaged() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDeviceRegistriesRequest request = - ListDeviceRegistriesRequest.newBuilder() - .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - while (true) { - ListDeviceRegistriesResponse response = - deviceManagerClient.listDeviceRegistriesCallable().call(request); - for (DeviceRegistry element : response.getDeviceRegistriesList()) { - // doThingsWith(element); - } - String nextPageToken = response.getNextPageToken(); - if (!Strings.isNullOrEmpty(nextPageToken)) { - request = request.toBuilder().setPageToken(nextPageToken).build(); - } else { - break; - } - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceregistries_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistries.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistries.java deleted file mode 100644 index aa193ba2..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistries.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceregistries_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.ListDeviceRegistriesRequest; -import com.google.cloud.iot.v1.LocationName; - -public class SyncListDeviceRegistries { - - public static void main(String[] args) throws Exception { - syncListDeviceRegistries(); - } - - public static void syncListDeviceRegistries() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDeviceRegistriesRequest request = - ListDeviceRegistriesRequest.newBuilder() - .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - for (DeviceRegistry element : - deviceManagerClient.listDeviceRegistries(request).iterateAll()) { - // doThingsWith(element); - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceregistries_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistriesLocationname.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistriesLocationname.java deleted file mode 100644 index 9fbe430e..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistriesLocationname.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceregistries_locationname_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.LocationName; - -public class SyncListDeviceRegistriesLocationname { - - public static void main(String[] args) throws Exception { - syncListDeviceRegistriesLocationname(); - } - - public static void syncListDeviceRegistriesLocationname() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); - for (DeviceRegistry element : deviceManagerClient.listDeviceRegistries(parent).iterateAll()) { - // doThingsWith(element); - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceregistries_locationname_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistriesString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistriesString.java deleted file mode 100644 index 66eb18bc..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdeviceregistries/SyncListDeviceRegistriesString.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdeviceregistries_string_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.LocationName; - -public class SyncListDeviceRegistriesString { - - public static void main(String[] args) throws Exception { - syncListDeviceRegistriesString(); - } - - public static void syncListDeviceRegistriesString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); - for (DeviceRegistry element : deviceManagerClient.listDeviceRegistries(parent).iterateAll()) { - // doThingsWith(element); - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdeviceregistries_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/AsyncListDevices.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/AsyncListDevices.java deleted file mode 100644 index 5de58634..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/AsyncListDevices.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevices_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.GatewayListOptions; -import com.google.cloud.iot.v1.ListDevicesRequest; -import com.google.cloud.iot.v1.RegistryName; -import com.google.protobuf.FieldMask; -import java.util.ArrayList; - -public class AsyncListDevices { - - public static void main(String[] args) throws Exception { - asyncListDevices(); - } - - public static void asyncListDevices() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDevicesRequest request = - ListDevicesRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllDeviceNumIds(new ArrayList()) - .addAllDeviceIds(new ArrayList()) - .setFieldMask(FieldMask.newBuilder().build()) - .setGatewayListOptions(GatewayListOptions.newBuilder().build()) - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - ApiFuture future = deviceManagerClient.listDevicesPagedCallable().futureCall(request); - // Do something. - for (Device element : future.get().iterateAll()) { - // doThingsWith(element); - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevices_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/AsyncListDevicesPaged.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/AsyncListDevicesPaged.java deleted file mode 100644 index b6834b22..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/AsyncListDevicesPaged.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevices_paged_async] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.GatewayListOptions; -import com.google.cloud.iot.v1.ListDevicesRequest; -import com.google.cloud.iot.v1.ListDevicesResponse; -import com.google.cloud.iot.v1.RegistryName; -import com.google.common.base.Strings; -import com.google.protobuf.FieldMask; -import java.util.ArrayList; - -public class AsyncListDevicesPaged { - - public static void main(String[] args) throws Exception { - asyncListDevicesPaged(); - } - - public static void asyncListDevicesPaged() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDevicesRequest request = - ListDevicesRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllDeviceNumIds(new ArrayList()) - .addAllDeviceIds(new ArrayList()) - .setFieldMask(FieldMask.newBuilder().build()) - .setGatewayListOptions(GatewayListOptions.newBuilder().build()) - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - while (true) { - ListDevicesResponse response = deviceManagerClient.listDevicesCallable().call(request); - for (Device element : response.getDevicesList()) { - // doThingsWith(element); - } - String nextPageToken = response.getNextPageToken(); - if (!Strings.isNullOrEmpty(nextPageToken)) { - request = request.toBuilder().setPageToken(nextPageToken).build(); - } else { - break; - } - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevices_paged_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevices.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevices.java deleted file mode 100644 index 35f931f4..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevices.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevices_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.GatewayListOptions; -import com.google.cloud.iot.v1.ListDevicesRequest; -import com.google.cloud.iot.v1.RegistryName; -import com.google.protobuf.FieldMask; -import java.util.ArrayList; - -public class SyncListDevices { - - public static void main(String[] args) throws Exception { - syncListDevices(); - } - - public static void syncListDevices() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDevicesRequest request = - ListDevicesRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllDeviceNumIds(new ArrayList()) - .addAllDeviceIds(new ArrayList()) - .setFieldMask(FieldMask.newBuilder().build()) - .setGatewayListOptions(GatewayListOptions.newBuilder().build()) - .setPageSize(883849137) - .setPageToken("pageToken873572522") - .build(); - for (Device element : deviceManagerClient.listDevices(request).iterateAll()) { - // doThingsWith(element); - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevices_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevicesRegistryname.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevicesRegistryname.java deleted file mode 100644 index babdca15..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevicesRegistryname.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevices_registryname_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncListDevicesRegistryname { - - public static void main(String[] args) throws Exception { - syncListDevicesRegistryname(); - } - - public static void syncListDevicesRegistryname() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - for (Device element : deviceManagerClient.listDevices(parent).iterateAll()) { - // doThingsWith(element); - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevices_registryname_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevicesString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevicesString.java deleted file mode 100644 index 30f00c4b..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevices/SyncListDevicesString.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevices_string_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; - -public class SyncListDevicesString { - - public static void main(String[] args) throws Exception { - syncListDevicesString(); - } - - public static void syncListDevicesString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString(); - for (Device element : deviceManagerClient.listDevices(parent).iterateAll()) { - // doThingsWith(element); - } - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevices_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/AsyncListDeviceStates.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/AsyncListDeviceStates.java deleted file mode 100644 index 13e122b8..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/AsyncListDeviceStates.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevicestates_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ListDeviceStatesRequest; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; - -public class AsyncListDeviceStates { - - public static void main(String[] args) throws Exception { - asyncListDeviceStates(); - } - - public static void asyncListDeviceStates() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDeviceStatesRequest request = - ListDeviceStatesRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumStates(1643330779) - .build(); - ApiFuture future = - deviceManagerClient.listDeviceStatesCallable().futureCall(request); - // Do something. - ListDeviceStatesResponse response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevicestates_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStates.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStates.java deleted file mode 100644 index b94cdca6..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStates.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevicestates_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ListDeviceStatesRequest; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; - -public class SyncListDeviceStates { - - public static void main(String[] args) throws Exception { - syncListDeviceStates(); - } - - public static void syncListDeviceStates() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ListDeviceStatesRequest request = - ListDeviceStatesRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setNumStates(1643330779) - .build(); - ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevicestates_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStatesDevicename.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStatesDevicename.java deleted file mode 100644 index 28087811..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStatesDevicename.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevicestates_devicename_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; - -public class SyncListDeviceStatesDevicename { - - public static void main(String[] args) throws Exception { - syncListDeviceStatesDevicename(); - } - - public static void syncListDeviceStatesDevicename() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevicestates_devicename_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStatesString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStatesString.java deleted file mode 100644 index bef4b985..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/listdevicestates/SyncListDeviceStatesString.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_listdevicestates_string_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ListDeviceStatesResponse; - -public class SyncListDeviceStatesString { - - public static void main(String[] args) throws Exception { - syncListDeviceStatesString(); - } - - public static void syncListDeviceStatesString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - ListDeviceStatesResponse response = deviceManagerClient.listDeviceStates(name); - } - } -} -// [END iot_v1_generated_devicemanagerclient_listdevicestates_string_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/AsyncModifyCloudToDeviceConfig.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/AsyncModifyCloudToDeviceConfig.java deleted file mode 100644 index 53ac67b0..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/AsyncModifyCloudToDeviceConfig.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_modifycloudtodeviceconfig_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest; -import com.google.protobuf.ByteString; - -public class AsyncModifyCloudToDeviceConfig { - - public static void main(String[] args) throws Exception { - asyncModifyCloudToDeviceConfig(); - } - - public static void asyncModifyCloudToDeviceConfig() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ModifyCloudToDeviceConfigRequest request = - ModifyCloudToDeviceConfigRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setVersionToUpdate(462348390) - .setBinaryData(ByteString.EMPTY) - .build(); - ApiFuture future = - deviceManagerClient.modifyCloudToDeviceConfigCallable().futureCall(request); - // Do something. - DeviceConfig response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_modifycloudtodeviceconfig_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfig.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfig.java deleted file mode 100644 index b969d5c5..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_modifycloudtodeviceconfig_sync] -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.ModifyCloudToDeviceConfigRequest; -import com.google.protobuf.ByteString; - -public class SyncModifyCloudToDeviceConfig { - - public static void main(String[] args) throws Exception { - syncModifyCloudToDeviceConfig(); - } - - public static void syncModifyCloudToDeviceConfig() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ModifyCloudToDeviceConfigRequest request = - ModifyCloudToDeviceConfigRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setVersionToUpdate(462348390) - .setBinaryData(ByteString.EMPTY) - .build(); - DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_modifycloudtodeviceconfig_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfigDevicenameBytestring.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfigDevicenameBytestring.java deleted file mode 100644 index 3e15c46c..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfigDevicenameBytestring.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_modifycloudtodeviceconfig_devicenamebytestring_sync] -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.protobuf.ByteString; - -public class SyncModifyCloudToDeviceConfigDevicenameBytestring { - - public static void main(String[] args) throws Exception { - syncModifyCloudToDeviceConfigDevicenameBytestring(); - } - - public static void syncModifyCloudToDeviceConfigDevicenameBytestring() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(name, binaryData); - } - } -} -// [END iot_v1_generated_devicemanagerclient_modifycloudtodeviceconfig_devicenamebytestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfigStringBytestring.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfigStringBytestring.java deleted file mode 100644 index af28c7a2..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/modifycloudtodeviceconfig/SyncModifyCloudToDeviceConfigStringBytestring.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_modifycloudtodeviceconfig_stringbytestring_sync] -import com.google.cloud.iot.v1.DeviceConfig; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.protobuf.ByteString; - -public class SyncModifyCloudToDeviceConfigStringBytestring { - - public static void main(String[] args) throws Exception { - syncModifyCloudToDeviceConfigStringBytestring(); - } - - public static void syncModifyCloudToDeviceConfigStringBytestring() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - ByteString binaryData = ByteString.EMPTY; - DeviceConfig response = deviceManagerClient.modifyCloudToDeviceConfig(name, binaryData); - } - } -} -// [END iot_v1_generated_devicemanagerclient_modifycloudtodeviceconfig_stringbytestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/AsyncSendCommandToDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/AsyncSendCommandToDevice.java deleted file mode 100644 index b43ab6dd..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/AsyncSendCommandToDevice.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_sendcommandtodevice_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.SendCommandToDeviceRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.protobuf.ByteString; - -public class AsyncSendCommandToDevice { - - public static void main(String[] args) throws Exception { - asyncSendCommandToDevice(); - } - - public static void asyncSendCommandToDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - SendCommandToDeviceRequest request = - SendCommandToDeviceRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setBinaryData(ByteString.EMPTY) - .setSubfolder("subfolder153561774") - .build(); - ApiFuture future = - deviceManagerClient.sendCommandToDeviceCallable().futureCall(request); - // Do something. - SendCommandToDeviceResponse response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_sendcommandtodevice_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDevice.java deleted file mode 100644 index 245161f7..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDevice.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_sendcommandtodevice_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.SendCommandToDeviceRequest; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.protobuf.ByteString; - -public class SyncSendCommandToDevice { - - public static void main(String[] args) throws Exception { - syncSendCommandToDevice(); - } - - public static void syncSendCommandToDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - SendCommandToDeviceRequest request = - SendCommandToDeviceRequest.newBuilder() - .setName( - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString()) - .setBinaryData(ByteString.EMPTY) - .setSubfolder("subfolder153561774") - .build(); - SendCommandToDeviceResponse response = deviceManagerClient.sendCommandToDevice(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_sendcommandtodevice_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceDevicenameBytestring.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceDevicenameBytestring.java deleted file mode 100644 index 9d671416..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceDevicenameBytestring.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_sendcommandtodevice_devicenamebytestring_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.protobuf.ByteString; - -public class SyncSendCommandToDeviceDevicenameBytestring { - - public static void main(String[] args) throws Exception { - syncSendCommandToDeviceDevicenameBytestring(); - } - - public static void syncSendCommandToDeviceDevicenameBytestring() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - SendCommandToDeviceResponse response = - deviceManagerClient.sendCommandToDevice(name, binaryData); - } - } -} -// [END iot_v1_generated_devicemanagerclient_sendcommandtodevice_devicenamebytestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceDevicenameBytestringString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceDevicenameBytestringString.java deleted file mode 100644 index 4a5cbcae..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceDevicenameBytestringString.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_sendcommandtodevice_devicenamebytestringstring_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.protobuf.ByteString; - -public class SyncSendCommandToDeviceDevicenameBytestringString { - - public static void main(String[] args) throws Exception { - syncSendCommandToDeviceDevicenameBytestringString(); - } - - public static void syncSendCommandToDeviceDevicenameBytestringString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeviceName name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]"); - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - SendCommandToDeviceResponse response = - deviceManagerClient.sendCommandToDevice(name, binaryData, subfolder); - } - } -} -// [END iot_v1_generated_devicemanagerclient_sendcommandtodevice_devicenamebytestringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceStringBytestring.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceStringBytestring.java deleted file mode 100644 index 37db077a..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceStringBytestring.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_sendcommandtodevice_stringbytestring_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.protobuf.ByteString; - -public class SyncSendCommandToDeviceStringBytestring { - - public static void main(String[] args) throws Exception { - syncSendCommandToDeviceStringBytestring(); - } - - public static void syncSendCommandToDeviceStringBytestring() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - ByteString binaryData = ByteString.EMPTY; - SendCommandToDeviceResponse response = - deviceManagerClient.sendCommandToDevice(name, binaryData); - } - } -} -// [END iot_v1_generated_devicemanagerclient_sendcommandtodevice_stringbytestring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceStringBytestringString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceStringBytestringString.java deleted file mode 100644 index e4c4ec9a..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/sendcommandtodevice/SyncSendCommandToDeviceStringBytestringString.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_sendcommandtodevice_stringbytestringstring_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.cloud.iot.v1.SendCommandToDeviceResponse; -import com.google.protobuf.ByteString; - -public class SyncSendCommandToDeviceStringBytestringString { - - public static void main(String[] args) throws Exception { - syncSendCommandToDeviceStringBytestringString(); - } - - public static void syncSendCommandToDeviceStringBytestringString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String name = DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - ByteString binaryData = ByteString.EMPTY; - String subfolder = "subfolder153561774"; - SendCommandToDeviceResponse response = - deviceManagerClient.sendCommandToDevice(name, binaryData, subfolder); - } - } -} -// [END iot_v1_generated_devicemanagerclient_sendcommandtodevice_stringbytestringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/AsyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/AsyncSetIamPolicy.java deleted file mode 100644 index 444ef29a..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/AsyncSetIamPolicy.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_setiampolicy_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.protobuf.FieldMask; - -public class AsyncSetIamPolicy { - - public static void main(String[] args) throws Exception { - asyncSetIamPolicy(); - } - - public static void asyncSetIamPolicy() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder() - .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setPolicy(Policy.newBuilder().build()) - .setUpdateMask(FieldMask.newBuilder().build()) - .build(); - ApiFuture future = deviceManagerClient.setIamPolicyCallable().futureCall(request); - // Do something. - Policy response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_setiampolicy_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicy.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicy.java deleted file mode 100644 index de60829e..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicy.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_setiampolicy_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.Policy; -import com.google.iam.v1.SetIamPolicyRequest; -import com.google.protobuf.FieldMask; - -public class SyncSetIamPolicy { - - public static void main(String[] args) throws Exception { - syncSetIamPolicy(); - } - - public static void syncSetIamPolicy() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - SetIamPolicyRequest request = - SetIamPolicyRequest.newBuilder() - .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setPolicy(Policy.newBuilder().build()) - .setUpdateMask(FieldMask.newBuilder().build()) - .build(); - Policy response = deviceManagerClient.setIamPolicy(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_setiampolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java deleted file mode 100644 index 8f685e72..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicyResourcenamePolicy.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_setiampolicy_resourcenamepolicy_sync] -import com.google.api.resourcenames.ResourceName; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.Policy; - -public class SyncSetIamPolicyResourcenamePolicy { - - public static void main(String[] args) throws Exception { - syncSetIamPolicyResourcenamePolicy(); - } - - public static void syncSetIamPolicyResourcenamePolicy() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - Policy policy = Policy.newBuilder().build(); - Policy response = deviceManagerClient.setIamPolicy(resource, policy); - } - } -} -// [END iot_v1_generated_devicemanagerclient_setiampolicy_resourcenamepolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicyStringPolicy.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicyStringPolicy.java deleted file mode 100644 index 14b780a8..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/setiampolicy/SyncSetIamPolicyStringPolicy.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_setiampolicy_stringpolicy_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.iam.v1.Policy; - -public class SyncSetIamPolicyStringPolicy { - - public static void main(String[] args) throws Exception { - syncSetIamPolicyStringPolicy(); - } - - public static void syncSetIamPolicyStringPolicy() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String resource = - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - Policy policy = Policy.newBuilder().build(); - Policy response = deviceManagerClient.setIamPolicy(resource, policy); - } - } -} -// [END iot_v1_generated_devicemanagerclient_setiampolicy_stringpolicy_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/AsyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/AsyncTestIamPermissions.java deleted file mode 100644 index f64a9771..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/AsyncTestIamPermissions.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_testiampermissions_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import java.util.ArrayList; - -public class AsyncTestIamPermissions { - - public static void main(String[] args) throws Exception { - asyncTestIamPermissions(); - } - - public static void asyncTestIamPermissions() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllPermissions(new ArrayList()) - .build(); - ApiFuture future = - deviceManagerClient.testIamPermissionsCallable().futureCall(request); - // Do something. - TestIamPermissionsResponse response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_testiampermissions_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissions.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissions.java deleted file mode 100644 index 24804e6e..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissions.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_testiampermissions_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.TestIamPermissionsRequest; -import com.google.iam.v1.TestIamPermissionsResponse; -import java.util.ArrayList; - -public class SyncTestIamPermissions { - - public static void main(String[] args) throws Exception { - syncTestIamPermissions(); - } - - public static void syncTestIamPermissions() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - TestIamPermissionsRequest request = - TestIamPermissionsRequest.newBuilder() - .setResource(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .addAllPermissions(new ArrayList()) - .build(); - TestIamPermissionsResponse response = deviceManagerClient.testIamPermissions(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_testiampermissions_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java deleted file mode 100644 index 408a6e2d..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissionsResourcenameListstring.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_testiampermissions_resourcenameliststring_sync] -import com.google.api.resourcenames.ResourceName; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.iam.v1.TestIamPermissionsResponse; -import java.util.ArrayList; -import java.util.List; - -public class SyncTestIamPermissionsResourcenameListstring { - - public static void main(String[] args) throws Exception { - syncTestIamPermissionsResourcenameListstring(); - } - - public static void syncTestIamPermissionsResourcenameListstring() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - ResourceName resource = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - List permissions = new ArrayList<>(); - TestIamPermissionsResponse response = - deviceManagerClient.testIamPermissions(resource, permissions); - } - } -} -// [END iot_v1_generated_devicemanagerclient_testiampermissions_resourcenameliststring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissionsStringListstring.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissionsStringListstring.java deleted file mode 100644 index ea6b4057..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/testiampermissions/SyncTestIamPermissionsStringListstring.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_testiampermissions_stringliststring_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceName; -import com.google.iam.v1.TestIamPermissionsResponse; -import java.util.ArrayList; -import java.util.List; - -public class SyncTestIamPermissionsStringListstring { - - public static void main(String[] args) throws Exception { - syncTestIamPermissionsStringListstring(); - } - - public static void syncTestIamPermissionsStringListstring() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String resource = - DeviceName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]", "[DEVICE]").toString(); - List permissions = new ArrayList<>(); - TestIamPermissionsResponse response = - deviceManagerClient.testIamPermissions(resource, permissions); - } - } -} -// [END iot_v1_generated_devicemanagerclient_testiampermissions_stringliststring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/AsyncUnbindDeviceFromGateway.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/AsyncUnbindDeviceFromGateway.java deleted file mode 100644 index 1e750960..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/AsyncUnbindDeviceFromGateway.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_unbinddevicefromgateway_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse; - -public class AsyncUnbindDeviceFromGateway { - - public static void main(String[] args) throws Exception { - asyncUnbindDeviceFromGateway(); - } - - public static void asyncUnbindDeviceFromGateway() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - UnbindDeviceFromGatewayRequest request = - UnbindDeviceFromGatewayRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setGatewayId("gatewayId-1354641793") - .setDeviceId("deviceId1109191185") - .build(); - ApiFuture future = - deviceManagerClient.unbindDeviceFromGatewayCallable().futureCall(request); - // Do something. - UnbindDeviceFromGatewayResponse response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_unbinddevicefromgateway_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGateway.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGateway.java deleted file mode 100644 index 05ac4995..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGateway.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_unbinddevicefromgateway_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayRequest; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse; - -public class SyncUnbindDeviceFromGateway { - - public static void main(String[] args) throws Exception { - syncUnbindDeviceFromGateway(); - } - - public static void syncUnbindDeviceFromGateway() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - UnbindDeviceFromGatewayRequest request = - UnbindDeviceFromGatewayRequest.newBuilder() - .setParent(RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString()) - .setGatewayId("gatewayId-1354641793") - .setDeviceId("deviceId1109191185") - .build(); - UnbindDeviceFromGatewayResponse response = - deviceManagerClient.unbindDeviceFromGateway(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_unbinddevicefromgateway_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGatewayRegistrynameStringString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGatewayRegistrynameStringString.java deleted file mode 100644 index b5ca333b..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGatewayRegistrynameStringString.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_unbinddevicefromgateway_registrynamestringstring_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse; - -public class SyncUnbindDeviceFromGatewayRegistrynameStringString { - - public static void main(String[] args) throws Exception { - syncUnbindDeviceFromGatewayRegistrynameStringString(); - } - - public static void syncUnbindDeviceFromGatewayRegistrynameStringString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - RegistryName parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]"); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - UnbindDeviceFromGatewayResponse response = - deviceManagerClient.unbindDeviceFromGateway(parent, gatewayId, deviceId); - } - } -} -// [END iot_v1_generated_devicemanagerclient_unbinddevicefromgateway_registrynamestringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGatewayStringStringString.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGatewayStringStringString.java deleted file mode 100644 index c3242587..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/unbinddevicefromgateway/SyncUnbindDeviceFromGatewayStringStringString.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_unbinddevicefromgateway_stringstringstring_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.RegistryName; -import com.google.cloud.iot.v1.UnbindDeviceFromGatewayResponse; - -public class SyncUnbindDeviceFromGatewayStringStringString { - - public static void main(String[] args) throws Exception { - syncUnbindDeviceFromGatewayStringStringString(); - } - - public static void syncUnbindDeviceFromGatewayStringStringString() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - String parent = RegistryName.of("[PROJECT]", "[LOCATION]", "[REGISTRY]").toString(); - String gatewayId = "gatewayId-1354641793"; - String deviceId = "deviceId1109191185"; - UnbindDeviceFromGatewayResponse response = - deviceManagerClient.unbindDeviceFromGateway(parent, gatewayId, deviceId); - } - } -} -// [END iot_v1_generated_devicemanagerclient_unbinddevicefromgateway_stringstringstring_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/AsyncUpdateDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/AsyncUpdateDevice.java deleted file mode 100644 index e7fe139f..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/AsyncUpdateDevice.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_updatedevice_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.UpdateDeviceRequest; -import com.google.protobuf.FieldMask; - -public class AsyncUpdateDevice { - - public static void main(String[] args) throws Exception { - asyncUpdateDevice(); - } - - public static void asyncUpdateDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - UpdateDeviceRequest request = - UpdateDeviceRequest.newBuilder() - .setDevice(Device.newBuilder().build()) - .setUpdateMask(FieldMask.newBuilder().build()) - .build(); - ApiFuture future = deviceManagerClient.updateDeviceCallable().futureCall(request); - // Do something. - Device response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_updatedevice_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/SyncUpdateDevice.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/SyncUpdateDevice.java deleted file mode 100644 index d4738692..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/SyncUpdateDevice.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_updatedevice_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.UpdateDeviceRequest; -import com.google.protobuf.FieldMask; - -public class SyncUpdateDevice { - - public static void main(String[] args) throws Exception { - syncUpdateDevice(); - } - - public static void syncUpdateDevice() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - UpdateDeviceRequest request = - UpdateDeviceRequest.newBuilder() - .setDevice(Device.newBuilder().build()) - .setUpdateMask(FieldMask.newBuilder().build()) - .build(); - Device response = deviceManagerClient.updateDevice(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_updatedevice_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/SyncUpdateDeviceDeviceFieldmask.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/SyncUpdateDeviceDeviceFieldmask.java deleted file mode 100644 index 340f7f05..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedevice/SyncUpdateDeviceDeviceFieldmask.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_updatedevice_devicefieldmask_sync] -import com.google.cloud.iot.v1.Device; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.protobuf.FieldMask; - -public class SyncUpdateDeviceDeviceFieldmask { - - public static void main(String[] args) throws Exception { - syncUpdateDeviceDeviceFieldmask(); - } - - public static void syncUpdateDeviceDeviceFieldmask() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - Device device = Device.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - Device response = deviceManagerClient.updateDevice(device, updateMask); - } - } -} -// [END iot_v1_generated_devicemanagerclient_updatedevice_devicefieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/AsyncUpdateDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/AsyncUpdateDeviceRegistry.java deleted file mode 100644 index 61f76c97..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/AsyncUpdateDeviceRegistry.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_updatedeviceregistry_async] -import com.google.api.core.ApiFuture; -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.UpdateDeviceRegistryRequest; -import com.google.protobuf.FieldMask; - -public class AsyncUpdateDeviceRegistry { - - public static void main(String[] args) throws Exception { - asyncUpdateDeviceRegistry(); - } - - public static void asyncUpdateDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - UpdateDeviceRegistryRequest request = - UpdateDeviceRegistryRequest.newBuilder() - .setDeviceRegistry(DeviceRegistry.newBuilder().build()) - .setUpdateMask(FieldMask.newBuilder().build()) - .build(); - ApiFuture future = - deviceManagerClient.updateDeviceRegistryCallable().futureCall(request); - // Do something. - DeviceRegistry response = future.get(); - } - } -} -// [END iot_v1_generated_devicemanagerclient_updatedeviceregistry_async] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/SyncUpdateDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/SyncUpdateDeviceRegistry.java deleted file mode 100644 index a4c294e8..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/SyncUpdateDeviceRegistry.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_updatedeviceregistry_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.cloud.iot.v1.UpdateDeviceRegistryRequest; -import com.google.protobuf.FieldMask; - -public class SyncUpdateDeviceRegistry { - - public static void main(String[] args) throws Exception { - syncUpdateDeviceRegistry(); - } - - public static void syncUpdateDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - UpdateDeviceRegistryRequest request = - UpdateDeviceRegistryRequest.newBuilder() - .setDeviceRegistry(DeviceRegistry.newBuilder().build()) - .setUpdateMask(FieldMask.newBuilder().build()) - .build(); - DeviceRegistry response = deviceManagerClient.updateDeviceRegistry(request); - } - } -} -// [END iot_v1_generated_devicemanagerclient_updatedeviceregistry_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/SyncUpdateDeviceRegistryDeviceregistryFieldmask.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/SyncUpdateDeviceRegistryDeviceregistryFieldmask.java deleted file mode 100644 index 02623e6a..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagerclient/updatedeviceregistry/SyncUpdateDeviceRegistryDeviceregistryFieldmask.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagerclient_updatedeviceregistry_deviceregistryfieldmask_sync] -import com.google.cloud.iot.v1.DeviceManagerClient; -import com.google.cloud.iot.v1.DeviceRegistry; -import com.google.protobuf.FieldMask; - -public class SyncUpdateDeviceRegistryDeviceregistryFieldmask { - - public static void main(String[] args) throws Exception { - syncUpdateDeviceRegistryDeviceregistryFieldmask(); - } - - public static void syncUpdateDeviceRegistryDeviceregistryFieldmask() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { - DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); - FieldMask updateMask = FieldMask.newBuilder().build(); - DeviceRegistry response = - deviceManagerClient.updateDeviceRegistry(deviceRegistry, updateMask); - } - } -} -// [END iot_v1_generated_devicemanagerclient_updatedeviceregistry_deviceregistryfieldmask_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagersettings/createdeviceregistry/SyncCreateDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagersettings/createdeviceregistry/SyncCreateDeviceRegistry.java deleted file mode 100644 index 2f78cb64..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/devicemanagersettings/createdeviceregistry/SyncCreateDeviceRegistry.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.samples; - -// [START iot_v1_generated_devicemanagersettings_createdeviceregistry_sync] -import com.google.cloud.iot.v1.DeviceManagerSettings; -import java.time.Duration; - -public class SyncCreateDeviceRegistry { - - public static void main(String[] args) throws Exception { - syncCreateDeviceRegistry(); - } - - public static void syncCreateDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - DeviceManagerSettings.Builder deviceManagerSettingsBuilder = DeviceManagerSettings.newBuilder(); - deviceManagerSettingsBuilder - .createDeviceRegistrySettings() - .setRetrySettings( - deviceManagerSettingsBuilder - .createDeviceRegistrySettings() - .getRetrySettings() - .toBuilder() - .setTotalTimeout(Duration.ofSeconds(30)) - .build()); - DeviceManagerSettings deviceManagerSettings = deviceManagerSettingsBuilder.build(); - } -} -// [END iot_v1_generated_devicemanagersettings_createdeviceregistry_sync] diff --git a/samples/snippets/generated/com/google/cloud/iot/v1/stub/devicemanagerstubsettings/createdeviceregistry/SyncCreateDeviceRegistry.java b/samples/snippets/generated/com/google/cloud/iot/v1/stub/devicemanagerstubsettings/createdeviceregistry/SyncCreateDeviceRegistry.java deleted file mode 100644 index b4d979e5..00000000 --- a/samples/snippets/generated/com/google/cloud/iot/v1/stub/devicemanagerstubsettings/createdeviceregistry/SyncCreateDeviceRegistry.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.cloud.iot.v1.stub.samples; - -// [START iot_v1_generated_devicemanagerstubsettings_createdeviceregistry_sync] -import com.google.cloud.iot.v1.stub.DeviceManagerStubSettings; -import java.time.Duration; - -public class SyncCreateDeviceRegistry { - - public static void main(String[] args) throws Exception { - syncCreateDeviceRegistry(); - } - - public static void syncCreateDeviceRegistry() throws Exception { - // This snippet has been automatically generated and should be regarded as a code template only. - // It will require modifications to work: - // - It may require correct/in-range values for request initialization. - // - It may require specifying regional endpoints when creating the service client as shown in - // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library - DeviceManagerStubSettings.Builder deviceManagerSettingsBuilder = - DeviceManagerStubSettings.newBuilder(); - deviceManagerSettingsBuilder - .createDeviceRegistrySettings() - .setRetrySettings( - deviceManagerSettingsBuilder - .createDeviceRegistrySettings() - .getRetrySettings() - .toBuilder() - .setTotalTimeout(Duration.ofSeconds(30)) - .build()); - DeviceManagerStubSettings deviceManagerSettings = deviceManagerSettingsBuilder.build(); - } -} -// [END iot_v1_generated_devicemanagerstubsettings_createdeviceregistry_sync] diff --git a/samples/snippets/pom.xml b/samples/snippets/pom.xml deleted file mode 100644 index 4ee878a1..00000000 --- a/samples/snippets/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - com.google.cloud - cloudiot-snippets - jar - Google Google Cloud Internet of Things (IoT) Core Snippets - https://github.com/googleapis/java-iot - - - - com.google.cloud.samples - shared-configuration - 1.2.0 - - - - 1.8 - 1.8 - UTF-8 - - - - - - - - com.google.cloud - libraries-bom - 26.1.2 - pom - import - - - - - - - com.google.cloud - google-cloud-iot - - - - - junit - junit - 4.13.2 - test - - - com.google.truth - truth - 1.1.3 - test - - - diff --git a/synth.metadata b/synth.metadata deleted file mode 100644 index b71f6294..00000000 --- a/synth.metadata +++ /dev/null @@ -1,214 +0,0 @@ -{ - "sources": [ - { - "git": { - "name": ".", - "remote": "https://github.com/googleapis/java-iot.git", - "sha": "41703ce9dae6fe99b72b588f3ba5d6382b369405" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "08c4eeb531c01ad031134dca94b18e3f7dd35902", - "internalRef": "378718217" - } - }, - { - "git": { - "name": "synthtool", - "remote": "https://github.com/googleapis/synthtool.git", - "sha": "8eae0234a16b26c2ff616d305dbd9786c8b10a47" - } - } - ], - "destinations": [ - { - "client": { - "source": "googleapis", - "apiName": "iot", - "apiVersion": "v1", - "language": "java", - "generator": "bazel" - } - } - ], - "generatedFiles": [ - ".github/CODEOWNERS", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/generated-files-bot.yml", - ".github/readme/synth.py", - ".github/release-please.yml", - ".github/snippet-bot.yml", - ".github/sync-repo-settings.yaml", - ".github/trusted-contribution.yml", - ".github/workflows/approve-readme.yaml", - ".github/workflows/auto-release.yaml", - ".github/workflows/ci.yaml", - ".github/workflows/samples.yaml", - ".kokoro/build.bat", - ".kokoro/build.sh", - ".kokoro/coerce_logs.sh", - ".kokoro/common.cfg", - ".kokoro/common.sh", - ".kokoro/continuous/common.cfg", - ".kokoro/continuous/java8.cfg", - ".kokoro/continuous/readme.cfg", - ".kokoro/dependencies.sh", - ".kokoro/nightly/common.cfg", - ".kokoro/nightly/integration.cfg", - ".kokoro/nightly/java11.cfg", - ".kokoro/nightly/java7.cfg", - ".kokoro/nightly/java8-osx.cfg", - ".kokoro/nightly/java8-win.cfg", - ".kokoro/nightly/java8.cfg", - ".kokoro/nightly/samples.cfg", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/clirr.cfg", - ".kokoro/presubmit/common.cfg", - ".kokoro/presubmit/dependencies.cfg", - ".kokoro/presubmit/integration.cfg", - ".kokoro/presubmit/java11.cfg", - ".kokoro/presubmit/java7.cfg", - ".kokoro/presubmit/java8-osx.cfg", - ".kokoro/presubmit/java8-win.cfg", - ".kokoro/presubmit/java8.cfg", - ".kokoro/presubmit/linkage-monitor.cfg", - ".kokoro/presubmit/lint.cfg", - ".kokoro/presubmit/samples.cfg", - ".kokoro/readme.sh", - ".kokoro/release/bump_snapshot.cfg", - ".kokoro/release/common.cfg", - ".kokoro/release/common.sh", - ".kokoro/release/drop.cfg", - ".kokoro/release/drop.sh", - ".kokoro/release/promote.cfg", - ".kokoro/release/promote.sh", - ".kokoro/release/publish_javadoc.cfg", - ".kokoro/release/publish_javadoc.sh", - ".kokoro/release/publish_javadoc11.cfg", - ".kokoro/release/publish_javadoc11.sh", - ".kokoro/release/snapshot.cfg", - ".kokoro/release/snapshot.sh", - ".kokoro/release/stage.cfg", - ".kokoro/release/stage.sh", - ".kokoro/trampoline.sh", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.md", - "LICENSE", - "codecov.yaml", - "google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java", - "google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerSettings.java", - "google-cloud-iot/src/main/java/com/google/cloud/iot/v1/gapic_metadata.json", - "google-cloud-iot/src/main/java/com/google/cloud/iot/v1/package-info.java", - "google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStub.java", - "google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/DeviceManagerStubSettings.java", - "google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/GrpcDeviceManagerCallableFactory.java", - "google-cloud-iot/src/main/java/com/google/cloud/iot/v1/stub/GrpcDeviceManagerStub.java", - "google-cloud-iot/src/test/java/com/google/cloud/iot/v1/DeviceManagerClientTest.java", - "google-cloud-iot/src/test/java/com/google/cloud/iot/v1/MockDeviceManager.java", - "google-cloud-iot/src/test/java/com/google/cloud/iot/v1/MockDeviceManagerImpl.java", - "grpc-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceManagerGrpc.java", - "java.header", - "license-checks.xml", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayResponse.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/BindDeviceToGatewayResponseOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRegistryRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRegistryRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/CreateDeviceRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRegistryRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRegistryRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeleteDeviceRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/Device.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceConfig.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceConfigOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceCredential.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceCredentialOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceManagerProto.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceName.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceRegistry.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceRegistryOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceState.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/DeviceStateOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/EventNotificationConfig.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/EventNotificationConfigOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayAuthMethod.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayConfig.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayConfigOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayListOptions.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayListOptionsOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GatewayType.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRegistryRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRegistryRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/GetDeviceRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpConfig.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpConfigOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/HttpState.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsResponse.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceConfigVersionsResponseOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesResponse.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceRegistriesResponseOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesResponse.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDeviceStatesResponseOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesResponse.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ListDevicesResponseOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/LocationName.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/LogLevel.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ModifyCloudToDeviceConfigRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ModifyCloudToDeviceConfigRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttConfig.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttConfigOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/MqttState.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificate.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificateFormat.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCertificateOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCredential.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyCredentialOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/PublicKeyFormat.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryCredential.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryCredentialOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/RegistryName.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/ResourcesProto.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceResponse.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/SendCommandToDeviceResponseOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/StateNotificationConfig.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/StateNotificationConfigOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayResponse.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UnbindDeviceFromGatewayResponseOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRegistryRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRegistryRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRequest.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/UpdateDeviceRequestOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/X509CertificateDetails.java", - "proto-google-cloud-iot-v1/src/main/java/com/google/cloud/iot/v1/X509CertificateDetailsOrBuilder.java", - "proto-google-cloud-iot-v1/src/main/proto/google/cloud/iot/v1/device_manager.proto", - "proto-google-cloud-iot-v1/src/main/proto/google/cloud/iot/v1/resources.proto", - "renovate.json", - "samples/install-without-bom/pom.xml", - "samples/pom.xml", - "samples/snapshot/pom.xml", - "samples/snippets/pom.xml" - ] -} \ No newline at end of file diff --git a/versions.txt b/versions.txt deleted file mode 100644 index 77173b8c..00000000 --- a/versions.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Format: -# module:released-version:current-version - -google-cloud-iot:2.3.5:2.3.5 -grpc-google-cloud-iot-v1:2.3.5:2.3.5 -proto-google-cloud-iot-v1:2.3.5:2.3.5