diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..516312fb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,51 @@ +--- +name: Bug report +about: Create a report to help us improve + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +Please run down the following list and make sure you've tried the usual "quick fixes": + + - Search the issues already opened: https://github.com/googleapis/java-monitoring/issues + - Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform + +If you are still having issues, please include as much information as possible: + +#### Environment details + +1. Specify the API at the beginning of the title. For example, "BigQuery: ..."). + General, Core, and Other are also allowed as types +2. OS type and version: +3. Java version: +4. monitoring version(s): + +#### Steps to reproduce + + 1. ? + 2. ? + +#### Code example + +```java +// example +``` + +#### Stack trace +``` +Any relevant stacktrace here. +``` + +#### External references such as API reference guides + +- ? + +#### Any additional information below + + +Following these steps guarantees the quickest resolution possible. + +Thanks! diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..754e30c6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,21 @@ +--- +name: Feature request +about: Suggest an idea for this library + +--- + +Thanks for stopping by to let us know something could be better! + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. + +**Is your feature request related to a problem? Please describe.** +What the problem is. Example: I'm always frustrated when [...] + +**Describe the solution you'd like** +What you want to happen. + +**Describe alternatives you've considered** +Any alternative solutions or features you've considered. + +**Additional context** +Any other context or screenshots about the feature request. diff --git a/.github/ISSUE_TEMPLATE/support_request.md b/.github/ISSUE_TEMPLATE/support_request.md new file mode 100644 index 00000000..99586903 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/support_request.md @@ -0,0 +1,7 @@ +--- +name: Support request +about: If you have a support contract with Google, please create an issue in the Google Cloud Support console. + +--- + +**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..0bd0ee06 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1 @@ +Fixes # (it's a good idea to open an issue first for context and/or discussion) \ No newline at end of file diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 00000000..82744682 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1 @@ +releaseType: java-yoshi diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..dc2d514c --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +.gitignore + +# Packages +dist +bin +var +sdist +target + +# Unit test / coverage reports +.coverage +.tox +nosetests.xml + +# Translations +*.mo + +# Mr Developer +.mr.developer.cfg + +.metadata +.project +.pydevproject +*.iml +.idea +.settings +.DS_Store +.classpath + +# Built documentation +docs/ + + +# Wheel directory used in Travis builds. +gcloud-java-wheels/ +src/test/resources/gcd-head.zip +src/test/resources/gcd-v1beta2-rev1-2.1.1.zip + +# API key file containing value of GOOGLE_API_KEY for integration tests +api_key + +# Python utilities +*.pyc +artman-genfiles +venv \ No newline at end of file diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 00000000..3cab337d --- /dev/null +++ b/.kokoro/build.bat @@ -0,0 +1,3 @@ +:: See documentation in type-shell-output.bat + +"C:\Program Files\Git\bin\bash.exe" github/java-monitoring/.kokoro/build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 00000000..fa132f41 --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,60 @@ +#!/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}/.. + +# Print out Java version +java -version +echo ${JOB_TYPE} + +mvn install -B -V \ + -DskipTests=true \ + -Dclirr.skip=true \ + -Dmaven.javadoc.skip=true \ + -Dgcloud.download.skip=true \ + -T 1C + +# if GOOGLE_APPLICATION_CREDIENTIALS 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_ROOT}/src/${GOOGLE_APPLICATION_CREDENTIALS}) +fi + +case ${JOB_TYPE} in +test) + mvn test -B -Dclirr.skip=true + bash ${KOKORO_GFILE_DIR}/codecov.sh + bash .kokoro/coerce_logs.sh + ;; +lint) + mvn com.coveo:fmt-maven-plugin:check + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} -DtrimStackTrace=false -Dclirr.skip=true -fae verify + bash .kokoro/coerce_logs.sh + ;; +clirr) + mvn -B clirr:check + ;; +*) + ;; +esac \ No newline at end of file diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 00000000..5cf7ba49 --- /dev/null +++ b/.kokoro/coerce_logs.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script finds and moves sponge logs so that they can be found by placer +# and are not flagged as flaky by sponge. + +set -eo pipefail + +## Get the directory of the build script +scriptDir=$(realpath $(dirname "${BASH_SOURCE[0]}")) +## cd to the parent directory, i.e. the root of the git repo +cd ${scriptDir}/.. + +job=$(basename ${KOKORO_JOB_NAME}) + +echo "coercing sponge logs..." +for xml in `find . -name *-sponge_log.xml` +do + echo "processing ${xml}" + class=$(basename ${xml} | cut -d- -f2) + dir=$(dirname ${xml})/${job}/${class} + text=$(dirname ${xml})/${class}-sponge_log.txt + mkdir -p ${dir} + mv ${xml} ${dir}/sponge_log.xml + mv ${text} ${dir}/sponge_log.txt +done diff --git a/.kokoro/common.cfg b/.kokoro/common.cfg new file mode 100644 index 00000000..74bd8a18 --- /dev/null +++ b/.kokoro/common.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR} +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# All builds use the trampoline script to run in docker. +build_file: "java-monitoring/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/build.sh" +} diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 00000000..be68e805 --- /dev/null +++ b/.kokoro/continuous/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-monitoring/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/continuous/dependencies.cfg b/.kokoro/continuous/dependencies.cfg new file mode 100644 index 00000000..249a310d --- /dev/null +++ b/.kokoro/continuous/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/dependencies.sh" +} diff --git a/.kokoro/continuous/integration.cfg b/.kokoro/continuous/integration.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/continuous/integration.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/continuous/java11.cfg b/.kokoro/continuous/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/continuous/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/continuous/java7.cfg b/.kokoro/continuous/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/continuous/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/continuous/java8-osx.cfg b/.kokoro/continuous/java8-osx.cfg new file mode 100644 index 00000000..97b8e7f3 --- /dev/null +++ b/.kokoro/continuous/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-monitoring/.kokoro/build.sh" diff --git a/.kokoro/continuous/java8-win.cfg b/.kokoro/continuous/java8-win.cfg new file mode 100644 index 00000000..f1403d7f --- /dev/null +++ b/.kokoro/continuous/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-monitoring/.kokoro/build.bat" diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/continuous/java8.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/continuous/lint.cfg b/.kokoro/continuous/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/continuous/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/continuous/propose_release.cfg b/.kokoro/continuous/propose_release.cfg new file mode 100644 index 00000000..f3f83836 --- /dev/null +++ b/.kokoro/continuous/propose_release.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-monitoring/.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-monitoring/.kokoro/continuous/propose_release.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/continuous/propose_release.sh b/.kokoro/continuous/propose_release.sh new file mode 100755 index 00000000..971c1c01 --- /dev/null +++ b/.kokoro/continuous/propose_release.sh @@ -0,0 +1,29 @@ +#!/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-monitoring \ + --package-name="monitoring" \ + --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 new file mode 100755 index 00000000..ddce8788 --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,27 @@ +#!/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 + +cd github/java-monitoring/ + +# Print out Java +java -version +echo $JOB_TYPE + +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" + +mvn install -DskipTests=true -B -V +mvn -B dependency:analyze -DfailOnWarning=true diff --git a/.kokoro/linkage-monitor.sh b/.kokoro/linkage-monitor.sh new file mode 100755 index 00000000..c187d1d2 --- /dev/null +++ b/.kokoro/linkage-monitor.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail +# Display commands being run. +set -x + +cd github/java-monitoring/ + +# Print out Java version +java -version +echo ${JOB_TYPE} + +mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgcloud.download.skip=true -B -V + +# Kokoro job cloud-opensource-java/ubuntu/linkage-monitor-gcs creates this JAR +JAR=linkage-monitor-latest-all-deps.jar +curl -v -O "https://storage.googleapis.com/cloud-opensource-java-linkage-monitor/${JAR}" + +# Fails if there's new linkage errors compared with baseline +java -jar ${JAR} com.google.cloud:libraries-bom diff --git a/.kokoro/nightly/common.cfg b/.kokoro/nightly/common.cfg new file mode 100644 index 00000000..be68e805 --- /dev/null +++ b/.kokoro/nightly/common.cfg @@ -0,0 +1,25 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-monitoring/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} diff --git a/.kokoro/nightly/dependencies.cfg b/.kokoro/nightly/dependencies.cfg new file mode 100644 index 00000000..249a310d --- /dev/null +++ b/.kokoro/nightly/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/dependencies.sh" +} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/nightly/integration.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/nightly/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/nightly/java7.cfg b/.kokoro/nightly/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/nightly/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/nightly/java8-osx.cfg b/.kokoro/nightly/java8-osx.cfg new file mode 100644 index 00000000..97b8e7f3 --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-monitoring/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 00000000..f1403d7f --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-monitoring/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/nightly/java8.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/nightly/lint.cfg b/.kokoro/nightly/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/nightly/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/presubmit/clirr.cfg b/.kokoro/presubmit/clirr.cfg new file mode 100644 index 00000000..ec572442 --- /dev/null +++ b/.kokoro/presubmit/clirr.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "clirr" +} \ No newline at end of file diff --git a/.kokoro/presubmit/common.cfg b/.kokoro/presubmit/common.cfg new file mode 100644 index 00000000..cd55490d --- /dev/null +++ b/.kokoro/presubmit/common.cfg @@ -0,0 +1,34 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + regex: "**/*sponge_log.txt" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-monitoring/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/build.sh" +} + +env_vars: { + key: "JOB_TYPE" + value: "test" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "dpebot_codecov_token" + } + } +} diff --git a/.kokoro/presubmit/dependencies.cfg b/.kokoro/presubmit/dependencies.cfg new file mode 100644 index 00000000..249a310d --- /dev/null +++ b/.kokoro/presubmit/dependencies.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/dependencies.sh" +} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 00000000..141f90c1 --- /dev/null +++ b/.kokoro/presubmit/integration.cfg @@ -0,0 +1,31 @@ +# 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" +} + +env_vars: { + key: "GCLOUD_PROJECT" + value: "gcloud-devel" +} + +env_vars: { + key: "GOOGLE_APPLICATION_CREDENTIALS" + value: "keystore/73713_java_it_service_account" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "java_it_service_account" + } + } +} diff --git a/.kokoro/presubmit/java11.cfg b/.kokoro/presubmit/java11.cfg new file mode 100644 index 00000000..709f2b4c --- /dev/null +++ b/.kokoro/presubmit/java11.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java11" +} diff --git a/.kokoro/presubmit/java7.cfg b/.kokoro/presubmit/java7.cfg new file mode 100644 index 00000000..cb24f44e --- /dev/null +++ b/.kokoro/presubmit/java7.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java7" +} diff --git a/.kokoro/presubmit/java8-osx.cfg b/.kokoro/presubmit/java8-osx.cfg new file mode 100644 index 00000000..97b8e7f3 --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-monitoring/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 00000000..f1403d7f --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-monitoring/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg new file mode 100644 index 00000000..3b017fc8 --- /dev/null +++ b/.kokoro/presubmit/java8.cfg @@ -0,0 +1,7 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg new file mode 100644 index 00000000..9c73f339 --- /dev/null +++ b/.kokoro/presubmit/linkage-monitor.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/linkage-monitor.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg new file mode 100644 index 00000000..eda8d798 --- /dev/null +++ b/.kokoro/release/bump_snapshot.cfg @@ -0,0 +1,53 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Build logs will be here +action { + define_artifacts { + regex: "**/*sponge_log.xml" + } +} + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-monitoring/.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-monitoring/.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 new file mode 100755 index 00000000..70b35c37 --- /dev/null +++ b/.kokoro/release/bump_snapshot.sh @@ -0,0 +1,30 @@ +#!/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-monitoring \ + --package-name="monitoring" \ + --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 new file mode 100644 index 00000000..04579b26 --- /dev/null +++ b/.kokoro/release/common.cfg @@ -0,0 +1,49 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Download trampoline resources. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline" + +# Use the trampoline script to run in docker. +build_file: "java-monitoring/.kokoro/trampoline.sh" + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-keyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-passphrase" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "maven-gpg-pubkeyring" + } + } +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 70247 + keyname: "sonatype-credentials" + } + } +} diff --git a/.kokoro/release/common.sh b/.kokoro/release/common.sh new file mode 100755 index 00000000..6e3f6599 --- /dev/null +++ b/.kokoro/release/common.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# Get secrets from keystore and set and environment variables +setup_environment_secrets() { + export GPG_PASSPHRASE=$(cat ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-passphrase) + export GPG_TTY=$(tty) + export GPG_HOMEDIR=/gpg + mkdir $GPG_HOMEDIR + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-pubkeyring $GPG_HOMEDIR/pubring.gpg + mv ${KOKORO_KEYSTORE_DIR}/70247_maven-gpg-keyring $GPG_HOMEDIR/secring.gpg + export SONATYPE_USERNAME=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f1 -d'|') + export SONATYPE_PASSWORD=$(cat ${KOKORO_KEYSTORE_DIR}/70247_sonatype-credentials | cut -f2 -d'|') +} + +create_settings_xml_file() { + echo " + + + ossrh + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-staging + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + + sonatype-nexus-snapshots + ${SONATYPE_USERNAME} + ${SONATYPE_PASSWORD} + + +" > $1 +} \ No newline at end of file diff --git a/.kokoro/release/drop.cfg b/.kokoro/release/drop.cfg new file mode 100644 index 00000000..cb8564d9 --- /dev/null +++ b/.kokoro/release/drop.cfg @@ -0,0 +1,9 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/release/drop.sh" +} + +# Download staging properties file. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java/releases/java-monitoring" \ No newline at end of file diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 00000000..5c4551ef --- /dev/null +++ b/.kokoro/release/drop.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:drop -B \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg new file mode 100644 index 00000000..b5932f2d --- /dev/null +++ b/.kokoro/release/promote.cfg @@ -0,0 +1,10 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/release/promote.sh" +} + +# Download staging properties file. +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/java/releases/java-monitoring" + diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 00000000..1fa95fa5 --- /dev/null +++ b/.kokoro/release/promote.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh + +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg new file mode 100644 index 00000000..12b63678 --- /dev/null +++ b/.kokoro/release/publish_javadoc.cfg @@ -0,0 +1,19 @@ +# Format: //devtools/kokoro/config/proto/build.proto +env_vars: { + key: "STAGING_BUCKET" + value: "docs-staging" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/release/publish_javadoc.sh" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "docuploader_service_account" + } + } +} diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh new file mode 100755 index 00000000..1c14fcc7 --- /dev/null +++ b/.kokoro/release/publish_javadoc.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# Copyright 2019 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +if [[ -z "${CREDENTIALS}" ]]; then + CREDENTIALS=${KOKORO_KEYSTORE_DIR}/73713_docuploader_service_account +fi + +if [[ -z "${STAGING_BUCKET}" ]]; then + echo "Need to set STAGING_BUCKET environment variable" + exit 1 +fi + +# work from the git root directory +pushd $(dirname "$0")/../../ + +# install docuploader package +python3 -m pip install gcp-docuploader + +# compile all packages +mvn clean install -B -DskipTests=true + +NAME=monitoring +VERSION=$(grep ${NAME}: versions.txt | cut -d: -f3) + +# build the docs +mvn site -B + +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} + +popd diff --git a/.kokoro/release/snapshot.cfg b/.kokoro/release/snapshot.cfg new file mode 100644 index 00000000..00e9ef01 --- /dev/null +++ b/.kokoro/release/snapshot.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/release/snapshot.sh" +} \ No newline at end of file diff --git a/.kokoro/release/snapshot.sh b/.kokoro/release/snapshot.sh new file mode 100755 index 00000000..098168a7 --- /dev/null +++ b/.kokoro/release/snapshot.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +# ensure we're trying to push a snapshot (no-result returns non-zero exit code) +grep SNAPSHOT versions.txt + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean install deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg new file mode 100644 index 00000000..d92a905d --- /dev/null +++ b/.kokoro/release/stage.cfg @@ -0,0 +1,44 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-monitoring/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-monitoring/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-monitoring" + } +} + +# Fetch the token needed for reporting release status to GitHub +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "yoshi-automation-github-key" + } + } +} + +# Fetch magictoken to use with Magic Github Proxy +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "releasetool-magictoken" + } + } +} + +# Fetch api key to use with Magic Github Proxy +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "magic-github-proxy-api-key" + } + } +} diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh new file mode 100755 index 00000000..3c482cbc --- /dev/null +++ b/.kokoro/release/stage.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# Start the releasetool reporter +python3 -m pip install gcp-releasetool +python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script + +source $(dirname "$0")/common.sh +MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn clean install deploy -B \ + --settings ${MAVEN_SETTINGS_FILE} \ + -DskipTests=true \ + -DperformRelease=true \ + -Dgpg.executable=gpg \ + -Dgpg.passphrase=${GPG_PASSPHRASE} \ + -Dgpg.homedir=${GPG_HOMEDIR} + +if [[ -n "${AUTORELEASE_PR}" ]] +then + mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml +fi \ No newline at end of file diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh new file mode 100644 index 00000000..ba17ce01 --- /dev/null +++ b/.kokoro/trampoline.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -eo pipefail +# Always run the cleanup script, regardless of the success of bouncing into +# the container. +function cleanup() { + chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh + echo "cleanup"; +} +trap cleanup EXIT +python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" diff --git a/google-cloud-monitoring/.repo-metadata.json b/.repo-metadata.json similarity index 86% rename from google-cloud-monitoring/.repo-metadata.json rename to .repo-metadata.json index 3b25fda4..66318497 100644 --- a/google-cloud-monitoring/.repo-metadata.json +++ b/.repo-metadata.json @@ -6,8 +6,8 @@ "issue_tracker": "https://issuetracker.google.com/savedsearches/559785", "release_level": "ga", "language": "java", - "repo": "googleapis/google-cloud-java", - "repo_short": "google-cloud-java", + "repo": "googleapis/java-monitoring", + "repo_short": "java-monitoring", "distribution_name": "com.google.cloud:google-cloud-monitoring", "api_id": "monitoring.googleapis.com" } \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..6b2238bb --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,93 @@ +# 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 *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the +Project Steward(s) for *[PROJECT NAME]*. 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 the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..ebbb59e5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,28 @@ +# 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/). \ No newline at end of file diff --git a/LICENSE b/LICENSE index 4eedc011..d6456956 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,5 @@ -Apache License + + Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -178,7 +179,7 @@ Apache License 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 "{}" + boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a diff --git a/google-cloud-monitoring/README.md b/README.md similarity index 100% rename from google-cloud-monitoring/README.md rename to README.md diff --git a/codecov.yaml b/codecov.yaml new file mode 100644 index 00000000..5724ea94 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/google-cloud-monitoring-bom/pom.xml b/google-cloud-monitoring-bom/pom.xml new file mode 100644 index 00000000..423aa500 --- /dev/null +++ b/google-cloud-monitoring-bom/pom.xml @@ -0,0 +1,93 @@ + + + 4.0.0 + com.google.cloud + google-cloud-monitoring-bom + 1.98.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 0.2.1 + + + Google Cloud monitoring BOM + https://github.com/googleapis/java-monitoring + + BOM for Google Cloud Monitoring + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-monitoring.git + scm:git:git@github.com:googleapis/java-monitoring.git + https://github.com/googleapis/java-monitoring + + + + + sonatype-nexus-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + sonatype-nexus-staging + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + + + + + com.google.cloud + google-cloud-monitoring + 1.98.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-monitoring-v3 + 1.80.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-monitoring-v3 + 1.80.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + \ No newline at end of file diff --git a/google-cloud-monitoring/pom.xml b/google-cloud-monitoring/pom.xml index 2a30cf2e..8ac8d7d1 100644 --- a/google-cloud-monitoring/pom.xml +++ b/google-cloud-monitoring/pom.xml @@ -1,31 +1,67 @@ 4.0.0 + com.google.cloud google-cloud-monitoring 1.98.1-SNAPSHOT jar Google Cloud Monitoring - https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-monitoring - - Java idiomatic client for Stackdriver Monitoring. - + https://github.com/googleapis/java-monitoring + Java idiomatic client for Stackdriver Monitoring com.google.cloud - google-cloud-clients - 0.116.1-alpha-SNAPSHOT + google-cloud-monitoring-parent + 1.98.1-SNAPSHOT google-cloud-monitoring - ${project.groupId} - google-cloud-core-grpc + io.grpc + grpc-api + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + com.google.api.grpc proto-google-cloud-monitoring-v3 + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + @@ -33,11 +69,13 @@ junit test + com.google.api.grpc grpc-google-cloud-monitoring-v3 test + com.google.api gax-grpc @@ -46,29 +84,18 @@ - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - protected - true - none - true - - - ${project.javadoc.protobufBaseURL} - ../../../../../google-api-grpc/proto-google-cloud-monitoring-v3/target/site/apidocs/ - - - ${project.javadoc.protobufBaseURL} - ../../../../../google-api-grpc/grpc-google-cloud-monitoring-v3/target/site/apidocs/ - - - - - - - + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/grpc-google-cloud-monitoring-v3/pom.xml b/grpc-google-cloud-monitoring-v3/pom.xml index 8e4e6a87..aa37f25f 100644 --- a/grpc-google-cloud-monitoring-v3/pom.xml +++ b/grpc-google-cloud-monitoring-v3/pom.xml @@ -2,51 +2,59 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.google.api.grpc grpc-google-cloud-monitoring-v3 1.80.1-SNAPSHOT grpc-google-cloud-monitoring-v3 GRPC library for grpc-google-cloud-monitoring-v3 - com.google.api.grpc - google-api-grpc - 0.81.1-SNAPSHOT + com.google.cloud + google-cloud-monitoring-parent + 1.98.1-SNAPSHOT + + io.grpc + grpc-api + io.grpc grpc-stub - compile io.grpc grpc-protobuf - compile + + + com.google.protobuf + protobuf-java com.google.api.grpc proto-google-cloud-monitoring-v3 - compile + + + com.google.guava + guava + + + com.google.api.grpc + proto-google-common-protos - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.1.1 - - protected - true - none - true - - - ${project.javadoc.protobufBaseURL} - ../../../../proto-google-cloud-monitoring-v3/target/site/apidocs/ - - - - - - - + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyServiceGrpc.java b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyServiceGrpc.java index add58c1a..18707516 100644 --- a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyServiceGrpc.java +++ b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyServiceGrpc.java @@ -1,3 +1,19 @@ +/* + * 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.monitoring.v3; import static io.grpc.MethodDescriptor.generateFullMethodName; diff --git a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupServiceGrpc.java b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupServiceGrpc.java index bb3d54d7..1983f1b0 100644 --- a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupServiceGrpc.java +++ b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupServiceGrpc.java @@ -1,3 +1,19 @@ +/* + * 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.monitoring.v3; import static io.grpc.MethodDescriptor.generateFullMethodName; diff --git a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricServiceGrpc.java b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricServiceGrpc.java index 97218baf..ad1d41c6 100644 --- a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricServiceGrpc.java +++ b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricServiceGrpc.java @@ -1,3 +1,19 @@ +/* + * 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.monitoring.v3; import static io.grpc.MethodDescriptor.generateFullMethodName; diff --git a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelServiceGrpc.java b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelServiceGrpc.java index 41db3176..adb16cd2 100644 --- a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelServiceGrpc.java +++ b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelServiceGrpc.java @@ -1,3 +1,19 @@ +/* + * 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.monitoring.v3; import static io.grpc.MethodDescriptor.generateFullMethodName; diff --git a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckServiceGrpc.java b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckServiceGrpc.java index 94ccf209..bc44ede8 100644 --- a/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckServiceGrpc.java +++ b/grpc-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckServiceGrpc.java @@ -1,3 +1,19 @@ +/* + * 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.monitoring.v3; import static io.grpc.MethodDescriptor.generateFullMethodName; diff --git a/java.header b/java.header new file mode 100644 index 00000000..3a9b503a --- /dev/null +++ b/java.header @@ -0,0 +1,15 @@ +^/\*$ +^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)( All [rR]ights [rR]eserved\.)?$ +^ \*$ +^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$ +^ \* you may not use this file except in compliance with the License\.$ +^ \* You may obtain a copy of the License at$ +^ \*$ +^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$ +^ \*$ +^ \* Unless required by applicable law or agreed to in writing, software$ +^ \* distributed under the License is distributed on an "AS IS" BASIS,$ +^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$ +^ \* See the License for the specific language governing permissions and$ +^ \* limitations under the License\.$ +^ \*/$ diff --git a/license-checks.xml b/license-checks.xml new file mode 100644 index 00000000..6597fced --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..8c7e4589 --- /dev/null +++ b/pom.xml @@ -0,0 +1,256 @@ + + + 4.0.0 + com.google.cloud + google-cloud-monitoring-parent + pom + 1.98.1-SNAPSHOT + Google Cloud Monitoring Parent + https://github.com/googleapis/java-monitoring + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 0.2.1 + + + + + chingor + Jeff Ching + chingor@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-monitoring.git + scm:git:git@github.com:googleapis/java-monitoring.git + https://github.com/googleapis/java-monitoring + HEAD + + + https://github.com/googleapis/java-monitoring/issues + GitHub Issues + + + + sonatype-nexus-snapshots + https://oss.sonatype.org/content/repositories/snapshots + + + sonatype-nexus-staging + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + + + + + UTF-8 + UTF-8 + github + google-cloud-monitoring-parent + 1.91.1 + 1.8.1 + 1.17.0 + 1.49.0 + 1.24.0 + 3.10.0 + 4.12 + 28.1-android + 1.4.0 + 1.3.2 + 1.18 + + + + + + com.google.api.grpc + proto-google-cloud-monitoring-v3 + 1.80.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-monitoring-v3 + 1.80.1-SNAPSHOT + + + com.google.cloud + google-cloud-monitoring + 1.98.1-SNAPSHOT + + + + io.grpc + grpc-bom + ${grpc.version} + pom + import + + + com.google.api + gax-bom + ${gax.version} + pom + import + + + com.google.guava + guava-bom + ${guava.version} + pom + import + + + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + com.google.api + api-common + ${google.api-common.version} + + + com.google.api.grpc + proto-google-common-protos + ${google.common-protos.version} + + + org.threeten + threetenbp + ${threeten.version} + + + javax.annotation + javax.annotation-api + ${javax.annotations.version} + + + org.codehaus.mojo + animal-sniffer-annotations + ${animal-sniffer.version} + + + + junit + junit + ${junit.version} + test + + + com.google.api + gax-grpc + ${gax.version} + testlib + test + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + org.objenesis:objenesis + + + + + + + + proto-google-cloud-monitoring-v3 + grpc-google-cloud-monitoring-v3 + google-cloud-monitoring + google-cloud-monitoring-bom + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + + index + dependency-info + team + ci-management + issue-management + licenses + scm + dependency-management + distribution-management + summary + modules + + + + + true + ${site.installationModule} + jar + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.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/${google.api-common.version}/apidocs/ + + + + + + \ No newline at end of file diff --git a/proto-google-cloud-monitoring-v3/clirr-ignored-differences.xml b/proto-google-cloud-monitoring-v3/clirr-ignored-differences.xml new file mode 100644 index 00000000..214ac4f4 --- /dev/null +++ b/proto-google-cloud-monitoring-v3/clirr-ignored-differences.xml @@ -0,0 +1,9 @@ + + + + + 7012 + com/google/monitoring/v3/*OrBuilder + * get*(*) + + \ No newline at end of file diff --git a/proto-google-cloud-monitoring-v3/pom.xml b/proto-google-cloud-monitoring-v3/pom.xml index 91e96aed..864c4569 100644 --- a/proto-google-cloud-monitoring-v3/pom.xml +++ b/proto-google-cloud-monitoring-v3/pom.xml @@ -2,30 +2,32 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + com.google.api.grpc proto-google-cloud-monitoring-v3 1.80.1-SNAPSHOT proto-google-cloud-monitoring-v3 PROTO library for proto-google-cloud-monitoring-v3 - com.google.api.grpc - google-api-grpc - 0.81.1-SNAPSHOT + com.google.cloud + google-cloud-monitoring-parent + 1.98.1-SNAPSHOT com.google.protobuf protobuf-java - compile + + + com.google.api.grpc + proto-google-common-protos com.google.api api-common - compile - com.google.api.grpc - proto-google-common-protos - compile + com.google.guava + guava \ No newline at end of file diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Aggregation.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Aggregation.java index 4288728a..509aaf64 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Aggregation.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Aggregation.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AggregationOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AggregationOrBuilder.java index ab483545..7d93969c 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AggregationOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AggregationOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicy.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicy.java index 1a0609e5..358514af 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicy.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicy.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyConditionName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyConditionName.java index 164ca12e..d64981df 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyConditionName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyConditionName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyName.java index 6d1224e2..d0475c86 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyOrBuilder.java index 9f105d81..3b40dc0e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertPolicyOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertProto.java index cbadb4bd..5e402e33 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertServiceProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertServiceProto.java index 951e64e3..f468c79b 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertServiceProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/AlertServiceProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CommonProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CommonProto.java index bd54b5a4..1b0bbc07 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CommonProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CommonProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ComparisonType.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ComparisonType.java index 574e9667..81e3433e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ComparisonType.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ComparisonType.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateAlertPolicyRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateAlertPolicyRequest.java index d48bf4df..6f2d59db 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateAlertPolicyRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateAlertPolicyRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateAlertPolicyRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateAlertPolicyRequestOrBuilder.java index a617234d..464e823d 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateAlertPolicyRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateAlertPolicyRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateGroupRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateGroupRequest.java index bb1d6273..e3196416 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateGroupRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateGroupRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateGroupRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateGroupRequestOrBuilder.java index 6e67876f..b59c29db 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateGroupRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateGroupRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateMetricDescriptorRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateMetricDescriptorRequest.java index 2a779f28..a059a2da 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateMetricDescriptorRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateMetricDescriptorRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateMetricDescriptorRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateMetricDescriptorRequestOrBuilder.java index 52cdb3a0..94be0464 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateMetricDescriptorRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateMetricDescriptorRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateNotificationChannelRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateNotificationChannelRequest.java index 5d86bf10..c5e1ac93 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateNotificationChannelRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateNotificationChannelRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateNotificationChannelRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateNotificationChannelRequestOrBuilder.java index 573fc7cc..7fd1fdba 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateNotificationChannelRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateNotificationChannelRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesError.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesError.java index ed446079..fd92a664 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesError.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesError.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesErrorOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesErrorOrBuilder.java index 052d6c55..15aca424 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesErrorOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesErrorOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesRequest.java index 6ad96495..e13ab151 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesRequestOrBuilder.java index c58c334f..0e76ccff 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateTimeSeriesRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateUptimeCheckConfigRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateUptimeCheckConfigRequest.java index 874bccce..b652ee2d 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateUptimeCheckConfigRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateUptimeCheckConfigRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateUptimeCheckConfigRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateUptimeCheckConfigRequestOrBuilder.java index 3187e792..205c2911 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateUptimeCheckConfigRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/CreateUptimeCheckConfigRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteAlertPolicyRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteAlertPolicyRequest.java index f2e6310b..cc272ae5 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteAlertPolicyRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteAlertPolicyRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteAlertPolicyRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteAlertPolicyRequestOrBuilder.java index 1cfd3e2b..7fba3da3 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteAlertPolicyRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteAlertPolicyRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteGroupRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteGroupRequest.java index 7221d6d4..29bd5659 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteGroupRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteGroupRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteGroupRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteGroupRequestOrBuilder.java index e6a95300..85b6308e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteGroupRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteGroupRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteMetricDescriptorRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteMetricDescriptorRequest.java index 9c4c959f..fa0f58af 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteMetricDescriptorRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteMetricDescriptorRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteMetricDescriptorRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteMetricDescriptorRequestOrBuilder.java index 082d12d8..199f641b 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteMetricDescriptorRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteMetricDescriptorRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteNotificationChannelRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteNotificationChannelRequest.java index 3e37fe01..e10b2604 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteNotificationChannelRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteNotificationChannelRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteNotificationChannelRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteNotificationChannelRequestOrBuilder.java index fbe5f3b2..c44002ac 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteNotificationChannelRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteNotificationChannelRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteUptimeCheckConfigRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteUptimeCheckConfigRequest.java index 1879af61..56f63e27 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteUptimeCheckConfigRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteUptimeCheckConfigRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteUptimeCheckConfigRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteUptimeCheckConfigRequestOrBuilder.java index c02dd659..d85410fa 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteUptimeCheckConfigRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DeleteUptimeCheckConfigRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabels.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabels.java index b9f6ecb6..0e23a005 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabels.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabels.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/dropped_labels.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsOrBuilder.java index daff464d..15865008 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/dropped_labels.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsOuterClass.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsOuterClass.java index 09fb2585..5d12e132 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsOuterClass.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsOuterClass.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/dropped_labels.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsProto.java index ae2c9de3..64443d67 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/DroppedLabelsProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/dropped_labels.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetAlertPolicyRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetAlertPolicyRequest.java index 3eb32de2..470bca72 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetAlertPolicyRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetAlertPolicyRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetAlertPolicyRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetAlertPolicyRequestOrBuilder.java index 40aafdda..4372b5a8 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetAlertPolicyRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetAlertPolicyRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetGroupRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetGroupRequest.java index d9b628e7..a4549a3f 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetGroupRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetGroupRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetGroupRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetGroupRequestOrBuilder.java index 3d0b88cf..e1cc587e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetGroupRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetGroupRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMetricDescriptorRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMetricDescriptorRequest.java index c2036368..61f73291 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMetricDescriptorRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMetricDescriptorRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMetricDescriptorRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMetricDescriptorRequestOrBuilder.java index f7991822..f538644e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMetricDescriptorRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMetricDescriptorRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMonitoredResourceDescriptorRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMonitoredResourceDescriptorRequest.java index 2d0ea9e4..3f27ecff 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMonitoredResourceDescriptorRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMonitoredResourceDescriptorRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMonitoredResourceDescriptorRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMonitoredResourceDescriptorRequestOrBuilder.java index 649ba95f..954eb230 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMonitoredResourceDescriptorRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetMonitoredResourceDescriptorRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelDescriptorRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelDescriptorRequest.java index 12757428..dabeb663 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelDescriptorRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelDescriptorRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelDescriptorRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelDescriptorRequestOrBuilder.java index 371949f5..09006f4e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelDescriptorRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelDescriptorRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelRequest.java index b9050446..434343b7 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelRequestOrBuilder.java index 2a95cd17..d5c84cdd 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeRequest.java index 30dc7b29..17962ac0 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeRequestOrBuilder.java index f9b43ea1..e89075ac 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeResponse.java index 29d9b3af..028d2ee1 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeResponseOrBuilder.java index 23cb3f34..475c1401 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetNotificationChannelVerificationCodeResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetUptimeCheckConfigRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetUptimeCheckConfigRequest.java index 11e2d30f..dca0001c 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetUptimeCheckConfigRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetUptimeCheckConfigRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetUptimeCheckConfigRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetUptimeCheckConfigRequestOrBuilder.java index 7d1cd56d..2c3cb4b4 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetUptimeCheckConfigRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GetUptimeCheckConfigRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Group.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Group.java index 302acc17..2b4f8bd0 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Group.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Group.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupName.java index 63c1af19..a03b02eb 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupOrBuilder.java index 80381053..136824e2 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupProto.java index d5db9e1b..142ec714 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupResourceType.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupResourceType.java index a75e6720..46c178a1 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupResourceType.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupResourceType.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupServiceProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupServiceProto.java index fa84eda8..dfcb91b5 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupServiceProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/GroupServiceProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/InternalChecker.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/InternalChecker.java index 8c392264..3352e3f5 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/InternalChecker.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/InternalChecker.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/InternalCheckerOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/InternalCheckerOrBuilder.java index 95c617d0..343a1f9e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/InternalCheckerOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/InternalCheckerOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesRequest.java index 38922857..cfc3bf3f 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesRequestOrBuilder.java index ba730b15..685302af 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesResponse.java index 0ae97ff9..81ba0bd5 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesResponseOrBuilder.java index fea61126..a58b8d63 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListAlertPoliciesResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersRequest.java index 78f2b04e..fa5e0738 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersRequestOrBuilder.java index 3b84c2c5..d9d04808 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersResponse.java index 23713e82..6804d38e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersResponseOrBuilder.java index 72b04e92..338ff154 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupMembersResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsRequest.java index 75f76861..ed3e1120 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsRequestOrBuilder.java index feca5553..ff08c8a3 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsResponse.java index 4a456b4d..f76510b8 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsResponseOrBuilder.java index f2b691bd..e5c3751a 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListGroupsResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsRequest.java index d468cbc9..287ade91 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsRequestOrBuilder.java index 6a1ff9f9..f9246c7d 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsResponse.java index 63e8359c..61e6787c 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsResponseOrBuilder.java index d8f967bc..43c64298 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMetricDescriptorsResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsRequest.java index 3f627884..c8bb7d94 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsRequestOrBuilder.java index 0e0cd195..cde54e77 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsResponse.java index 1bb4e260..7545ee0f 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsResponseOrBuilder.java index 5291aba3..653f0125 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListMonitoredResourceDescriptorsResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsRequest.java index 98168057..7895b908 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsRequestOrBuilder.java index f530a8ca..bcfb567e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsResponse.java index b2fb7ac3..b8f9c04c 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsResponseOrBuilder.java index 93cc3656..099c5a7d 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelDescriptorsResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsRequest.java index c5da5aa6..ed6ecfa2 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsRequestOrBuilder.java index b1c0ab5b..ec5f57d3 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsResponse.java index 3d91f24a..ce185480 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsResponseOrBuilder.java index 6d9daa47..7be9360c 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListNotificationChannelsResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesRequest.java index 15b7cd36..aedb8df8 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesRequestOrBuilder.java index c24ac87f..a32d47e5 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesResponse.java index 73c26753..30f7590d 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesResponseOrBuilder.java index 0f2e9227..86db01f9 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListTimeSeriesResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsRequest.java index d1a5c91b..ef38b8f9 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsRequestOrBuilder.java index 3d5966c5..e059d3c6 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsResponse.java index 3a81dc1d..4b3b9829 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsResponseOrBuilder.java index 61143adb..7db0cd9a 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckConfigsResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsRequest.java index ae598f11..033c77c5 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsRequestOrBuilder.java index 01fb904e..671626bd 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsResponse.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsResponse.java index 265e432d..d6ac051b 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsResponse.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsResponse.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsResponseOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsResponseOrBuilder.java index 3aad2efc..a187e26f 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsResponseOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ListUptimeCheckIpsResponseOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricDescriptorName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricDescriptorName.java index 78253e9f..7867260c 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricDescriptorName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricDescriptorName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricProto.java index ff97b865..2c3f86ac 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricServiceProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricServiceProto.java index cbf47473..93e024b7 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricServiceProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MetricServiceProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MonitoredResourceDescriptorName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MonitoredResourceDescriptorName.java index dc7545d0..6fa2e89b 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MonitoredResourceDescriptorName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MonitoredResourceDescriptorName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecord.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecord.java index 60e25e2d..860d98ec 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecord.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecord.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/mutation_record.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecordOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecordOrBuilder.java index 3c17e33f..2eaa8cdf 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecordOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecordOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/mutation_record.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecordProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecordProto.java index 29c881df..0b310cbe 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecordProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/MutationRecordProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/mutation_record.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannel.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannel.java index 2e72200d..efa9e3c7 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannel.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannel.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptor.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptor.java index e5262d22..f7057422 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptor.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptor.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptorName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptorName.java index 32275c61..7d709c08 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptorName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptorName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptorOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptorOrBuilder.java index d63a0d84..e92542e3 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptorOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelDescriptorOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelName.java index db451ef9..2c3ccc5c 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelOrBuilder.java index 7b1489df..3ad5aa9b 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationChannelOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationProto.java index d4488fbf..faed5504 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationServiceProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationServiceProto.java index 2ce0c89f..87e40d63 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationServiceProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/NotificationServiceProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Point.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Point.java index 6f97a9f2..5ba1348f 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Point.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/Point.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/PointOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/PointOrBuilder.java index 84adba5c..3db2a4f5 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/PointOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/PointOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ProjectName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ProjectName.java index cf8c42a1..09db7c99 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ProjectName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ProjectName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SendNotificationChannelVerificationCodeRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SendNotificationChannelVerificationCodeRequest.java index 7ab156a9..2fba043f 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SendNotificationChannelVerificationCodeRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SendNotificationChannelVerificationCodeRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SendNotificationChannelVerificationCodeRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SendNotificationChannelVerificationCodeRequestOrBuilder.java index da2c9dc4..90322248 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SendNotificationChannelVerificationCodeRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SendNotificationChannelVerificationCodeRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ServiceTier.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ServiceTier.java index 38b1d6b0..0eb99e52 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ServiceTier.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/ServiceTier.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContext.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContext.java index 43ea91c2..fee95114 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContext.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContext.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/span_context.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContextOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContextOrBuilder.java index 8259ebd7..97140df1 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContextOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContextOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/span_context.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContextProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContextProto.java index 068418e9..353620e2 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContextProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/SpanContextProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/span_context.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeInterval.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeInterval.java index f724296d..9538ba18 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeInterval.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeInterval.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeIntervalOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeIntervalOrBuilder.java index c5cebad5..910b1e79 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeIntervalOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeIntervalOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeSeries.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeSeries.java index 5252b4eb..a0ea9f50 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeSeries.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeSeries.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeSeriesOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeSeriesOrBuilder.java index 44fe0d7c..3d8af760 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeSeriesOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TimeSeriesOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/metric.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TypedValue.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TypedValue.java index 08c5d27a..4ef6c475 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TypedValue.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TypedValue.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TypedValueOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TypedValueOrBuilder.java index 6281b296..e7d1a920 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TypedValueOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/TypedValueOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/common.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateAlertPolicyRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateAlertPolicyRequest.java index 5c0b5cfb..318932fd 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateAlertPolicyRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateAlertPolicyRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateAlertPolicyRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateAlertPolicyRequestOrBuilder.java index 4237aabe..cbcad5ca 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateAlertPolicyRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateAlertPolicyRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/alert_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateGroupRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateGroupRequest.java index d2c34898..a28208f8 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateGroupRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateGroupRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateGroupRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateGroupRequestOrBuilder.java index 031162bf..c4d02049 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateGroupRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateGroupRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/group_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateNotificationChannelRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateNotificationChannelRequest.java index 06d24e17..f8bae0cb 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateNotificationChannelRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateNotificationChannelRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateNotificationChannelRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateNotificationChannelRequestOrBuilder.java index 0e8bdf3b..1bc9cb68 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateNotificationChannelRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateNotificationChannelRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateUptimeCheckConfigRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateUptimeCheckConfigRequest.java index f3701f99..bd190d1d 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateUptimeCheckConfigRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateUptimeCheckConfigRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateUptimeCheckConfigRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateUptimeCheckConfigRequestOrBuilder.java index 5bfe7cb5..7d800eee 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateUptimeCheckConfigRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UpdateUptimeCheckConfigRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfig.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfig.java index 12f22f3f..a06b4e62 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfig.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfig.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfigName.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfigName.java index 726413ca..0dd39f0e 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfigName.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfigName.java @@ -1,15 +1,17 @@ /* - * Copyright 2018 Google LLC + * 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 + * Licensed under the Apache License, Version 2.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 + * https://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT 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. */ package com.google.monitoring.v3; diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfigOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfigOrBuilder.java index d77b5134..83555903 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfigOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckConfigOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckIp.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckIp.java index 8feb8ae5..3881cefb 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckIp.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckIp.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckIpOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckIpOrBuilder.java index f86b5dc7..4128ec26 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckIpOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckIpOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckRegion.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckRegion.java index e8eff43f..7455960a 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckRegion.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeCheckRegion.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeProto.java index 6578d37d..2f7a934b 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeServiceProto.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeServiceProto.java index 2c5580bf..1367d09b 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeServiceProto.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/UptimeServiceProto.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/uptime_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/VerifyNotificationChannelRequest.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/VerifyNotificationChannelRequest.java index 8019a6bb..4d694d54 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/VerifyNotificationChannelRequest.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/VerifyNotificationChannelRequest.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/VerifyNotificationChannelRequestOrBuilder.java b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/VerifyNotificationChannelRequestOrBuilder.java index 9766a876..9c1a2cc5 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/VerifyNotificationChannelRequestOrBuilder.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/com/google/monitoring/v3/VerifyNotificationChannelRequestOrBuilder.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/notification_service.proto diff --git a/proto-google-cloud-monitoring-v3/src/main/java/google/monitoring/v3/DroppedLabelsOuterClass.java b/proto-google-cloud-monitoring-v3/src/main/java/google/monitoring/v3/DroppedLabelsOuterClass.java index f4529da8..dbb35725 100644 --- a/proto-google-cloud-monitoring-v3/src/main/java/google/monitoring/v3/DroppedLabelsOuterClass.java +++ b/proto-google-cloud-monitoring-v3/src/main/java/google/monitoring/v3/DroppedLabelsOuterClass.java @@ -1,3 +1,18 @@ +/* + * 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. + */ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/monitoring/v3/dropped_labels.proto diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..99810470 --- /dev/null +++ b/renovate.json @@ -0,0 +1,27 @@ +{ + "extends": [ + "config:base" + ], + "ignoreDeps": [], + "packageRules": [ + { + "managers": ["maven"], + "packageNames": ["com.google.guava:guava*"], + "versionScheme": "docker" + }, + { + "packagePatterns": ["^io.grpc:grpc-"], + "groupName": "gRPC packages" + }, + { + "packagePatterns": ["^com.google.protobuf:protobuf-"], + "groupName": "Protobuf packages" + }, + { + "packagePatterns": ["^io.opencensus:opencensus-"], + "groupName": "OpenCensus packages" + } + ], + "semanticCommits": true, + "semanticCommitType": "deps" +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java b/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java new file mode 100644 index 00000000..6a48c01f --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClient.java @@ -0,0 +1,823 @@ +/* + * 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.monitoring.v3; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.monitoring.v3.stub.AlertPolicyServiceStub; +import com.google.cloud.monitoring.v3.stub.AlertPolicyServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.monitoring.v3.AlertPolicy; +import com.google.monitoring.v3.AlertPolicyName; +import com.google.monitoring.v3.CreateAlertPolicyRequest; +import com.google.monitoring.v3.DeleteAlertPolicyRequest; +import com.google.monitoring.v3.GetAlertPolicyRequest; +import com.google.monitoring.v3.ListAlertPoliciesRequest; +import com.google.monitoring.v3.ListAlertPoliciesResponse; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.UpdateAlertPolicyRequest; +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 SERVICE +/** + * Service Description: The AlertPolicyService API is used to manage (list, create, delete, edit) + * alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions + * under which some aspect of your system is considered to be "unhealthy" and the ways to notify + * people or services about this state. In addition to using this API, alert policies can also be + * managed through [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), which can be + * reached by clicking the "Monitoring" tab in [Cloud Console](https://console.cloud.google.com/). + * + *

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: + * + *

+ * 
+ * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+ *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+ *   AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
+ * }
+ * 
+ * 
+ * + *

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

To customize credentials: + * + *

+ * 
+ * AlertPolicyServiceSettings alertPolicyServiceSettings =
+ *     AlertPolicyServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * AlertPolicyServiceClient alertPolicyServiceClient =
+ *     AlertPolicyServiceClient.create(alertPolicyServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * AlertPolicyServiceSettings alertPolicyServiceSettings =
+ *     AlertPolicyServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * AlertPolicyServiceClient alertPolicyServiceClient =
+ *     AlertPolicyServiceClient.create(alertPolicyServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class AlertPolicyServiceClient implements BackgroundResource { + private final AlertPolicyServiceSettings settings; + private final AlertPolicyServiceStub stub; + + /** Constructs an instance of AlertPolicyServiceClient with default settings. */ + public static final AlertPolicyServiceClient create() throws IOException { + return create(AlertPolicyServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of AlertPolicyServiceClient, 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 AlertPolicyServiceClient create(AlertPolicyServiceSettings settings) + throws IOException { + return new AlertPolicyServiceClient(settings); + } + + /** + * Constructs an instance of AlertPolicyServiceClient, using the given stub for making calls. This + * is for advanced usage - prefer to use AlertPolicyServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final AlertPolicyServiceClient create(AlertPolicyServiceStub stub) { + return new AlertPolicyServiceClient(stub); + } + + /** + * Constructs an instance of AlertPolicyServiceClient, 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 AlertPolicyServiceClient(AlertPolicyServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((AlertPolicyServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected AlertPolicyServiceClient(AlertPolicyServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final AlertPolicyServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AlertPolicyServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing alerting policies for the project. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (AlertPolicy element : alertPolicyServiceClient.listAlertPolicies(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project whose alert policies are to be listed. The format is + *

projects/[PROJECT_ID] + *

Note that this field names the parent container in which the alerting policies to be + * listed are stored. To retrieve a single alerting policy by name, use the + * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, + * instead. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListAlertPoliciesPagedResponse listAlertPolicies(ProjectName name) { + ListAlertPoliciesRequest request = + ListAlertPoliciesRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return listAlertPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing alerting policies for the project. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (AlertPolicy element : alertPolicyServiceClient.listAlertPolicies(name.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project whose alert policies are to be listed. The format is + *

projects/[PROJECT_ID] + *

Note that this field names the parent container in which the alerting policies to be + * listed are stored. To retrieve a single alerting policy by name, use the + * [GetAlertPolicy][google.monitoring.v3.AlertPolicyService.GetAlertPolicy] operation, + * instead. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListAlertPoliciesPagedResponse listAlertPolicies(String name) { + ListAlertPoliciesRequest request = ListAlertPoliciesRequest.newBuilder().setName(name).build(); + return listAlertPolicies(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing alerting policies for the project. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListAlertPoliciesRequest request = ListAlertPoliciesRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   for (AlertPolicy element : alertPolicyServiceClient.listAlertPolicies(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 ListAlertPoliciesPagedResponse listAlertPolicies(ListAlertPoliciesRequest request) { + return listAlertPoliciesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing alerting policies for the project. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListAlertPoliciesRequest request = ListAlertPoliciesRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ListAlertPoliciesPagedResponse> future = alertPolicyServiceClient.listAlertPoliciesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (AlertPolicy element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listAlertPoliciesPagedCallable() { + return stub.listAlertPoliciesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing alerting policies for the project. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListAlertPoliciesRequest request = ListAlertPoliciesRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   while (true) {
+   *     ListAlertPoliciesResponse response = alertPolicyServiceClient.listAlertPoliciesCallable().call(request);
+   *     for (AlertPolicy element : response.getAlertPoliciesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listAlertPoliciesCallable() { + return stub.listAlertPoliciesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+   *   AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
+   * }
+   * 
+ * + * @param name The alerting policy to retrieve. The format is + *

projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AlertPolicy getAlertPolicy(AlertPolicyName name) { + + GetAlertPolicyRequest request = + GetAlertPolicyRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getAlertPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+   *   AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name.toString());
+   * }
+   * 
+ * + * @param name The alerting policy to retrieve. The format is + *

projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AlertPolicy getAlertPolicy(String name) { + + GetAlertPolicyRequest request = GetAlertPolicyRequest.newBuilder().setName(name).build(); + return getAlertPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+   *   GetAlertPolicyRequest request = GetAlertPolicyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(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 AlertPolicy getAlertPolicy(GetAlertPolicyRequest request) { + return getAlertPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+   *   GetAlertPolicyRequest request = GetAlertPolicyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<AlertPolicy> future = alertPolicyServiceClient.getAlertPolicyCallable().futureCall(request);
+   *   // Do something
+   *   AlertPolicy response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getAlertPolicyCallable() { + return stub.getAlertPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
+   *   AlertPolicy response = alertPolicyServiceClient.createAlertPolicy(name, alertPolicy);
+   * }
+   * 
+ * + * @param name The project in which to create the alerting policy. The format is + * `projects/[PROJECT_ID]`. + *

Note that this field names the parent container in which the alerting policy will be + * written, not the name of the created policy. The alerting policy that is returned will have + * a name that contains a normalized representation of this name as a prefix but adds a suffix + * of the form `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. + * @param alertPolicy The requested alerting policy. You should omit the `name` field in this + * policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] + * value. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AlertPolicy createAlertPolicy(ProjectName name, AlertPolicy alertPolicy) { + + CreateAlertPolicyRequest request = + CreateAlertPolicyRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setAlertPolicy(alertPolicy) + .build(); + return createAlertPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
+   *   AlertPolicy response = alertPolicyServiceClient.createAlertPolicy(name.toString(), alertPolicy);
+   * }
+   * 
+ * + * @param name The project in which to create the alerting policy. The format is + * `projects/[PROJECT_ID]`. + *

Note that this field names the parent container in which the alerting policy will be + * written, not the name of the created policy. The alerting policy that is returned will have + * a name that contains a normalized representation of this name as a prefix but adds a suffix + * of the form `/alertPolicies/[POLICY_ID]`, identifying the policy in the container. + * @param alertPolicy The requested alerting policy. You should omit the `name` field in this + * policy. The name will be returned in the new policy, including a new [ALERT_POLICY_ID] + * value. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AlertPolicy createAlertPolicy(String name, AlertPolicy alertPolicy) { + + CreateAlertPolicyRequest request = + CreateAlertPolicyRequest.newBuilder().setName(name).setAlertPolicy(alertPolicy).build(); + return createAlertPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
+   *   CreateAlertPolicyRequest request = CreateAlertPolicyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setAlertPolicy(alertPolicy)
+   *     .build();
+   *   AlertPolicy response = alertPolicyServiceClient.createAlertPolicy(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 AlertPolicy createAlertPolicy(CreateAlertPolicyRequest request) { + return createAlertPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
+   *   CreateAlertPolicyRequest request = CreateAlertPolicyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setAlertPolicy(alertPolicy)
+   *     .build();
+   *   ApiFuture<AlertPolicy> future = alertPolicyServiceClient.createAlertPolicyCallable().futureCall(request);
+   *   // Do something
+   *   AlertPolicy response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createAlertPolicyCallable() { + return stub.createAlertPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+   *   alertPolicyServiceClient.deleteAlertPolicy(name);
+   * }
+   * 
+ * + * @param name The alerting policy to delete. The format is: + *

projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] + *

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteAlertPolicy(AlertPolicyName name) { + + DeleteAlertPolicyRequest request = + DeleteAlertPolicyRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteAlertPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+   *   alertPolicyServiceClient.deleteAlertPolicy(name.toString());
+   * }
+   * 
+ * + * @param name The alerting policy to delete. The format is: + *

projects/[PROJECT_ID]/alertPolicies/[ALERT_POLICY_ID] + *

For more information, see [AlertPolicy][google.monitoring.v3.AlertPolicy]. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteAlertPolicy(String name) { + + DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder().setName(name).build(); + deleteAlertPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+   *   DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   alertPolicyServiceClient.deleteAlertPolicy(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 deleteAlertPolicy(DeleteAlertPolicyRequest request) { + deleteAlertPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+   *   DeleteAlertPolicyRequest request = DeleteAlertPolicyRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = alertPolicyServiceClient.deleteAlertPolicyCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteAlertPolicyCallable() { + return stub.deleteAlertPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an alerting policy. You can either replace the entire policy with a new one or replace + * only certain fields in the current alerting policy by specifying the fields to be updated via + * `updateMask`. Returns the updated alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
+   *   AlertPolicy response = alertPolicyServiceClient.updateAlertPolicy(updateMask, alertPolicy);
+   * }
+   * 
+ * + * @param updateMask Optional. A list of alerting policy field names. If this field is not empty, + * each listed field in the existing alerting policy is set to the value of the corresponding + * field in the supplied policy (`alert_policy`), or to the field's default value if the field + * is not in the supplied alerting policy. Fields not listed retain their previous value. + *

Examples of valid field masks include `display_name`, `documentation`, + * `documentation.content`, `documentation.mime_type`, `user_labels`, `user_label.nameofkey`, + * `enabled`, `conditions`, `combiner`, etc. + *

If this field is empty, then the supplied alerting policy replaces the existing policy. + * It is the same as deleting the existing policy and adding the supplied policy, except for + * the following: + *

+ The new policy will have the same `[ALERT_POLICY_ID]` as the former policy. This gives + * you continuity with the former policy in your notifications and incidents. + Conditions in + * the new policy will keep their former `[CONDITION_ID]` if the supplied condition includes + * the `name` field with that `[CONDITION_ID]`. If the supplied condition omits the `name` + * field, then a new `[CONDITION_ID]` is created. + * @param alertPolicy Required. The updated alerting policy or the updated values for the fields + * listed in `update_mask`. If `update_mask` is not empty, any fields in this policy that are + * not in `update_mask` are ignored. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final AlertPolicy updateAlertPolicy(FieldMask updateMask, AlertPolicy alertPolicy) { + + UpdateAlertPolicyRequest request = + UpdateAlertPolicyRequest.newBuilder() + .setUpdateMask(updateMask) + .setAlertPolicy(alertPolicy) + .build(); + return updateAlertPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an alerting policy. You can either replace the entire policy with a new one or replace + * only certain fields in the current alerting policy by specifying the fields to be updated via + * `updateMask`. Returns the updated alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
+   *   UpdateAlertPolicyRequest request = UpdateAlertPolicyRequest.newBuilder()
+   *     .setAlertPolicy(alertPolicy)
+   *     .build();
+   *   AlertPolicy response = alertPolicyServiceClient.updateAlertPolicy(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 AlertPolicy updateAlertPolicy(UpdateAlertPolicyRequest request) { + return updateAlertPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an alerting policy. You can either replace the entire policy with a new one or replace + * only certain fields in the current alerting policy by specifying the fields to be updated via + * `updateMask`. Returns the updated alerting policy. + * + *

Sample code: + * + *


+   * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+   *   AlertPolicy alertPolicy = AlertPolicy.newBuilder().build();
+   *   UpdateAlertPolicyRequest request = UpdateAlertPolicyRequest.newBuilder()
+   *     .setAlertPolicy(alertPolicy)
+   *     .build();
+   *   ApiFuture<AlertPolicy> future = alertPolicyServiceClient.updateAlertPolicyCallable().futureCall(request);
+   *   // Do something
+   *   AlertPolicy response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable updateAlertPolicyCallable() { + return stub.updateAlertPolicyCallable(); + } + + @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 ListAlertPoliciesPagedResponse + extends AbstractPagedListResponse< + ListAlertPoliciesRequest, + ListAlertPoliciesResponse, + AlertPolicy, + ListAlertPoliciesPage, + ListAlertPoliciesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListAlertPoliciesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListAlertPoliciesPagedResponse apply(ListAlertPoliciesPage input) { + return new ListAlertPoliciesPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListAlertPoliciesPagedResponse(ListAlertPoliciesPage page) { + super(page, ListAlertPoliciesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListAlertPoliciesPage + extends AbstractPage< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, AlertPolicy, ListAlertPoliciesPage> { + + private ListAlertPoliciesPage( + PageContext context, + ListAlertPoliciesResponse response) { + super(context, response); + } + + private static ListAlertPoliciesPage createEmptyPage() { + return new ListAlertPoliciesPage(null, null); + } + + @Override + protected ListAlertPoliciesPage createPage( + PageContext context, + ListAlertPoliciesResponse response) { + return new ListAlertPoliciesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListAlertPoliciesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListAlertPoliciesRequest, + ListAlertPoliciesResponse, + AlertPolicy, + ListAlertPoliciesPage, + ListAlertPoliciesFixedSizeCollection> { + + private ListAlertPoliciesFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListAlertPoliciesFixedSizeCollection createEmptyCollection() { + return new ListAlertPoliciesFixedSizeCollection(null, 0); + } + + @Override + protected ListAlertPoliciesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListAlertPoliciesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceSettings.java b/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceSettings.java new file mode 100644 index 00000000..a324ae58 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/AlertPolicyServiceSettings.java @@ -0,0 +1,231 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.AlertPolicyServiceClient.ListAlertPoliciesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.monitoring.v3.stub.AlertPolicyServiceStubSettings; +import com.google.monitoring.v3.AlertPolicy; +import com.google.monitoring.v3.CreateAlertPolicyRequest; +import com.google.monitoring.v3.DeleteAlertPolicyRequest; +import com.google.monitoring.v3.GetAlertPolicyRequest; +import com.google.monitoring.v3.ListAlertPoliciesRequest; +import com.google.monitoring.v3.ListAlertPoliciesResponse; +import com.google.monitoring.v3.UpdateAlertPolicyRequest; +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 AlertPolicyServiceClient}. + * + *

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

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

+ * 
+ * AlertPolicyServiceSettings.Builder alertPolicyServiceSettingsBuilder =
+ *     AlertPolicyServiceSettings.newBuilder();
+ * alertPolicyServiceSettingsBuilder.getAlertPolicySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AlertPolicyServiceSettings alertPolicyServiceSettings = alertPolicyServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class AlertPolicyServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listAlertPolicies. */ + public PagedCallSettings< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse> + listAlertPoliciesSettings() { + return ((AlertPolicyServiceStubSettings) getStubSettings()).listAlertPoliciesSettings(); + } + + /** Returns the object with the settings used for calls to getAlertPolicy. */ + public UnaryCallSettings getAlertPolicySettings() { + return ((AlertPolicyServiceStubSettings) getStubSettings()).getAlertPolicySettings(); + } + + /** Returns the object with the settings used for calls to createAlertPolicy. */ + public UnaryCallSettings createAlertPolicySettings() { + return ((AlertPolicyServiceStubSettings) getStubSettings()).createAlertPolicySettings(); + } + + /** Returns the object with the settings used for calls to deleteAlertPolicy. */ + public UnaryCallSettings deleteAlertPolicySettings() { + return ((AlertPolicyServiceStubSettings) getStubSettings()).deleteAlertPolicySettings(); + } + + /** Returns the object with the settings used for calls to updateAlertPolicy. */ + public UnaryCallSettings updateAlertPolicySettings() { + return ((AlertPolicyServiceStubSettings) getStubSettings()).updateAlertPolicySettings(); + } + + public static final AlertPolicyServiceSettings create(AlertPolicyServiceStubSettings stub) + throws IOException { + return new AlertPolicyServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return AlertPolicyServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return AlertPolicyServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return AlertPolicyServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return AlertPolicyServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return AlertPolicyServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return AlertPolicyServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AlertPolicyServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected AlertPolicyServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for AlertPolicyServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(AlertPolicyServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(AlertPolicyServiceStubSettings.newBuilder()); + } + + protected Builder(AlertPolicyServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(AlertPolicyServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public AlertPolicyServiceStubSettings.Builder getStubSettingsBuilder() { + return ((AlertPolicyServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to listAlertPolicies. */ + public PagedCallSettings.Builder< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse> + listAlertPoliciesSettings() { + return getStubSettingsBuilder().listAlertPoliciesSettings(); + } + + /** Returns the builder for the settings used for calls to getAlertPolicy. */ + public UnaryCallSettings.Builder getAlertPolicySettings() { + return getStubSettingsBuilder().getAlertPolicySettings(); + } + + /** Returns the builder for the settings used for calls to createAlertPolicy. */ + public UnaryCallSettings.Builder + createAlertPolicySettings() { + return getStubSettingsBuilder().createAlertPolicySettings(); + } + + /** Returns the builder for the settings used for calls to deleteAlertPolicy. */ + public UnaryCallSettings.Builder deleteAlertPolicySettings() { + return getStubSettingsBuilder().deleteAlertPolicySettings(); + } + + /** Returns the builder for the settings used for calls to updateAlertPolicy. */ + public UnaryCallSettings.Builder + updateAlertPolicySettings() { + return getStubSettingsBuilder().updateAlertPolicySettings(); + } + + @Override + public AlertPolicyServiceSettings build() throws IOException { + return new AlertPolicyServiceSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java b/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java new file mode 100644 index 00000000..de0afe01 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/GroupServiceClient.java @@ -0,0 +1,987 @@ +/* + * 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.monitoring.v3; + +import com.google.api.MonitoredResource; +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.monitoring.v3.stub.GroupServiceStub; +import com.google.cloud.monitoring.v3.stub.GroupServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.monitoring.v3.CreateGroupRequest; +import com.google.monitoring.v3.DeleteGroupRequest; +import com.google.monitoring.v3.GetGroupRequest; +import com.google.monitoring.v3.Group; +import com.google.monitoring.v3.GroupName; +import com.google.monitoring.v3.ListGroupMembersRequest; +import com.google.monitoring.v3.ListGroupMembersResponse; +import com.google.monitoring.v3.ListGroupsRequest; +import com.google.monitoring.v3.ListGroupsResponse; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.UpdateGroupRequest; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: The Group API lets you inspect and manage your + * [groups](#google.monitoring.v3.Group). + * + *

A group is a named filter that is used to identify a collection of monitored resources. Groups + * are typically used to mirror the physical and/or logical topology of the environment. Because + * group membership is computed dynamically, monitored resources that are started in the future are + * automatically placed in matching groups. By using a group to name monitored resources in, for + * example, an alert policy, the target of that alert policy is updated automatically as monitored + * resources are added and removed from the infrastructure. + * + *

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: + * + *

+ * 
+ * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+ *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+ *   Group response = groupServiceClient.getGroup(name);
+ * }
+ * 
+ * 
+ * + *

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

To customize credentials: + * + *

+ * 
+ * GroupServiceSettings groupServiceSettings =
+ *     GroupServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * GroupServiceClient groupServiceClient =
+ *     GroupServiceClient.create(groupServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * GroupServiceSettings groupServiceSettings =
+ *     GroupServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * GroupServiceClient groupServiceClient =
+ *     GroupServiceClient.create(groupServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class GroupServiceClient implements BackgroundResource { + private final GroupServiceSettings settings; + private final GroupServiceStub stub; + + /** Constructs an instance of GroupServiceClient with default settings. */ + public static final GroupServiceClient create() throws IOException { + return create(GroupServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of GroupServiceClient, 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 GroupServiceClient create(GroupServiceSettings settings) throws IOException { + return new GroupServiceClient(settings); + } + + /** + * Constructs an instance of GroupServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer to use GroupServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final GroupServiceClient create(GroupServiceStub stub) { + return new GroupServiceClient(stub); + } + + /** + * Constructs an instance of GroupServiceClient, 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 GroupServiceClient(GroupServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((GroupServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected GroupServiceClient(GroupServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final GroupServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GroupServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing groups. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (Group element : groupServiceClient.listGroups(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project whose groups are to be listed. The format is + * `"projects/{project_id_or_number}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGroupsPagedResponse listGroups(ProjectName name) { + ListGroupsRequest request = + ListGroupsRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return listGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing groups. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (Group element : groupServiceClient.listGroups(name.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project whose groups are to be listed. The format is + * `"projects/{project_id_or_number}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGroupsPagedResponse listGroups(String name) { + ListGroupsRequest request = ListGroupsRequest.newBuilder().setName(name).build(); + return listGroups(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing groups. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListGroupsRequest request = ListGroupsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   for (Group element : groupServiceClient.listGroups(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 ListGroupsPagedResponse listGroups(ListGroupsRequest request) { + return listGroupsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing groups. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListGroupsRequest request = ListGroupsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ListGroupsPagedResponse> future = groupServiceClient.listGroupsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Group element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable listGroupsPagedCallable() { + return stub.listGroupsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing groups. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListGroupsRequest request = ListGroupsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   while (true) {
+   *     ListGroupsResponse response = groupServiceClient.listGroupsCallable().call(request);
+   *     for (Group element : response.getGroupList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable listGroupsCallable() { + return stub.listGroupsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   Group response = groupServiceClient.getGroup(name);
+   * }
+   * 
+ * + * @param name The group to retrieve. The format is + * `"projects/{project_id_or_number}/groups/{group_id}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Group getGroup(GroupName name) { + + GetGroupRequest request = + GetGroupRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return getGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   Group response = groupServiceClient.getGroup(name.toString());
+   * }
+   * 
+ * + * @param name The group to retrieve. The format is + * `"projects/{project_id_or_number}/groups/{group_id}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Group getGroup(String name) { + + GetGroupRequest request = GetGroupRequest.newBuilder().setName(name).build(); + return getGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   GetGroupRequest request = GetGroupRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   Group response = groupServiceClient.getGroup(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 Group getGroup(GetGroupRequest request) { + return getGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   GetGroupRequest request = GetGroupRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Group> future = groupServiceClient.getGroupCallable().futureCall(request);
+   *   // Do something
+   *   Group response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getGroupCallable() { + return stub.getGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   Group group = Group.newBuilder().build();
+   *   Group response = groupServiceClient.createGroup(name, group);
+   * }
+   * 
+ * + * @param name The project in which to create the group. The format is + * `"projects/{project_id_or_number}"`. + * @param group A group definition. It is an error to define the `name` field because the system + * assigns the name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Group createGroup(ProjectName name, Group group) { + + CreateGroupRequest request = + CreateGroupRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setGroup(group) + .build(); + return createGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   Group group = Group.newBuilder().build();
+   *   Group response = groupServiceClient.createGroup(name.toString(), group);
+   * }
+   * 
+ * + * @param name The project in which to create the group. The format is + * `"projects/{project_id_or_number}"`. + * @param group A group definition. It is an error to define the `name` field because the system + * assigns the name. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Group createGroup(String name, Group group) { + + CreateGroupRequest request = + CreateGroupRequest.newBuilder().setName(name).setGroup(group).build(); + return createGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   Group group = Group.newBuilder().build();
+   *   CreateGroupRequest request = CreateGroupRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setGroup(group)
+   *     .build();
+   *   Group response = groupServiceClient.createGroup(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 Group createGroup(CreateGroupRequest request) { + return createGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   Group group = Group.newBuilder().build();
+   *   CreateGroupRequest request = CreateGroupRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setGroup(group)
+   *     .build();
+   *   ApiFuture<Group> future = groupServiceClient.createGroupCallable().futureCall(request);
+   *   // Do something
+   *   Group response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createGroupCallable() { + return stub.createGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an existing group. You can change any group attributes except `name`. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   Group group = Group.newBuilder().build();
+   *   Group response = groupServiceClient.updateGroup(group);
+   * }
+   * 
+ * + * @param group The new definition of the group. All fields of the existing group, excepting + * `name`, are replaced with the corresponding fields of this group. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Group updateGroup(Group group) { + + UpdateGroupRequest request = UpdateGroupRequest.newBuilder().setGroup(group).build(); + return updateGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an existing group. You can change any group attributes except `name`. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   Group group = Group.newBuilder().build();
+   *   UpdateGroupRequest request = UpdateGroupRequest.newBuilder()
+   *     .setGroup(group)
+   *     .build();
+   *   Group response = groupServiceClient.updateGroup(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 Group updateGroup(UpdateGroupRequest request) { + return updateGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an existing group. You can change any group attributes except `name`. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   Group group = Group.newBuilder().build();
+   *   UpdateGroupRequest request = UpdateGroupRequest.newBuilder()
+   *     .setGroup(group)
+   *     .build();
+   *   ApiFuture<Group> future = groupServiceClient.updateGroupCallable().futureCall(request);
+   *   // Do something
+   *   Group response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable updateGroupCallable() { + return stub.updateGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an existing group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   groupServiceClient.deleteGroup(name);
+   * }
+   * 
+ * + * @param name The group to delete. The format is + * `"projects/{project_id_or_number}/groups/{group_id}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteGroup(GroupName name) { + + DeleteGroupRequest request = + DeleteGroupRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + deleteGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an existing group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   groupServiceClient.deleteGroup(name.toString());
+   * }
+   * 
+ * + * @param name The group to delete. The format is + * `"projects/{project_id_or_number}/groups/{group_id}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteGroup(String name) { + + DeleteGroupRequest request = DeleteGroupRequest.newBuilder().setName(name).build(); + deleteGroup(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an existing group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   DeleteGroupRequest request = DeleteGroupRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   groupServiceClient.deleteGroup(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 deleteGroup(DeleteGroupRequest request) { + deleteGroupCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an existing group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   DeleteGroupRequest request = DeleteGroupRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = groupServiceClient.deleteGroupCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteGroupCallable() { + return stub.deleteGroupCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the monitored resources that are members of a group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   for (MonitoredResource element : groupServiceClient.listGroupMembers(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The group whose members are listed. The format is + * `"projects/{project_id_or_number}/groups/{group_id}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGroupMembersPagedResponse listGroupMembers(GroupName name) { + ListGroupMembersRequest request = + ListGroupMembersRequest.newBuilder().setName(name == null ? null : name.toString()).build(); + return listGroupMembers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the monitored resources that are members of a group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   for (MonitoredResource element : groupServiceClient.listGroupMembers(name.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The group whose members are listed. The format is + * `"projects/{project_id_or_number}/groups/{group_id}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListGroupMembersPagedResponse listGroupMembers(String name) { + ListGroupMembersRequest request = ListGroupMembersRequest.newBuilder().setName(name).build(); + return listGroupMembers(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the monitored resources that are members of a group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   ListGroupMembersRequest request = ListGroupMembersRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   for (MonitoredResource element : groupServiceClient.listGroupMembers(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 ListGroupMembersPagedResponse listGroupMembers(ListGroupMembersRequest request) { + return listGroupMembersPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the monitored resources that are members of a group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   ListGroupMembersRequest request = ListGroupMembersRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ListGroupMembersPagedResponse> future = groupServiceClient.listGroupMembersPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (MonitoredResource element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listGroupMembersPagedCallable() { + return stub.listGroupMembersPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the monitored resources that are members of a group. + * + *

Sample code: + * + *


+   * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+   *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+   *   ListGroupMembersRequest request = ListGroupMembersRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   while (true) {
+   *     ListGroupMembersResponse response = groupServiceClient.listGroupMembersCallable().call(request);
+   *     for (MonitoredResource element : response.getMembersList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listGroupMembersCallable() { + return stub.listGroupMembersCallable(); + } + + @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 ListGroupsPagedResponse + extends AbstractPagedListResponse< + ListGroupsRequest, + ListGroupsResponse, + Group, + ListGroupsPage, + ListGroupsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListGroupsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListGroupsPagedResponse apply(ListGroupsPage input) { + return new ListGroupsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListGroupsPagedResponse(ListGroupsPage page) { + super(page, ListGroupsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListGroupsPage + extends AbstractPage { + + private ListGroupsPage( + PageContext context, + ListGroupsResponse response) { + super(context, response); + } + + private static ListGroupsPage createEmptyPage() { + return new ListGroupsPage(null, null); + } + + @Override + protected ListGroupsPage createPage( + PageContext context, + ListGroupsResponse response) { + return new ListGroupsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListGroupsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListGroupsRequest, + ListGroupsResponse, + Group, + ListGroupsPage, + ListGroupsFixedSizeCollection> { + + private ListGroupsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListGroupsFixedSizeCollection createEmptyCollection() { + return new ListGroupsFixedSizeCollection(null, 0); + } + + @Override + protected ListGroupsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListGroupsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListGroupMembersPagedResponse + extends AbstractPagedListResponse< + ListGroupMembersRequest, + ListGroupMembersResponse, + MonitoredResource, + ListGroupMembersPage, + ListGroupMembersFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListGroupMembersPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListGroupMembersPagedResponse apply(ListGroupMembersPage input) { + return new ListGroupMembersPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListGroupMembersPagedResponse(ListGroupMembersPage page) { + super(page, ListGroupMembersFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListGroupMembersPage + extends AbstractPage< + ListGroupMembersRequest, + ListGroupMembersResponse, + MonitoredResource, + ListGroupMembersPage> { + + private ListGroupMembersPage( + PageContext context, + ListGroupMembersResponse response) { + super(context, response); + } + + private static ListGroupMembersPage createEmptyPage() { + return new ListGroupMembersPage(null, null); + } + + @Override + protected ListGroupMembersPage createPage( + PageContext context, + ListGroupMembersResponse response) { + return new ListGroupMembersPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListGroupMembersFixedSizeCollection + extends AbstractFixedSizeCollection< + ListGroupMembersRequest, + ListGroupMembersResponse, + MonitoredResource, + ListGroupMembersPage, + ListGroupMembersFixedSizeCollection> { + + private ListGroupMembersFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListGroupMembersFixedSizeCollection createEmptyCollection() { + return new ListGroupMembersFixedSizeCollection(null, 0); + } + + @Override + protected ListGroupMembersFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListGroupMembersFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/GroupServiceSettings.java b/src/main/java/com/google/cloud/monitoring/v3/GroupServiceSettings.java new file mode 100644 index 00000000..28ef4a22 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/GroupServiceSettings.java @@ -0,0 +1,244 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupMembersPagedResponse; +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.monitoring.v3.stub.GroupServiceStubSettings; +import com.google.monitoring.v3.CreateGroupRequest; +import com.google.monitoring.v3.DeleteGroupRequest; +import com.google.monitoring.v3.GetGroupRequest; +import com.google.monitoring.v3.Group; +import com.google.monitoring.v3.ListGroupMembersRequest; +import com.google.monitoring.v3.ListGroupMembersResponse; +import com.google.monitoring.v3.ListGroupsRequest; +import com.google.monitoring.v3.ListGroupsResponse; +import com.google.monitoring.v3.UpdateGroupRequest; +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 GroupServiceClient}. + * + *

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

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

+ * 
+ * GroupServiceSettings.Builder groupServiceSettingsBuilder =
+ *     GroupServiceSettings.newBuilder();
+ * groupServiceSettingsBuilder.getGroupSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * GroupServiceSettings groupServiceSettings = groupServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class GroupServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listGroups. */ + public PagedCallSettings + listGroupsSettings() { + return ((GroupServiceStubSettings) getStubSettings()).listGroupsSettings(); + } + + /** Returns the object with the settings used for calls to getGroup. */ + public UnaryCallSettings getGroupSettings() { + return ((GroupServiceStubSettings) getStubSettings()).getGroupSettings(); + } + + /** Returns the object with the settings used for calls to createGroup. */ + public UnaryCallSettings createGroupSettings() { + return ((GroupServiceStubSettings) getStubSettings()).createGroupSettings(); + } + + /** Returns the object with the settings used for calls to updateGroup. */ + public UnaryCallSettings updateGroupSettings() { + return ((GroupServiceStubSettings) getStubSettings()).updateGroupSettings(); + } + + /** Returns the object with the settings used for calls to deleteGroup. */ + public UnaryCallSettings deleteGroupSettings() { + return ((GroupServiceStubSettings) getStubSettings()).deleteGroupSettings(); + } + + /** Returns the object with the settings used for calls to listGroupMembers. */ + public PagedCallSettings< + ListGroupMembersRequest, ListGroupMembersResponse, ListGroupMembersPagedResponse> + listGroupMembersSettings() { + return ((GroupServiceStubSettings) getStubSettings()).listGroupMembersSettings(); + } + + public static final GroupServiceSettings create(GroupServiceStubSettings stub) + throws IOException { + return new GroupServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return GroupServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return GroupServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return GroupServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GroupServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return GroupServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return GroupServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return GroupServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GroupServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for GroupServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(GroupServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(GroupServiceStubSettings.newBuilder()); + } + + protected Builder(GroupServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(GroupServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public GroupServiceStubSettings.Builder getStubSettingsBuilder() { + return ((GroupServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to listGroups. */ + public PagedCallSettings.Builder + listGroupsSettings() { + return getStubSettingsBuilder().listGroupsSettings(); + } + + /** Returns the builder for the settings used for calls to getGroup. */ + public UnaryCallSettings.Builder getGroupSettings() { + return getStubSettingsBuilder().getGroupSettings(); + } + + /** Returns the builder for the settings used for calls to createGroup. */ + public UnaryCallSettings.Builder createGroupSettings() { + return getStubSettingsBuilder().createGroupSettings(); + } + + /** Returns the builder for the settings used for calls to updateGroup. */ + public UnaryCallSettings.Builder updateGroupSettings() { + return getStubSettingsBuilder().updateGroupSettings(); + } + + /** Returns the builder for the settings used for calls to deleteGroup. */ + public UnaryCallSettings.Builder deleteGroupSettings() { + return getStubSettingsBuilder().deleteGroupSettings(); + } + + /** Returns the builder for the settings used for calls to listGroupMembers. */ + public PagedCallSettings.Builder< + ListGroupMembersRequest, ListGroupMembersResponse, ListGroupMembersPagedResponse> + listGroupMembersSettings() { + return getStubSettingsBuilder().listGroupMembersSettings(); + } + + @Override + public GroupServiceSettings build() throws IOException { + return new GroupServiceSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/MetricServiceClient.java b/src/main/java/com/google/cloud/monitoring/v3/MetricServiceClient.java new file mode 100644 index 00000000..d5e19788 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/MetricServiceClient.java @@ -0,0 +1,1492 @@ +/* + * 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.monitoring.v3; + +import com.google.api.MetricDescriptor; +import com.google.api.MonitoredResourceDescriptor; +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.monitoring.v3.stub.MetricServiceStub; +import com.google.cloud.monitoring.v3.stub.MetricServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.monitoring.v3.CreateMetricDescriptorRequest; +import com.google.monitoring.v3.CreateTimeSeriesRequest; +import com.google.monitoring.v3.DeleteMetricDescriptorRequest; +import com.google.monitoring.v3.GetMetricDescriptorRequest; +import com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest; +import com.google.monitoring.v3.ListMetricDescriptorsRequest; +import com.google.monitoring.v3.ListMetricDescriptorsResponse; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; +import com.google.monitoring.v3.ListTimeSeriesRequest; +import com.google.monitoring.v3.ListTimeSeriesResponse; +import com.google.monitoring.v3.MetricDescriptorName; +import com.google.monitoring.v3.MonitoredResourceDescriptorName; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.TimeInterval; +import com.google.monitoring.v3.TimeSeries; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Manages metric descriptors, monitored resource descriptors, and time series + * data. + * + *

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: + * + *

+ * 
+ * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+ *   MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
+ *   MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(name);
+ * }
+ * 
+ * 
+ * + *

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

To customize credentials: + * + *

+ * 
+ * MetricServiceSettings metricServiceSettings =
+ *     MetricServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * MetricServiceClient metricServiceClient =
+ *     MetricServiceClient.create(metricServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * MetricServiceSettings metricServiceSettings =
+ *     MetricServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * MetricServiceClient metricServiceClient =
+ *     MetricServiceClient.create(metricServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class MetricServiceClient implements BackgroundResource { + private final MetricServiceSettings settings; + private final MetricServiceStub stub; + + /** Constructs an instance of MetricServiceClient with default settings. */ + public static final MetricServiceClient create() throws IOException { + return create(MetricServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of MetricServiceClient, 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 MetricServiceClient create(MetricServiceSettings settings) + throws IOException { + return new MetricServiceClient(settings); + } + + /** + * Constructs an instance of MetricServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer to use MetricServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final MetricServiceClient create(MetricServiceStub stub) { + return new MetricServiceClient(stub); + } + + /** + * Constructs an instance of MetricServiceClient, 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 MetricServiceClient(MetricServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((MetricServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected MetricServiceClient(MetricServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final MetricServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public MetricServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists monitored resource descriptors that match a filter. This method does not require a + * Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (MonitoredResourceDescriptor element : metricServiceClient.listMonitoredResourceDescriptors(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * `"projects/{project_id_or_number}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResourceDescriptors( + ProjectName name) { + ListMonitoredResourceDescriptorsRequest request = + ListMonitoredResourceDescriptorsRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return listMonitoredResourceDescriptors(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists monitored resource descriptors that match a filter. This method does not require a + * Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (MonitoredResourceDescriptor element : metricServiceClient.listMonitoredResourceDescriptors(name.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * `"projects/{project_id_or_number}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListMonitoredResourceDescriptorsPagedResponse listMonitoredResourceDescriptors( + String name) { + ListMonitoredResourceDescriptorsRequest request = + ListMonitoredResourceDescriptorsRequest.newBuilder().setName(name).build(); + return listMonitoredResourceDescriptors(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists monitored resource descriptors that match a filter. This method does not require a + * Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   for (MonitoredResourceDescriptor element : metricServiceClient.listMonitoredResourceDescriptors(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 ListMonitoredResourceDescriptorsPagedResponse listMonitoredResourceDescriptors( + ListMonitoredResourceDescriptorsRequest request) { + return listMonitoredResourceDescriptorsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists monitored resource descriptors that match a filter. This method does not require a + * Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ListMonitoredResourceDescriptorsPagedResponse> future = metricServiceClient.listMonitoredResourceDescriptorsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (MonitoredResourceDescriptor element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsPagedCallable() { + return stub.listMonitoredResourceDescriptorsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists monitored resource descriptors that match a filter. This method does not require a + * Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListMonitoredResourceDescriptorsRequest request = ListMonitoredResourceDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   while (true) {
+   *     ListMonitoredResourceDescriptorsResponse response = metricServiceClient.listMonitoredResourceDescriptorsCallable().call(request);
+   *     for (MonitoredResourceDescriptor element : response.getResourceDescriptorsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> + listMonitoredResourceDescriptorsCallable() { + return stub.listMonitoredResourceDescriptorsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single monitored resource descriptor. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
+   *   MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(name);
+   * }
+   * 
+ * + * @param name The monitored resource descriptor to get. The format is + * `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. The + * `{resource_type}` is a predefined type, such as `cloudsql_database`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MonitoredResourceDescriptor getMonitoredResourceDescriptor( + MonitoredResourceDescriptorName name) { + + GetMonitoredResourceDescriptorRequest request = + GetMonitoredResourceDescriptorRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getMonitoredResourceDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single monitored resource descriptor. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
+   *   MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(name.toString());
+   * }
+   * 
+ * + * @param name The monitored resource descriptor to get. The format is + * `"projects/{project_id_or_number}/monitoredResourceDescriptors/{resource_type}"`. The + * `{resource_type}` is a predefined type, such as `cloudsql_database`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MonitoredResourceDescriptor getMonitoredResourceDescriptor(String name) { + + GetMonitoredResourceDescriptorRequest request = + GetMonitoredResourceDescriptorRequest.newBuilder().setName(name).build(); + return getMonitoredResourceDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single monitored resource descriptor. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
+   *   GetMonitoredResourceDescriptorRequest request = GetMonitoredResourceDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(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 MonitoredResourceDescriptor getMonitoredResourceDescriptor( + GetMonitoredResourceDescriptorRequest request) { + return getMonitoredResourceDescriptorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single monitored resource descriptor. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
+   *   GetMonitoredResourceDescriptorRequest request = GetMonitoredResourceDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<MonitoredResourceDescriptor> future = metricServiceClient.getMonitoredResourceDescriptorCallable().futureCall(request);
+   *   // Do something
+   *   MonitoredResourceDescriptor response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + getMonitoredResourceDescriptorCallable() { + return stub.getMonitoredResourceDescriptorCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists metric descriptors that match a filter. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (MetricDescriptor element : metricServiceClient.listMetricDescriptors(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * `"projects/{project_id_or_number}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListMetricDescriptorsPagedResponse listMetricDescriptors(ProjectName name) { + ListMetricDescriptorsRequest request = + ListMetricDescriptorsRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return listMetricDescriptors(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists metric descriptors that match a filter. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (MetricDescriptor element : metricServiceClient.listMetricDescriptors(name.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * `"projects/{project_id_or_number}"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListMetricDescriptorsPagedResponse listMetricDescriptors(String name) { + ListMetricDescriptorsRequest request = + ListMetricDescriptorsRequest.newBuilder().setName(name).build(); + return listMetricDescriptors(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists metric descriptors that match a filter. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   for (MetricDescriptor element : metricServiceClient.listMetricDescriptors(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 ListMetricDescriptorsPagedResponse listMetricDescriptors( + ListMetricDescriptorsRequest request) { + return listMetricDescriptorsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists metric descriptors that match a filter. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ListMetricDescriptorsPagedResponse> future = metricServiceClient.listMetricDescriptorsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (MetricDescriptor element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listMetricDescriptorsPagedCallable() { + return stub.listMetricDescriptorsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists metric descriptors that match a filter. This method does not require a Stackdriver + * account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListMetricDescriptorsRequest request = ListMetricDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   while (true) {
+   *     ListMetricDescriptorsResponse response = metricServiceClient.listMetricDescriptorsCallable().call(request);
+   *     for (MetricDescriptor element : response.getMetricDescriptorsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listMetricDescriptorsCallable() { + return stub.listMetricDescriptorsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single metric descriptor. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
+   *   MetricDescriptor response = metricServiceClient.getMetricDescriptor(name);
+   * }
+   * 
+ * + * @param name The metric descriptor on which to execute the request. The format is + * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example value of + * `{metric_id}` is `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MetricDescriptor getMetricDescriptor(MetricDescriptorName name) { + + GetMetricDescriptorRequest request = + GetMetricDescriptorRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getMetricDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single metric descriptor. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
+   *   MetricDescriptor response = metricServiceClient.getMetricDescriptor(name.toString());
+   * }
+   * 
+ * + * @param name The metric descriptor on which to execute the request. The format is + * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example value of + * `{metric_id}` is `"compute.googleapis.com/instance/disk/read_bytes_count"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MetricDescriptor getMetricDescriptor(String name) { + + GetMetricDescriptorRequest request = + GetMetricDescriptorRequest.newBuilder().setName(name).build(); + return getMetricDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single metric descriptor. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
+   *   GetMetricDescriptorRequest request = GetMetricDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   MetricDescriptor response = metricServiceClient.getMetricDescriptor(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 MetricDescriptor getMetricDescriptor(GetMetricDescriptorRequest request) { + return getMetricDescriptorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single metric descriptor. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
+   *   GetMetricDescriptorRequest request = GetMetricDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<MetricDescriptor> future = metricServiceClient.getMetricDescriptorCallable().futureCall(request);
+   *   // Do something
+   *   MetricDescriptor response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + getMetricDescriptorCallable() { + return stub.getMetricDescriptorCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new metric descriptor. User-created metric descriptors define [custom + * metrics](/monitoring/custom-metrics). + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
+   *   MetricDescriptor response = metricServiceClient.createMetricDescriptor(name, metricDescriptor);
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * `"projects/{project_id_or_number}"`. + * @param metricDescriptor The new [custom metric](/monitoring/custom-metrics) descriptor. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MetricDescriptor createMetricDescriptor( + ProjectName name, MetricDescriptor metricDescriptor) { + + CreateMetricDescriptorRequest request = + CreateMetricDescriptorRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setMetricDescriptor(metricDescriptor) + .build(); + return createMetricDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new metric descriptor. User-created metric descriptors define [custom + * metrics](/monitoring/custom-metrics). + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
+   *   MetricDescriptor response = metricServiceClient.createMetricDescriptor(name.toString(), metricDescriptor);
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * `"projects/{project_id_or_number}"`. + * @param metricDescriptor The new [custom metric](/monitoring/custom-metrics) descriptor. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final MetricDescriptor createMetricDescriptor( + String name, MetricDescriptor metricDescriptor) { + + CreateMetricDescriptorRequest request = + CreateMetricDescriptorRequest.newBuilder() + .setName(name) + .setMetricDescriptor(metricDescriptor) + .build(); + return createMetricDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new metric descriptor. User-created metric descriptors define [custom + * metrics](/monitoring/custom-metrics). + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
+   *   CreateMetricDescriptorRequest request = CreateMetricDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setMetricDescriptor(metricDescriptor)
+   *     .build();
+   *   MetricDescriptor response = metricServiceClient.createMetricDescriptor(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 MetricDescriptor createMetricDescriptor(CreateMetricDescriptorRequest request) { + return createMetricDescriptorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new metric descriptor. User-created metric descriptors define [custom + * metrics](/monitoring/custom-metrics). + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build();
+   *   CreateMetricDescriptorRequest request = CreateMetricDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setMetricDescriptor(metricDescriptor)
+   *     .build();
+   *   ApiFuture<MetricDescriptor> future = metricServiceClient.createMetricDescriptorCallable().futureCall(request);
+   *   // Do something
+   *   MetricDescriptor response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + createMetricDescriptorCallable() { + return stub.createMetricDescriptorCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can + * be deleted. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
+   *   metricServiceClient.deleteMetricDescriptor(name);
+   * }
+   * 
+ * + * @param name The metric descriptor on which to execute the request. The format is + * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example of + * `{metric_id}` is: `"custom.googleapis.com/my_test_metric"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteMetricDescriptor(MetricDescriptorName name) { + + DeleteMetricDescriptorRequest request = + DeleteMetricDescriptorRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteMetricDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can + * be deleted. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
+   *   metricServiceClient.deleteMetricDescriptor(name.toString());
+   * }
+   * 
+ * + * @param name The metric descriptor on which to execute the request. The format is + * `"projects/{project_id_or_number}/metricDescriptors/{metric_id}"`. An example of + * `{metric_id}` is: `"custom.googleapis.com/my_test_metric"`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteMetricDescriptor(String name) { + + DeleteMetricDescriptorRequest request = + DeleteMetricDescriptorRequest.newBuilder().setName(name).build(); + deleteMetricDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can + * be deleted. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
+   *   DeleteMetricDescriptorRequest request = DeleteMetricDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   metricServiceClient.deleteMetricDescriptor(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 deleteMetricDescriptor(DeleteMetricDescriptorRequest request) { + deleteMetricDescriptorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a metric descriptor. Only user-created [custom metrics](/monitoring/custom-metrics) can + * be deleted. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]");
+   *   DeleteMetricDescriptorRequest request = DeleteMetricDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = metricServiceClient.deleteMetricDescriptorCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + deleteMetricDescriptorCallable() { + return stub.deleteMetricDescriptorCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists time series that match a filter. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   String filter = "";
+   *   TimeInterval interval = TimeInterval.newBuilder().build();
+   *   ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
+   *   for (TimeSeries element : metricServiceClient.listTimeSeries(name, filter, interval, view).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * "projects/{project_id_or_number}". + * @param filter A [monitoring filter](/monitoring/api/v3/filters) that specifies which time + * series should be returned. The filter must specify a single metric type, and can + * additionally specify metric labels and other information. For example: + *

metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param interval The time interval for which results should be returned. Only time series that + * contain data points in the specified interval are included in the response. + * @param view Specifies which information is returned about the time series. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTimeSeriesPagedResponse listTimeSeries( + ProjectName name, + String filter, + TimeInterval interval, + ListTimeSeriesRequest.TimeSeriesView view) { + ListTimeSeriesRequest request = + ListTimeSeriesRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setFilter(filter) + .setInterval(interval) + .setView(view) + .build(); + return listTimeSeries(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists time series that match a filter. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   String filter = "";
+   *   TimeInterval interval = TimeInterval.newBuilder().build();
+   *   ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
+   *   for (TimeSeries element : metricServiceClient.listTimeSeries(name.toString(), filter, interval, view).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * "projects/{project_id_or_number}". + * @param filter A [monitoring filter](/monitoring/api/v3/filters) that specifies which time + * series should be returned. The filter must specify a single metric type, and can + * additionally specify metric labels and other information. For example: + *

metric.type = "compute.googleapis.com/instance/cpu/usage_time" AND + * metric.labels.instance_name = "my-instance-name" + * @param interval The time interval for which results should be returned. Only time series that + * contain data points in the specified interval are included in the response. + * @param view Specifies which information is returned about the time series. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListTimeSeriesPagedResponse listTimeSeries( + String name, + String filter, + TimeInterval interval, + ListTimeSeriesRequest.TimeSeriesView view) { + ListTimeSeriesRequest request = + ListTimeSeriesRequest.newBuilder() + .setName(name) + .setFilter(filter) + .setInterval(interval) + .setView(view) + .build(); + return listTimeSeries(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists time series that match a filter. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   String filter = "";
+   *   TimeInterval interval = TimeInterval.newBuilder().build();
+   *   ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
+   *   ListTimeSeriesRequest request = ListTimeSeriesRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setFilter(filter)
+   *     .setInterval(interval)
+   *     .setView(view)
+   *     .build();
+   *   for (TimeSeries element : metricServiceClient.listTimeSeries(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 ListTimeSeriesPagedResponse listTimeSeries(ListTimeSeriesRequest request) { + return listTimeSeriesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists time series that match a filter. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   String filter = "";
+   *   TimeInterval interval = TimeInterval.newBuilder().build();
+   *   ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
+   *   ListTimeSeriesRequest request = ListTimeSeriesRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setFilter(filter)
+   *     .setInterval(interval)
+   *     .setView(view)
+   *     .build();
+   *   ApiFuture<ListTimeSeriesPagedResponse> future = metricServiceClient.listTimeSeriesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (TimeSeries element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listTimeSeriesPagedCallable() { + return stub.listTimeSeriesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists time series that match a filter. This method does not require a Stackdriver account. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   String filter = "";
+   *   TimeInterval interval = TimeInterval.newBuilder().build();
+   *   ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL;
+   *   ListTimeSeriesRequest request = ListTimeSeriesRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setFilter(filter)
+   *     .setInterval(interval)
+   *     .setView(view)
+   *     .build();
+   *   while (true) {
+   *     ListTimeSeriesResponse response = metricServiceClient.listTimeSeriesCallable().call(request);
+   *     for (TimeSeries element : response.getTimeSeriesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listTimeSeriesCallable() { + return stub.listTimeSeriesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates or adds data to one or more time series. The response is empty if all time series in + * the request were written. If any time series could not be written, a corresponding failure + * message is included in the error response. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   List<TimeSeries> timeSeries = new ArrayList<>();
+   *   metricServiceClient.createTimeSeries(name, timeSeries);
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * `"projects/{project_id_or_number}"`. + * @param timeSeries The new data to be added to a list of time series. Adds at most one data + * point to each of several time series. The new data point must be more recent than any other + * point in its time series. Each `TimeSeries` value must fully specify a unique time series + * by supplying all label values for the metric and the monitored resource. + *

The maximum number of `TimeSeries` objects per `Create` request is 200. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void createTimeSeries(ProjectName name, List timeSeries) { + + CreateTimeSeriesRequest request = + CreateTimeSeriesRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .addAllTimeSeries(timeSeries) + .build(); + createTimeSeries(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates or adds data to one or more time series. The response is empty if all time series in + * the request were written. If any time series could not be written, a corresponding failure + * message is included in the error response. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   List<TimeSeries> timeSeries = new ArrayList<>();
+   *   metricServiceClient.createTimeSeries(name.toString(), timeSeries);
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is + * `"projects/{project_id_or_number}"`. + * @param timeSeries The new data to be added to a list of time series. Adds at most one data + * point to each of several time series. The new data point must be more recent than any other + * point in its time series. Each `TimeSeries` value must fully specify a unique time series + * by supplying all label values for the metric and the monitored resource. + *

The maximum number of `TimeSeries` objects per `Create` request is 200. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void createTimeSeries(String name, List timeSeries) { + + CreateTimeSeriesRequest request = + CreateTimeSeriesRequest.newBuilder().setName(name).addAllTimeSeries(timeSeries).build(); + createTimeSeries(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates or adds data to one or more time series. The response is empty if all time series in + * the request were written. If any time series could not be written, a corresponding failure + * message is included in the error response. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   List<TimeSeries> timeSeries = new ArrayList<>();
+   *   CreateTimeSeriesRequest request = CreateTimeSeriesRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .addAllTimeSeries(timeSeries)
+   *     .build();
+   *   metricServiceClient.createTimeSeries(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 createTimeSeries(CreateTimeSeriesRequest request) { + createTimeSeriesCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates or adds data to one or more time series. The response is empty if all time series in + * the request were written. If any time series could not be written, a corresponding failure + * message is included in the error response. + * + *

Sample code: + * + *


+   * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   List<TimeSeries> timeSeries = new ArrayList<>();
+   *   CreateTimeSeriesRequest request = CreateTimeSeriesRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .addAllTimeSeries(timeSeries)
+   *     .build();
+   *   ApiFuture<Void> future = metricServiceClient.createTimeSeriesCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createTimeSeriesCallable() { + return stub.createTimeSeriesCallable(); + } + + @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 ListMonitoredResourceDescriptorsPagedResponse + extends AbstractPagedListResponse< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor, + ListMonitoredResourceDescriptorsPage, + ListMonitoredResourceDescriptorsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListMonitoredResourceDescriptorsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + ListMonitoredResourceDescriptorsPage, + ListMonitoredResourceDescriptorsPagedResponse>() { + @Override + public ListMonitoredResourceDescriptorsPagedResponse apply( + ListMonitoredResourceDescriptorsPage input) { + return new ListMonitoredResourceDescriptorsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListMonitoredResourceDescriptorsPagedResponse( + ListMonitoredResourceDescriptorsPage page) { + super(page, ListMonitoredResourceDescriptorsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListMonitoredResourceDescriptorsPage + extends AbstractPage< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor, + ListMonitoredResourceDescriptorsPage> { + + private ListMonitoredResourceDescriptorsPage( + PageContext< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor> + context, + ListMonitoredResourceDescriptorsResponse response) { + super(context, response); + } + + private static ListMonitoredResourceDescriptorsPage createEmptyPage() { + return new ListMonitoredResourceDescriptorsPage(null, null); + } + + @Override + protected ListMonitoredResourceDescriptorsPage createPage( + PageContext< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor> + context, + ListMonitoredResourceDescriptorsResponse response) { + return new ListMonitoredResourceDescriptorsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListMonitoredResourceDescriptorsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor, + ListMonitoredResourceDescriptorsPage, + ListMonitoredResourceDescriptorsFixedSizeCollection> { + + private ListMonitoredResourceDescriptorsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListMonitoredResourceDescriptorsFixedSizeCollection createEmptyCollection() { + return new ListMonitoredResourceDescriptorsFixedSizeCollection(null, 0); + } + + @Override + protected ListMonitoredResourceDescriptorsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListMonitoredResourceDescriptorsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListMetricDescriptorsPagedResponse + extends AbstractPagedListResponse< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + MetricDescriptor, + ListMetricDescriptorsPage, + ListMetricDescriptorsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListMetricDescriptorsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListMetricDescriptorsPagedResponse apply(ListMetricDescriptorsPage input) { + return new ListMetricDescriptorsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListMetricDescriptorsPagedResponse(ListMetricDescriptorsPage page) { + super(page, ListMetricDescriptorsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListMetricDescriptorsPage + extends AbstractPage< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + MetricDescriptor, + ListMetricDescriptorsPage> { + + private ListMetricDescriptorsPage( + PageContext + context, + ListMetricDescriptorsResponse response) { + super(context, response); + } + + private static ListMetricDescriptorsPage createEmptyPage() { + return new ListMetricDescriptorsPage(null, null); + } + + @Override + protected ListMetricDescriptorsPage createPage( + PageContext + context, + ListMetricDescriptorsResponse response) { + return new ListMetricDescriptorsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListMetricDescriptorsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + MetricDescriptor, + ListMetricDescriptorsPage, + ListMetricDescriptorsFixedSizeCollection> { + + private ListMetricDescriptorsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListMetricDescriptorsFixedSizeCollection createEmptyCollection() { + return new ListMetricDescriptorsFixedSizeCollection(null, 0); + } + + @Override + protected ListMetricDescriptorsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListMetricDescriptorsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListTimeSeriesPagedResponse + extends AbstractPagedListResponse< + ListTimeSeriesRequest, + ListTimeSeriesResponse, + TimeSeries, + ListTimeSeriesPage, + ListTimeSeriesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListTimeSeriesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListTimeSeriesPagedResponse apply(ListTimeSeriesPage input) { + return new ListTimeSeriesPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListTimeSeriesPagedResponse(ListTimeSeriesPage page) { + super(page, ListTimeSeriesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListTimeSeriesPage + extends AbstractPage< + ListTimeSeriesRequest, ListTimeSeriesResponse, TimeSeries, ListTimeSeriesPage> { + + private ListTimeSeriesPage( + PageContext context, + ListTimeSeriesResponse response) { + super(context, response); + } + + private static ListTimeSeriesPage createEmptyPage() { + return new ListTimeSeriesPage(null, null); + } + + @Override + protected ListTimeSeriesPage createPage( + PageContext context, + ListTimeSeriesResponse response) { + return new ListTimeSeriesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListTimeSeriesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListTimeSeriesRequest, + ListTimeSeriesResponse, + TimeSeries, + ListTimeSeriesPage, + ListTimeSeriesFixedSizeCollection> { + + private ListTimeSeriesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListTimeSeriesFixedSizeCollection createEmptyCollection() { + return new ListTimeSeriesFixedSizeCollection(null, 0); + } + + @Override + protected ListTimeSeriesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListTimeSeriesFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/MetricServiceSettings.java b/src/main/java/com/google/cloud/monitoring/v3/MetricServiceSettings.java new file mode 100644 index 00000000..a9be3cda --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/MetricServiceSettings.java @@ -0,0 +1,292 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMetricDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMonitoredResourceDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListTimeSeriesPagedResponse; + +import com.google.api.MetricDescriptor; +import com.google.api.MonitoredResourceDescriptor; +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.monitoring.v3.stub.MetricServiceStubSettings; +import com.google.monitoring.v3.CreateMetricDescriptorRequest; +import com.google.monitoring.v3.CreateTimeSeriesRequest; +import com.google.monitoring.v3.DeleteMetricDescriptorRequest; +import com.google.monitoring.v3.GetMetricDescriptorRequest; +import com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest; +import com.google.monitoring.v3.ListMetricDescriptorsRequest; +import com.google.monitoring.v3.ListMetricDescriptorsResponse; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; +import com.google.monitoring.v3.ListTimeSeriesRequest; +import com.google.monitoring.v3.ListTimeSeriesResponse; +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 MetricServiceClient}. + * + *

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

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

+ * 
+ * MetricServiceSettings.Builder metricServiceSettingsBuilder =
+ *     MetricServiceSettings.newBuilder();
+ * metricServiceSettingsBuilder.getMonitoredResourceDescriptorSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * MetricServiceSettings metricServiceSettings = metricServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class MetricServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listMonitoredResourceDescriptors. */ + public PagedCallSettings< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsSettings() { + return ((MetricServiceStubSettings) getStubSettings()) + .listMonitoredResourceDescriptorsSettings(); + } + + /** Returns the object with the settings used for calls to getMonitoredResourceDescriptor. */ + public UnaryCallSettings + getMonitoredResourceDescriptorSettings() { + return ((MetricServiceStubSettings) getStubSettings()).getMonitoredResourceDescriptorSettings(); + } + + /** Returns the object with the settings used for calls to listMetricDescriptors. */ + public PagedCallSettings< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + ListMetricDescriptorsPagedResponse> + listMetricDescriptorsSettings() { + return ((MetricServiceStubSettings) getStubSettings()).listMetricDescriptorsSettings(); + } + + /** Returns the object with the settings used for calls to getMetricDescriptor. */ + public UnaryCallSettings + getMetricDescriptorSettings() { + return ((MetricServiceStubSettings) getStubSettings()).getMetricDescriptorSettings(); + } + + /** Returns the object with the settings used for calls to createMetricDescriptor. */ + public UnaryCallSettings + createMetricDescriptorSettings() { + return ((MetricServiceStubSettings) getStubSettings()).createMetricDescriptorSettings(); + } + + /** Returns the object with the settings used for calls to deleteMetricDescriptor. */ + public UnaryCallSettings deleteMetricDescriptorSettings() { + return ((MetricServiceStubSettings) getStubSettings()).deleteMetricDescriptorSettings(); + } + + /** Returns the object with the settings used for calls to listTimeSeries. */ + public PagedCallSettings< + ListTimeSeriesRequest, ListTimeSeriesResponse, ListTimeSeriesPagedResponse> + listTimeSeriesSettings() { + return ((MetricServiceStubSettings) getStubSettings()).listTimeSeriesSettings(); + } + + /** Returns the object with the settings used for calls to createTimeSeries. */ + public UnaryCallSettings createTimeSeriesSettings() { + return ((MetricServiceStubSettings) getStubSettings()).createTimeSeriesSettings(); + } + + public static final MetricServiceSettings create(MetricServiceStubSettings stub) + throws IOException { + return new MetricServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return MetricServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return MetricServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return MetricServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return MetricServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return MetricServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return MetricServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return MetricServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected MetricServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for MetricServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(MetricServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(MetricServiceStubSettings.newBuilder()); + } + + protected Builder(MetricServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(MetricServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public MetricServiceStubSettings.Builder getStubSettingsBuilder() { + return ((MetricServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to listMonitoredResourceDescriptors. */ + public PagedCallSettings.Builder< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsSettings() { + return getStubSettingsBuilder().listMonitoredResourceDescriptorsSettings(); + } + + /** Returns the builder for the settings used for calls to getMonitoredResourceDescriptor. */ + public UnaryCallSettings.Builder< + GetMonitoredResourceDescriptorRequest, MonitoredResourceDescriptor> + getMonitoredResourceDescriptorSettings() { + return getStubSettingsBuilder().getMonitoredResourceDescriptorSettings(); + } + + /** Returns the builder for the settings used for calls to listMetricDescriptors. */ + public PagedCallSettings.Builder< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + ListMetricDescriptorsPagedResponse> + listMetricDescriptorsSettings() { + return getStubSettingsBuilder().listMetricDescriptorsSettings(); + } + + /** Returns the builder for the settings used for calls to getMetricDescriptor. */ + public UnaryCallSettings.Builder + getMetricDescriptorSettings() { + return getStubSettingsBuilder().getMetricDescriptorSettings(); + } + + /** Returns the builder for the settings used for calls to createMetricDescriptor. */ + public UnaryCallSettings.Builder + createMetricDescriptorSettings() { + return getStubSettingsBuilder().createMetricDescriptorSettings(); + } + + /** Returns the builder for the settings used for calls to deleteMetricDescriptor. */ + public UnaryCallSettings.Builder + deleteMetricDescriptorSettings() { + return getStubSettingsBuilder().deleteMetricDescriptorSettings(); + } + + /** Returns the builder for the settings used for calls to listTimeSeries. */ + public PagedCallSettings.Builder< + ListTimeSeriesRequest, ListTimeSeriesResponse, ListTimeSeriesPagedResponse> + listTimeSeriesSettings() { + return getStubSettingsBuilder().listTimeSeriesSettings(); + } + + /** Returns the builder for the settings used for calls to createTimeSeries. */ + public UnaryCallSettings.Builder createTimeSeriesSettings() { + return getStubSettingsBuilder().createTimeSeriesSettings(); + } + + @Override + public MetricServiceSettings build() throws IOException { + return new MetricServiceSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java b/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java new file mode 100644 index 00000000..49df0842 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java @@ -0,0 +1,1611 @@ +/* + * 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.monitoring.v3; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.monitoring.v3.stub.NotificationChannelServiceStub; +import com.google.cloud.monitoring.v3.stub.NotificationChannelServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.monitoring.v3.CreateNotificationChannelRequest; +import com.google.monitoring.v3.DeleteNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelDescriptorRequest; +import com.google.monitoring.v3.GetNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse; +import com.google.monitoring.v3.ListNotificationChannelsRequest; +import com.google.monitoring.v3.ListNotificationChannelsResponse; +import com.google.monitoring.v3.NotificationChannel; +import com.google.monitoring.v3.NotificationChannelDescriptor; +import com.google.monitoring.v3.NotificationChannelDescriptorName; +import com.google.monitoring.v3.NotificationChannelName; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.UpdateNotificationChannelRequest; +import com.google.monitoring.v3.VerifyNotificationChannelRequest; +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 SERVICE +/** + * Service Description: The Notification Channel API provides access to configuration that controls + * how messages related to incidents are sent. + * + *

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: + * + *

+ * 
+ * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+ *   NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
+ *   NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name);
+ * }
+ * 
+ * 
+ * + *

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

To customize credentials: + * + *

+ * 
+ * NotificationChannelServiceSettings notificationChannelServiceSettings =
+ *     NotificationChannelServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * NotificationChannelServiceClient notificationChannelServiceClient =
+ *     NotificationChannelServiceClient.create(notificationChannelServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * NotificationChannelServiceSettings notificationChannelServiceSettings =
+ *     NotificationChannelServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * NotificationChannelServiceClient notificationChannelServiceClient =
+ *     NotificationChannelServiceClient.create(notificationChannelServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class NotificationChannelServiceClient implements BackgroundResource { + private final NotificationChannelServiceSettings settings; + private final NotificationChannelServiceStub stub; + + /** Constructs an instance of NotificationChannelServiceClient with default settings. */ + public static final NotificationChannelServiceClient create() throws IOException { + return create(NotificationChannelServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of NotificationChannelServiceClient, 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 NotificationChannelServiceClient create( + NotificationChannelServiceSettings settings) throws IOException { + return new NotificationChannelServiceClient(settings); + } + + /** + * Constructs an instance of NotificationChannelServiceClient, using the given stub for making + * calls. This is for advanced usage - prefer to use NotificationChannelServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final NotificationChannelServiceClient create(NotificationChannelServiceStub stub) { + return new NotificationChannelServiceClient(stub); + } + + /** + * Constructs an instance of NotificationChannelServiceClient, 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 NotificationChannelServiceClient(NotificationChannelServiceSettings settings) + throws IOException { + this.settings = settings; + this.stub = ((NotificationChannelServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected NotificationChannelServiceClient(NotificationChannelServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final NotificationChannelServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public NotificationChannelServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the descriptors for supported channel types. The use of descriptors makes it possible for + * new channel types to be dynamically added. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The REST resource name of the parent from which to retrieve the notification + * channel descriptors. The expected syntax is: + *

projects/[PROJECT_ID] + *

Note that this names the parent container in which to look for the descriptors; to + * retrieve a single descriptor by name, use the + * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + * operation, instead. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors( + ProjectName name) { + ListNotificationChannelDescriptorsRequest request = + ListNotificationChannelDescriptorsRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return listNotificationChannelDescriptors(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the descriptors for supported channel types. The use of descriptors makes it possible for + * new channel types to be dynamically added. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(name.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The REST resource name of the parent from which to retrieve the notification + * channel descriptors. The expected syntax is: + *

projects/[PROJECT_ID] + *

Note that this names the parent container in which to look for the descriptors; to + * retrieve a single descriptor by name, use the + * [GetNotificationChannelDescriptor][google.monitoring.v3.NotificationChannelService.GetNotificationChannelDescriptor] + * operation, instead. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors( + String name) { + ListNotificationChannelDescriptorsRequest request = + ListNotificationChannelDescriptorsRequest.newBuilder().setName(name).build(); + return listNotificationChannelDescriptors(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the descriptors for supported channel types. The use of descriptors makes it possible for + * new channel types to be dynamically added. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   for (NotificationChannelDescriptor element : notificationChannelServiceClient.listNotificationChannelDescriptors(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 ListNotificationChannelDescriptorsPagedResponse listNotificationChannelDescriptors( + ListNotificationChannelDescriptorsRequest request) { + return listNotificationChannelDescriptorsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the descriptors for supported channel types. The use of descriptors makes it possible for + * new channel types to be dynamically added. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ListNotificationChannelDescriptorsPagedResponse> future = notificationChannelServiceClient.listNotificationChannelDescriptorsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (NotificationChannelDescriptor element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsPagedCallable() { + return stub.listNotificationChannelDescriptorsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the descriptors for supported channel types. The use of descriptors makes it possible for + * new channel types to be dynamically added. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListNotificationChannelDescriptorsRequest request = ListNotificationChannelDescriptorsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   while (true) {
+   *     ListNotificationChannelDescriptorsResponse response = notificationChannelServiceClient.listNotificationChannelDescriptorsCallable().call(request);
+   *     for (NotificationChannelDescriptor element : response.getChannelDescriptorsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable< + ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse> + listNotificationChannelDescriptorsCallable() { + return stub.listNotificationChannelDescriptorsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single channel descriptor. The descriptor indicates which fields are expected / + * permitted for a notification channel of the given type. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
+   *   NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name);
+   * }
+   * 
+ * + * @param name The channel type for which to execute the request. The format is + * `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannelDescriptor getNotificationChannelDescriptor( + NotificationChannelDescriptorName name) { + + GetNotificationChannelDescriptorRequest request = + GetNotificationChannelDescriptorRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getNotificationChannelDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single channel descriptor. The descriptor indicates which fields are expected / + * permitted for a notification channel of the given type. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
+   *   NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name.toString());
+   * }
+   * 
+ * + * @param name The channel type for which to execute the request. The format is + * `projects/[PROJECT_ID]/notificationChannelDescriptors/{channel_type}`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannelDescriptor getNotificationChannelDescriptor(String name) { + + GetNotificationChannelDescriptorRequest request = + GetNotificationChannelDescriptorRequest.newBuilder().setName(name).build(); + return getNotificationChannelDescriptor(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single channel descriptor. The descriptor indicates which fields are expected / + * permitted for a notification channel of the given type. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
+   *   GetNotificationChannelDescriptorRequest request = GetNotificationChannelDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(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 NotificationChannelDescriptor getNotificationChannelDescriptor( + GetNotificationChannelDescriptorRequest request) { + return getNotificationChannelDescriptorCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single channel descriptor. The descriptor indicates which fields are expected / + * permitted for a notification channel of the given type. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
+   *   GetNotificationChannelDescriptorRequest request = GetNotificationChannelDescriptorRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<NotificationChannelDescriptor> future = notificationChannelServiceClient.getNotificationChannelDescriptorCallable().futureCall(request);
+   *   // Do something
+   *   NotificationChannelDescriptor response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + getNotificationChannelDescriptorCallable() { + return stub.getNotificationChannelDescriptorCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the notification channels that have been created for the project. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is `projects/[PROJECT_ID]`. + * That is, this names the container in which to look for the notification channels; it does + * not name a specific channel. To query a specific channel by REST resource name, use the + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListNotificationChannelsPagedResponse listNotificationChannels(ProjectName name) { + ListNotificationChannelsRequest request = + ListNotificationChannelsRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return listNotificationChannels(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the notification channels that have been created for the project. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(name.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is `projects/[PROJECT_ID]`. + * That is, this names the container in which to look for the notification channels; it does + * not name a specific channel. To query a specific channel by REST resource name, use the + * [`GetNotificationChannel`][google.monitoring.v3.NotificationChannelService.GetNotificationChannel] + * operation. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListNotificationChannelsPagedResponse listNotificationChannels(String name) { + ListNotificationChannelsRequest request = + ListNotificationChannelsRequest.newBuilder().setName(name).build(); + return listNotificationChannels(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the notification channels that have been created for the project. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   for (NotificationChannel element : notificationChannelServiceClient.listNotificationChannels(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 ListNotificationChannelsPagedResponse listNotificationChannels( + ListNotificationChannelsRequest request) { + return listNotificationChannelsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the notification channels that have been created for the project. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ListNotificationChannelsPagedResponse> future = notificationChannelServiceClient.listNotificationChannelsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (NotificationChannel element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listNotificationChannelsPagedCallable() { + return stub.listNotificationChannelsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the notification channels that have been created for the project. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   ListNotificationChannelsRequest request = ListNotificationChannelsRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   while (true) {
+   *     ListNotificationChannelsResponse response = notificationChannelServiceClient.listNotificationChannelsCallable().call(request);
+   *     for (NotificationChannel element : response.getNotificationChannelsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listNotificationChannelsCallable() { + return stub.listNotificationChannelsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single notification channel. The channel includes the relevant configuration details + * with which the channel was created. However, the response may truncate or omit passwords, API + * keys, or other private key matter and thus the response may not be 100% identical to the + * information that was supplied in the call to the create method. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(name);
+   * }
+   * 
+ * + * @param name The channel for which to execute the request. The format is + * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannel getNotificationChannel(NotificationChannelName name) { + + GetNotificationChannelRequest request = + GetNotificationChannelRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single notification channel. The channel includes the relevant configuration details + * with which the channel was created. However, the response may truncate or omit passwords, API + * keys, or other private key matter and thus the response may not be 100% identical to the + * information that was supplied in the call to the create method. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(name.toString());
+   * }
+   * 
+ * + * @param name The channel for which to execute the request. The format is + * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannel getNotificationChannel(String name) { + + GetNotificationChannelRequest request = + GetNotificationChannelRequest.newBuilder().setName(name).build(); + return getNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single notification channel. The channel includes the relevant configuration details + * with which the channel was created. However, the response may truncate or omit passwords, API + * keys, or other private key matter and thus the response may not be 100% identical to the + * information that was supplied in the call to the create method. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   GetNotificationChannelRequest request = GetNotificationChannelRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   NotificationChannel response = notificationChannelServiceClient.getNotificationChannel(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 NotificationChannel getNotificationChannel(GetNotificationChannelRequest request) { + return getNotificationChannelCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single notification channel. The channel includes the relevant configuration details + * with which the channel was created. However, the response may truncate or omit passwords, API + * keys, or other private key matter and thus the response may not be 100% identical to the + * information that was supplied in the call to the create method. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   GetNotificationChannelRequest request = GetNotificationChannelRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<NotificationChannel> future = notificationChannelServiceClient.getNotificationChannelCallable().futureCall(request);
+   *   // Do something
+   *   NotificationChannel response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + getNotificationChannelCallable() { + return stub.getNotificationChannelCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new notification channel, representing a single notification endpoint such as an + * email address, SMS number, or PagerDuty service. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
+   *   NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(name, notificationChannel);
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is: + *

projects/[PROJECT_ID] + *

Note that this names the container into which the channel will be written. This does not + * name the newly created channel. The resulting channel's name will have a normalized version + * of this field as a prefix, but will add `/notificationChannels/[CHANNEL_ID]` to identify + * the channel. + * @param notificationChannel The definition of the `NotificationChannel` to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannel createNotificationChannel( + ProjectName name, NotificationChannel notificationChannel) { + + CreateNotificationChannelRequest request = + CreateNotificationChannelRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setNotificationChannel(notificationChannel) + .build(); + return createNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new notification channel, representing a single notification endpoint such as an + * email address, SMS number, or PagerDuty service. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
+   *   NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(name.toString(), notificationChannel);
+   * }
+   * 
+ * + * @param name The project on which to execute the request. The format is: + *

projects/[PROJECT_ID] + *

Note that this names the container into which the channel will be written. This does not + * name the newly created channel. The resulting channel's name will have a normalized version + * of this field as a prefix, but will add `/notificationChannels/[CHANNEL_ID]` to identify + * the channel. + * @param notificationChannel The definition of the `NotificationChannel` to create. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannel createNotificationChannel( + String name, NotificationChannel notificationChannel) { + + CreateNotificationChannelRequest request = + CreateNotificationChannelRequest.newBuilder() + .setName(name) + .setNotificationChannel(notificationChannel) + .build(); + return createNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new notification channel, representing a single notification endpoint such as an + * email address, SMS number, or PagerDuty service. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
+   *   CreateNotificationChannelRequest request = CreateNotificationChannelRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setNotificationChannel(notificationChannel)
+   *     .build();
+   *   NotificationChannel response = notificationChannelServiceClient.createNotificationChannel(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 NotificationChannel createNotificationChannel( + CreateNotificationChannelRequest request) { + return createNotificationChannelCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new notification channel, representing a single notification endpoint such as an + * email address, SMS number, or PagerDuty service. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   ProjectName name = ProjectName.of("[PROJECT]");
+   *   NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
+   *   CreateNotificationChannelRequest request = CreateNotificationChannelRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setNotificationChannel(notificationChannel)
+   *     .build();
+   *   ApiFuture<NotificationChannel> future = notificationChannelServiceClient.createNotificationChannelCallable().futureCall(request);
+   *   // Do something
+   *   NotificationChannel response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + createNotificationChannelCallable() { + return stub.createNotificationChannelCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a notification channel. Fields not specified in the field mask remain unchanged. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   FieldMask updateMask = FieldMask.newBuilder().build();
+   *   NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
+   *   NotificationChannel response = notificationChannelServiceClient.updateNotificationChannel(updateMask, notificationChannel);
+   * }
+   * 
+ * + * @param updateMask The fields to update. + * @param notificationChannel A description of the changes to be applied to the specified + * notification channel. The description must provide a definition for fields to be updated; + * the names of these fields should also be included in the `update_mask`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannel updateNotificationChannel( + FieldMask updateMask, NotificationChannel notificationChannel) { + + UpdateNotificationChannelRequest request = + UpdateNotificationChannelRequest.newBuilder() + .setUpdateMask(updateMask) + .setNotificationChannel(notificationChannel) + .build(); + return updateNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a notification channel. Fields not specified in the field mask remain unchanged. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
+   *   UpdateNotificationChannelRequest request = UpdateNotificationChannelRequest.newBuilder()
+   *     .setNotificationChannel(notificationChannel)
+   *     .build();
+   *   NotificationChannel response = notificationChannelServiceClient.updateNotificationChannel(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 NotificationChannel updateNotificationChannel( + UpdateNotificationChannelRequest request) { + return updateNotificationChannelCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a notification channel. Fields not specified in the field mask remain unchanged. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
+   *   UpdateNotificationChannelRequest request = UpdateNotificationChannelRequest.newBuilder()
+   *     .setNotificationChannel(notificationChannel)
+   *     .build();
+   *   ApiFuture<NotificationChannel> future = notificationChannelServiceClient.updateNotificationChannelCallable().futureCall(request);
+   *   // Do something
+   *   NotificationChannel response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + updateNotificationChannelCallable() { + return stub.updateNotificationChannelCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a notification channel. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   boolean force = false;
+   *   notificationChannelServiceClient.deleteNotificationChannel(name, force);
+   * }
+   * 
+ * + * @param name The channel for which to execute the request. The format is + * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. + * @param force If true, the notification channel will be deleted regardless of its use in alert + * policies (the policies will be updated to remove the channel). If false, channels that are + * still referenced by an existing alerting policy will fail to be deleted in a delete + * operation. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteNotificationChannel(NotificationChannelName name, boolean force) { + + DeleteNotificationChannelRequest request = + DeleteNotificationChannelRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setForce(force) + .build(); + deleteNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a notification channel. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   boolean force = false;
+   *   notificationChannelServiceClient.deleteNotificationChannel(name.toString(), force);
+   * }
+   * 
+ * + * @param name The channel for which to execute the request. The format is + * `projects/[PROJECT_ID]/notificationChannels/[CHANNEL_ID]`. + * @param force If true, the notification channel will be deleted regardless of its use in alert + * policies (the policies will be updated to remove the channel). If false, channels that are + * still referenced by an existing alerting policy will fail to be deleted in a delete + * operation. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteNotificationChannel(String name, boolean force) { + + DeleteNotificationChannelRequest request = + DeleteNotificationChannelRequest.newBuilder().setName(name).setForce(force).build(); + deleteNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a notification channel. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   DeleteNotificationChannelRequest request = DeleteNotificationChannelRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   notificationChannelServiceClient.deleteNotificationChannel(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 deleteNotificationChannel(DeleteNotificationChannelRequest request) { + deleteNotificationChannelCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a notification channel. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   DeleteNotificationChannelRequest request = DeleteNotificationChannelRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = notificationChannelServiceClient.deleteNotificationChannelCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + deleteNotificationChannelCallable() { + return stub.deleteNotificationChannelCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Causes a verification code to be delivered to the channel. The code can then be supplied in + * `VerifyNotificationChannel` to verify the channel. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   notificationChannelServiceClient.sendNotificationChannelVerificationCode(name);
+   * }
+   * 
+ * + * @param name The notification channel to which to send a verification code. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void sendNotificationChannelVerificationCode(NotificationChannelName name) { + + SendNotificationChannelVerificationCodeRequest request = + SendNotificationChannelVerificationCodeRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + sendNotificationChannelVerificationCode(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Causes a verification code to be delivered to the channel. The code can then be supplied in + * `VerifyNotificationChannel` to verify the channel. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   notificationChannelServiceClient.sendNotificationChannelVerificationCode(name.toString());
+   * }
+   * 
+ * + * @param name The notification channel to which to send a verification code. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void sendNotificationChannelVerificationCode(String name) { + + SendNotificationChannelVerificationCodeRequest request = + SendNotificationChannelVerificationCodeRequest.newBuilder().setName(name).build(); + sendNotificationChannelVerificationCode(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Causes a verification code to be delivered to the channel. The code can then be supplied in + * `VerifyNotificationChannel` to verify the channel. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   SendNotificationChannelVerificationCodeRequest request = SendNotificationChannelVerificationCodeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   notificationChannelServiceClient.sendNotificationChannelVerificationCode(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 sendNotificationChannelVerificationCode( + SendNotificationChannelVerificationCodeRequest request) { + sendNotificationChannelVerificationCodeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Causes a verification code to be delivered to the channel. The code can then be supplied in + * `VerifyNotificationChannel` to verify the channel. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   SendNotificationChannelVerificationCodeRequest request = SendNotificationChannelVerificationCodeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = notificationChannelServiceClient.sendNotificationChannelVerificationCodeCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + sendNotificationChannelVerificationCodeCallable() { + return stub.sendNotificationChannelVerificationCodeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Requests a verification code for an already verified channel that can then be used in a call to + * VerifyNotificationChannel() on a different channel with an equivalent identity in the same or + * in a different project. This makes it possible to copy a channel between projects without + * requiring manual reverification of the channel. If the channel is not in the verified state, + * this method will fail (in other words, this may only be used if the + * SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been + * used to put the given channel into the verified state). + * + *

There is no guarantee that the verification codes returned by this method will be of a + * similar structure or form as the ones that are delivered to the channel via + * SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both + * the codes delivered via SendNotificationChannelVerificationCode() and returned from + * GetNotificationChannelVerificationCode(), it is typically the case that the verification codes + * delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter + * expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return + * a much longer, websafe base 64 encoded string that has a longer expiration time. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(name);
+   * }
+   * 
+ * + * @param name The notification channel for which a verification code is to be generated and + * retrieved. This must name a channel that is already verified; if the specified channel is + * not verified, the request will fail. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final GetNotificationChannelVerificationCodeResponse + getNotificationChannelVerificationCode(NotificationChannelName name) { + + GetNotificationChannelVerificationCodeRequest request = + GetNotificationChannelVerificationCodeRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getNotificationChannelVerificationCode(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Requests a verification code for an already verified channel that can then be used in a call to + * VerifyNotificationChannel() on a different channel with an equivalent identity in the same or + * in a different project. This makes it possible to copy a channel between projects without + * requiring manual reverification of the channel. If the channel is not in the verified state, + * this method will fail (in other words, this may only be used if the + * SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been + * used to put the given channel into the verified state). + * + *

There is no guarantee that the verification codes returned by this method will be of a + * similar structure or form as the ones that are delivered to the channel via + * SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both + * the codes delivered via SendNotificationChannelVerificationCode() and returned from + * GetNotificationChannelVerificationCode(), it is typically the case that the verification codes + * delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter + * expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return + * a much longer, websafe base 64 encoded string that has a longer expiration time. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(name.toString());
+   * }
+   * 
+ * + * @param name The notification channel for which a verification code is to be generated and + * retrieved. This must name a channel that is already verified; if the specified channel is + * not verified, the request will fail. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final GetNotificationChannelVerificationCodeResponse + getNotificationChannelVerificationCode(String name) { + + GetNotificationChannelVerificationCodeRequest request = + GetNotificationChannelVerificationCodeRequest.newBuilder().setName(name).build(); + return getNotificationChannelVerificationCode(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Requests a verification code for an already verified channel that can then be used in a call to + * VerifyNotificationChannel() on a different channel with an equivalent identity in the same or + * in a different project. This makes it possible to copy a channel between projects without + * requiring manual reverification of the channel. If the channel is not in the verified state, + * this method will fail (in other words, this may only be used if the + * SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been + * used to put the given channel into the verified state). + * + *

There is no guarantee that the verification codes returned by this method will be of a + * similar structure or form as the ones that are delivered to the channel via + * SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both + * the codes delivered via SendNotificationChannelVerificationCode() and returned from + * GetNotificationChannelVerificationCode(), it is typically the case that the verification codes + * delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter + * expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return + * a much longer, websafe base 64 encoded string that has a longer expiration time. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   GetNotificationChannelVerificationCodeRequest request = GetNotificationChannelVerificationCodeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   GetNotificationChannelVerificationCodeResponse response = notificationChannelServiceClient.getNotificationChannelVerificationCode(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 GetNotificationChannelVerificationCodeResponse + getNotificationChannelVerificationCode( + GetNotificationChannelVerificationCodeRequest request) { + return getNotificationChannelVerificationCodeCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Requests a verification code for an already verified channel that can then be used in a call to + * VerifyNotificationChannel() on a different channel with an equivalent identity in the same or + * in a different project. This makes it possible to copy a channel between projects without + * requiring manual reverification of the channel. If the channel is not in the verified state, + * this method will fail (in other words, this may only be used if the + * SendNotificationChannelVerificationCode and VerifyNotificationChannel paths have already been + * used to put the given channel into the verified state). + * + *

There is no guarantee that the verification codes returned by this method will be of a + * similar structure or form as the ones that are delivered to the channel via + * SendNotificationChannelVerificationCode; while VerifyNotificationChannel() will recognize both + * the codes delivered via SendNotificationChannelVerificationCode() and returned from + * GetNotificationChannelVerificationCode(), it is typically the case that the verification codes + * delivered via SendNotificationChannelVerificationCode() will be shorter and also have a shorter + * expiration (e.g. codes such as "G-123456") whereas GetVerificationCode() will typically return + * a much longer, websafe base 64 encoded string that has a longer expiration time. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   GetNotificationChannelVerificationCodeRequest request = GetNotificationChannelVerificationCodeRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<GetNotificationChannelVerificationCodeResponse> future = notificationChannelServiceClient.getNotificationChannelVerificationCodeCallable().futureCall(request);
+   *   // Do something
+   *   GetNotificationChannelVerificationCodeResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeCallable() { + return stub.getNotificationChannelVerificationCodeCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a + * result of calling `SendNotificationChannelVerificationCode`. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   String code = "";
+   *   NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(name, code);
+   * }
+   * 
+ * + * @param name The notification channel to verify. + * @param code The verification code that was delivered to the channel as a result of invoking the + * `SendNotificationChannelVerificationCode` API method or that was retrieved from a verified + * channel via `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only guaranteed that the code + * is valid UTF-8; one should not make any assumptions regarding the structure or format of + * the code). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannel verifyNotificationChannel( + NotificationChannelName name, String code) { + + VerifyNotificationChannelRequest request = + VerifyNotificationChannelRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setCode(code) + .build(); + return verifyNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a + * result of calling `SendNotificationChannelVerificationCode`. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   String code = "";
+   *   NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(name.toString(), code);
+   * }
+   * 
+ * + * @param name The notification channel to verify. + * @param code The verification code that was delivered to the channel as a result of invoking the + * `SendNotificationChannelVerificationCode` API method or that was retrieved from a verified + * channel via `GetNotificationChannelVerificationCode`. For example, one might have + * "G-123456" or "TKNZGhhd2EyN3I1MnRnMjRv" (in general, one is only guaranteed that the code + * is valid UTF-8; one should not make any assumptions regarding the structure or format of + * the code). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final NotificationChannel verifyNotificationChannel(String name, String code) { + + VerifyNotificationChannelRequest request = + VerifyNotificationChannelRequest.newBuilder().setName(name).setCode(code).build(); + return verifyNotificationChannel(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a + * result of calling `SendNotificationChannelVerificationCode`. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   String code = "";
+   *   VerifyNotificationChannelRequest request = VerifyNotificationChannelRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setCode(code)
+   *     .build();
+   *   NotificationChannel response = notificationChannelServiceClient.verifyNotificationChannel(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 NotificationChannel verifyNotificationChannel( + VerifyNotificationChannelRequest request) { + return verifyNotificationChannelCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Verifies a `NotificationChannel` by proving receipt of the code delivered to the channel as a + * result of calling `SendNotificationChannelVerificationCode`. + * + *

Sample code: + * + *


+   * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+   *   NotificationChannelName name = NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]");
+   *   String code = "";
+   *   VerifyNotificationChannelRequest request = VerifyNotificationChannelRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setCode(code)
+   *     .build();
+   *   ApiFuture<NotificationChannel> future = notificationChannelServiceClient.verifyNotificationChannelCallable().futureCall(request);
+   *   // Do something
+   *   NotificationChannel response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + verifyNotificationChannelCallable() { + return stub.verifyNotificationChannelCallable(); + } + + @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 ListNotificationChannelDescriptorsPagedResponse + extends AbstractPagedListResponse< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor, + ListNotificationChannelDescriptorsPage, + ListNotificationChannelDescriptorsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListNotificationChannelDescriptorsPage.createEmptyPage() + .createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction< + ListNotificationChannelDescriptorsPage, + ListNotificationChannelDescriptorsPagedResponse>() { + @Override + public ListNotificationChannelDescriptorsPagedResponse apply( + ListNotificationChannelDescriptorsPage input) { + return new ListNotificationChannelDescriptorsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListNotificationChannelDescriptorsPagedResponse( + ListNotificationChannelDescriptorsPage page) { + super(page, ListNotificationChannelDescriptorsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListNotificationChannelDescriptorsPage + extends AbstractPage< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor, + ListNotificationChannelDescriptorsPage> { + + private ListNotificationChannelDescriptorsPage( + PageContext< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor> + context, + ListNotificationChannelDescriptorsResponse response) { + super(context, response); + } + + private static ListNotificationChannelDescriptorsPage createEmptyPage() { + return new ListNotificationChannelDescriptorsPage(null, null); + } + + @Override + protected ListNotificationChannelDescriptorsPage createPage( + PageContext< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor> + context, + ListNotificationChannelDescriptorsResponse response) { + return new ListNotificationChannelDescriptorsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListNotificationChannelDescriptorsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor, + ListNotificationChannelDescriptorsPage, + ListNotificationChannelDescriptorsFixedSizeCollection> { + + private ListNotificationChannelDescriptorsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListNotificationChannelDescriptorsFixedSizeCollection createEmptyCollection() { + return new ListNotificationChannelDescriptorsFixedSizeCollection(null, 0); + } + + @Override + protected ListNotificationChannelDescriptorsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListNotificationChannelDescriptorsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListNotificationChannelsPagedResponse + extends AbstractPagedListResponse< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel, + ListNotificationChannelsPage, + ListNotificationChannelsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListNotificationChannelsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListNotificationChannelsPagedResponse apply(ListNotificationChannelsPage input) { + return new ListNotificationChannelsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListNotificationChannelsPagedResponse(ListNotificationChannelsPage page) { + super(page, ListNotificationChannelsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListNotificationChannelsPage + extends AbstractPage< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel, + ListNotificationChannelsPage> { + + private ListNotificationChannelsPage( + PageContext< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel> + context, + ListNotificationChannelsResponse response) { + super(context, response); + } + + private static ListNotificationChannelsPage createEmptyPage() { + return new ListNotificationChannelsPage(null, null); + } + + @Override + protected ListNotificationChannelsPage createPage( + PageContext< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel> + context, + ListNotificationChannelsResponse response) { + return new ListNotificationChannelsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListNotificationChannelsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel, + ListNotificationChannelsPage, + ListNotificationChannelsFixedSizeCollection> { + + private ListNotificationChannelsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListNotificationChannelsFixedSizeCollection createEmptyCollection() { + return new ListNotificationChannelsFixedSizeCollection(null, 0); + } + + @Override + protected ListNotificationChannelsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListNotificationChannelsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceSettings.java b/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceSettings.java new file mode 100644 index 00000000..d1a3645b --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceSettings.java @@ -0,0 +1,345 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.monitoring.v3.stub.NotificationChannelServiceStubSettings; +import com.google.monitoring.v3.CreateNotificationChannelRequest; +import com.google.monitoring.v3.DeleteNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelDescriptorRequest; +import com.google.monitoring.v3.GetNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse; +import com.google.monitoring.v3.ListNotificationChannelsRequest; +import com.google.monitoring.v3.ListNotificationChannelsResponse; +import com.google.monitoring.v3.NotificationChannel; +import com.google.monitoring.v3.NotificationChannelDescriptor; +import com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.UpdateNotificationChannelRequest; +import com.google.monitoring.v3.VerifyNotificationChannelRequest; +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 NotificationChannelServiceClient}. + * + *

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

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

+ * 
+ * NotificationChannelServiceSettings.Builder notificationChannelServiceSettingsBuilder =
+ *     NotificationChannelServiceSettings.newBuilder();
+ * notificationChannelServiceSettingsBuilder.getNotificationChannelDescriptorSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * NotificationChannelServiceSettings notificationChannelServiceSettings = notificationChannelServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class NotificationChannelServiceSettings + extends ClientSettings { + /** Returns the object with the settings used for calls to listNotificationChannelDescriptors. */ + public PagedCallSettings< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .listNotificationChannelDescriptorsSettings(); + } + + /** Returns the object with the settings used for calls to getNotificationChannelDescriptor. */ + public UnaryCallSettings + getNotificationChannelDescriptorSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .getNotificationChannelDescriptorSettings(); + } + + /** Returns the object with the settings used for calls to listNotificationChannels. */ + public PagedCallSettings< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + ListNotificationChannelsPagedResponse> + listNotificationChannelsSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .listNotificationChannelsSettings(); + } + + /** Returns the object with the settings used for calls to getNotificationChannel. */ + public UnaryCallSettings + getNotificationChannelSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .getNotificationChannelSettings(); + } + + /** Returns the object with the settings used for calls to createNotificationChannel. */ + public UnaryCallSettings + createNotificationChannelSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .createNotificationChannelSettings(); + } + + /** Returns the object with the settings used for calls to updateNotificationChannel. */ + public UnaryCallSettings + updateNotificationChannelSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .updateNotificationChannelSettings(); + } + + /** Returns the object with the settings used for calls to deleteNotificationChannel. */ + public UnaryCallSettings + deleteNotificationChannelSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .deleteNotificationChannelSettings(); + } + + /** + * Returns the object with the settings used for calls to sendNotificationChannelVerificationCode. + */ + public UnaryCallSettings + sendNotificationChannelVerificationCodeSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .sendNotificationChannelVerificationCodeSettings(); + } + + /** + * Returns the object with the settings used for calls to getNotificationChannelVerificationCode. + */ + public UnaryCallSettings< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .getNotificationChannelVerificationCodeSettings(); + } + + /** Returns the object with the settings used for calls to verifyNotificationChannel. */ + public UnaryCallSettings + verifyNotificationChannelSettings() { + return ((NotificationChannelServiceStubSettings) getStubSettings()) + .verifyNotificationChannelSettings(); + } + + public static final NotificationChannelServiceSettings create( + NotificationChannelServiceStubSettings stub) throws IOException { + return new NotificationChannelServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return NotificationChannelServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return NotificationChannelServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return NotificationChannelServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return NotificationChannelServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return NotificationChannelServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return NotificationChannelServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return NotificationChannelServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected NotificationChannelServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for NotificationChannelServiceSettings. */ + public static class Builder + extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(NotificationChannelServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(NotificationChannelServiceStubSettings.newBuilder()); + } + + protected Builder(NotificationChannelServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(NotificationChannelServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public NotificationChannelServiceStubSettings.Builder getStubSettingsBuilder() { + return ((NotificationChannelServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** + * Returns the builder for the settings used for calls to listNotificationChannelDescriptors. + */ + public PagedCallSettings.Builder< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsSettings() { + return getStubSettingsBuilder().listNotificationChannelDescriptorsSettings(); + } + + /** Returns the builder for the settings used for calls to getNotificationChannelDescriptor. */ + public UnaryCallSettings.Builder< + GetNotificationChannelDescriptorRequest, NotificationChannelDescriptor> + getNotificationChannelDescriptorSettings() { + return getStubSettingsBuilder().getNotificationChannelDescriptorSettings(); + } + + /** Returns the builder for the settings used for calls to listNotificationChannels. */ + public PagedCallSettings.Builder< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + ListNotificationChannelsPagedResponse> + listNotificationChannelsSettings() { + return getStubSettingsBuilder().listNotificationChannelsSettings(); + } + + /** Returns the builder for the settings used for calls to getNotificationChannel. */ + public UnaryCallSettings.Builder + getNotificationChannelSettings() { + return getStubSettingsBuilder().getNotificationChannelSettings(); + } + + /** Returns the builder for the settings used for calls to createNotificationChannel. */ + public UnaryCallSettings.Builder + createNotificationChannelSettings() { + return getStubSettingsBuilder().createNotificationChannelSettings(); + } + + /** Returns the builder for the settings used for calls to updateNotificationChannel. */ + public UnaryCallSettings.Builder + updateNotificationChannelSettings() { + return getStubSettingsBuilder().updateNotificationChannelSettings(); + } + + /** Returns the builder for the settings used for calls to deleteNotificationChannel. */ + public UnaryCallSettings.Builder + deleteNotificationChannelSettings() { + return getStubSettingsBuilder().deleteNotificationChannelSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * sendNotificationChannelVerificationCode. + */ + public UnaryCallSettings.Builder + sendNotificationChannelVerificationCodeSettings() { + return getStubSettingsBuilder().sendNotificationChannelVerificationCodeSettings(); + } + + /** + * Returns the builder for the settings used for calls to + * getNotificationChannelVerificationCode. + */ + public UnaryCallSettings.Builder< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeSettings() { + return getStubSettingsBuilder().getNotificationChannelVerificationCodeSettings(); + } + + /** Returns the builder for the settings used for calls to verifyNotificationChannel. */ + public UnaryCallSettings.Builder + verifyNotificationChannelSettings() { + return getStubSettingsBuilder().verifyNotificationChannelSettings(); + } + + @Override + public NotificationChannelServiceSettings build() throws IOException { + return new NotificationChannelServiceSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/UptimeCheckServiceClient.java b/src/main/java/com/google/cloud/monitoring/v3/UptimeCheckServiceClient.java new file mode 100644 index 00000000..2116acdd --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/UptimeCheckServiceClient.java @@ -0,0 +1,928 @@ +/* + * 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.monitoring.v3; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.monitoring.v3.stub.UptimeCheckServiceStub; +import com.google.cloud.monitoring.v3.stub.UptimeCheckServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.monitoring.v3.CreateUptimeCheckConfigRequest; +import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest; +import com.google.monitoring.v3.GetUptimeCheckConfigRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsResponse; +import com.google.monitoring.v3.ListUptimeCheckIpsRequest; +import com.google.monitoring.v3.ListUptimeCheckIpsResponse; +import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest; +import com.google.monitoring.v3.UptimeCheckConfig; +import com.google.monitoring.v3.UptimeCheckConfigName; +import com.google.monitoring.v3.UptimeCheckIp; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: The UptimeCheckService API is used to manage (list, create, delete, edit) + * Uptime check configurations in the Stackdriver Monitoring product. An Uptime check is a piece of + * configuration that determines which resources and services to monitor for availability. These + * configurations can also be configured interactively by navigating to the [Cloud Console] + * (http://console.cloud.google.com), selecting the appropriate project, clicking on "Monitoring" on + * the left-hand side to navigate to Stackdriver, and then clicking on "Uptime". + * + *

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: + * + *

+ * 
+ * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+ *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+ *   UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
+ * }
+ * 
+ * 
+ * + *

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

To customize credentials: + * + *

+ * 
+ * UptimeCheckServiceSettings uptimeCheckServiceSettings =
+ *     UptimeCheckServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * UptimeCheckServiceClient uptimeCheckServiceClient =
+ *     UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * UptimeCheckServiceSettings uptimeCheckServiceSettings =
+ *     UptimeCheckServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * UptimeCheckServiceClient uptimeCheckServiceClient =
+ *     UptimeCheckServiceClient.create(uptimeCheckServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class UptimeCheckServiceClient implements BackgroundResource { + private final UptimeCheckServiceSettings settings; + private final UptimeCheckServiceStub stub; + + /** Constructs an instance of UptimeCheckServiceClient with default settings. */ + public static final UptimeCheckServiceClient create() throws IOException { + return create(UptimeCheckServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of UptimeCheckServiceClient, 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 UptimeCheckServiceClient create(UptimeCheckServiceSettings settings) + throws IOException { + return new UptimeCheckServiceClient(settings); + } + + /** + * Constructs an instance of UptimeCheckServiceClient, using the given stub for making calls. This + * is for advanced usage - prefer to use UptimeCheckServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final UptimeCheckServiceClient create(UptimeCheckServiceStub stub) { + return new UptimeCheckServiceClient(stub); + } + + /** + * Constructs an instance of UptimeCheckServiceClient, 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 UptimeCheckServiceClient(UptimeCheckServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((UptimeCheckServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected UptimeCheckServiceClient(UptimeCheckServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final UptimeCheckServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public UptimeCheckServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing valid Uptime check configurations for the project (leaving out any invalid + * configurations). + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   String formattedParent = ProjectName.format("[PROJECT]");
+   *   for (UptimeCheckConfig element : uptimeCheckServiceClient.listUptimeCheckConfigs(formattedParent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent The project whose Uptime check configurations are listed. The format is + * `projects/[PROJECT_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs(String parent) { + ListUptimeCheckConfigsRequest request = + ListUptimeCheckConfigsRequest.newBuilder().setParent(parent).build(); + return listUptimeCheckConfigs(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing valid Uptime check configurations for the project (leaving out any invalid + * configurations). + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   String formattedParent = ProjectName.format("[PROJECT]");
+   *   ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .build();
+   *   for (UptimeCheckConfig element : uptimeCheckServiceClient.listUptimeCheckConfigs(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 ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs( + ListUptimeCheckConfigsRequest request) { + return listUptimeCheckConfigsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing valid Uptime check configurations for the project (leaving out any invalid + * configurations). + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   String formattedParent = ProjectName.format("[PROJECT]");
+   *   ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .build();
+   *   ApiFuture<ListUptimeCheckConfigsPagedResponse> future = uptimeCheckServiceClient.listUptimeCheckConfigsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (UptimeCheckConfig element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listUptimeCheckConfigsPagedCallable() { + return stub.listUptimeCheckConfigsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the existing valid Uptime check configurations for the project (leaving out any invalid + * configurations). + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   String formattedParent = ProjectName.format("[PROJECT]");
+   *   ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .build();
+   *   while (true) {
+   *     ListUptimeCheckConfigsResponse response = uptimeCheckServiceClient.listUptimeCheckConfigsCallable().call(request);
+   *     for (UptimeCheckConfig element : response.getUptimeCheckConfigsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listUptimeCheckConfigsCallable() { + return stub.listUptimeCheckConfigsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single Uptime check configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+   *   UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
+   * }
+   * 
+ * + * @param name The Uptime check configuration to retrieve. The format is + * `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final UptimeCheckConfig getUptimeCheckConfig(UptimeCheckConfigName name) { + + GetUptimeCheckConfigRequest request = + GetUptimeCheckConfigRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getUptimeCheckConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single Uptime check configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+   *   UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name.toString());
+   * }
+   * 
+ * + * @param name The Uptime check configuration to retrieve. The format is + * `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final UptimeCheckConfig getUptimeCheckConfig(String name) { + + GetUptimeCheckConfigRequest request = + GetUptimeCheckConfigRequest.newBuilder().setName(name).build(); + return getUptimeCheckConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single Uptime check configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+   *   GetUptimeCheckConfigRequest request = GetUptimeCheckConfigRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(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 UptimeCheckConfig getUptimeCheckConfig(GetUptimeCheckConfigRequest request) { + return getUptimeCheckConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets a single Uptime check configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+   *   GetUptimeCheckConfigRequest request = GetUptimeCheckConfigRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.getUptimeCheckConfigCallable().futureCall(request);
+   *   // Do something
+   *   UptimeCheckConfig response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + getUptimeCheckConfigCallable() { + return stub.getUptimeCheckConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new Uptime check configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   String formattedParent = ProjectName.format("[PROJECT]");
+   *   UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
+   *   UptimeCheckConfig response = uptimeCheckServiceClient.createUptimeCheckConfig(formattedParent, uptimeCheckConfig);
+   * }
+   * 
+ * + * @param parent The project in which to create the Uptime check. The format is + * `projects/[PROJECT_ID]`. + * @param uptimeCheckConfig The new Uptime check configuration. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final UptimeCheckConfig createUptimeCheckConfig( + String parent, UptimeCheckConfig uptimeCheckConfig) { + + CreateUptimeCheckConfigRequest request = + CreateUptimeCheckConfigRequest.newBuilder() + .setParent(parent) + .setUptimeCheckConfig(uptimeCheckConfig) + .build(); + return createUptimeCheckConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new Uptime check configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   String formattedParent = ProjectName.format("[PROJECT]");
+   *   UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
+   *   CreateUptimeCheckConfigRequest request = CreateUptimeCheckConfigRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .setUptimeCheckConfig(uptimeCheckConfig)
+   *     .build();
+   *   UptimeCheckConfig response = uptimeCheckServiceClient.createUptimeCheckConfig(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 UptimeCheckConfig createUptimeCheckConfig(CreateUptimeCheckConfigRequest request) { + return createUptimeCheckConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new Uptime check configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   String formattedParent = ProjectName.format("[PROJECT]");
+   *   UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
+   *   CreateUptimeCheckConfigRequest request = CreateUptimeCheckConfigRequest.newBuilder()
+   *     .setParent(formattedParent)
+   *     .setUptimeCheckConfig(uptimeCheckConfig)
+   *     .build();
+   *   ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.createUptimeCheckConfigCallable().futureCall(request);
+   *   // Do something
+   *   UptimeCheckConfig response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + createUptimeCheckConfigCallable() { + return stub.createUptimeCheckConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an Uptime check configuration. You can either replace the entire configuration with a + * new one or replace only certain fields in the current configuration by specifying the fields to + * be updated via `updateMask`. Returns the updated configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
+   *   UptimeCheckConfig response = uptimeCheckServiceClient.updateUptimeCheckConfig(uptimeCheckConfig);
+   * }
+   * 
+ * + * @param uptimeCheckConfig Required. If an `updateMask` has been specified, this field gives the + * values for the set of fields mentioned in the `updateMask`. If an `updateMask` has not been + * given, this Uptime check configuration replaces the current configuration. If a field is + * mentioned in `updateMask` but the corresonding field is omitted in this partial Uptime + * check configuration, it has the effect of deleting/clearing the field from the + * configuration on the server. + *

The following fields can be updated: `display_name`, `http_check`, `tcp_check`, + * `timeout`, `content_matchers`, and `selected_regions`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final UptimeCheckConfig updateUptimeCheckConfig(UptimeCheckConfig uptimeCheckConfig) { + + UpdateUptimeCheckConfigRequest request = + UpdateUptimeCheckConfigRequest.newBuilder().setUptimeCheckConfig(uptimeCheckConfig).build(); + return updateUptimeCheckConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an Uptime check configuration. You can either replace the entire configuration with a + * new one or replace only certain fields in the current configuration by specifying the fields to + * be updated via `updateMask`. Returns the updated configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
+   *   UpdateUptimeCheckConfigRequest request = UpdateUptimeCheckConfigRequest.newBuilder()
+   *     .setUptimeCheckConfig(uptimeCheckConfig)
+   *     .build();
+   *   UptimeCheckConfig response = uptimeCheckServiceClient.updateUptimeCheckConfig(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 UptimeCheckConfig updateUptimeCheckConfig(UpdateUptimeCheckConfigRequest request) { + return updateUptimeCheckConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates an Uptime check configuration. You can either replace the entire configuration with a + * new one or replace only certain fields in the current configuration by specifying the fields to + * be updated via `updateMask`. Returns the updated configuration. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build();
+   *   UpdateUptimeCheckConfigRequest request = UpdateUptimeCheckConfigRequest.newBuilder()
+   *     .setUptimeCheckConfig(uptimeCheckConfig)
+   *     .build();
+   *   ApiFuture<UptimeCheckConfig> future = uptimeCheckServiceClient.updateUptimeCheckConfigCallable().futureCall(request);
+   *   // Do something
+   *   UptimeCheckConfig response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + updateUptimeCheckConfigCallable() { + return stub.updateUptimeCheckConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check + * configuration is referenced by an alert policy or other dependent configs that would be + * rendered invalid by the deletion. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+   *   uptimeCheckServiceClient.deleteUptimeCheckConfig(name);
+   * }
+   * 
+ * + * @param name The Uptime check configuration to delete. The format is + * `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteUptimeCheckConfig(UptimeCheckConfigName name) { + + DeleteUptimeCheckConfigRequest request = + DeleteUptimeCheckConfigRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + deleteUptimeCheckConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check + * configuration is referenced by an alert policy or other dependent configs that would be + * rendered invalid by the deletion. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+   *   uptimeCheckServiceClient.deleteUptimeCheckConfig(name.toString());
+   * }
+   * 
+ * + * @param name The Uptime check configuration to delete. The format is + * `projects/[PROJECT_ID]/uptimeCheckConfigs/[UPTIME_CHECK_ID]`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final void deleteUptimeCheckConfig(String name) { + + DeleteUptimeCheckConfigRequest request = + DeleteUptimeCheckConfigRequest.newBuilder().setName(name).build(); + deleteUptimeCheckConfig(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check + * configuration is referenced by an alert policy or other dependent configs that would be + * rendered invalid by the deletion. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+   *   DeleteUptimeCheckConfigRequest request = DeleteUptimeCheckConfigRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   uptimeCheckServiceClient.deleteUptimeCheckConfig(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 deleteUptimeCheckConfig(DeleteUptimeCheckConfigRequest request) { + deleteUptimeCheckConfigCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes an Uptime check configuration. Note that this method will fail if the Uptime check + * configuration is referenced by an alert policy or other dependent configs that would be + * rendered invalid by the deletion. + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+   *   DeleteUptimeCheckConfigRequest request = DeleteUptimeCheckConfigRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = uptimeCheckServiceClient.deleteUptimeCheckConfigCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + deleteUptimeCheckConfigCallable() { + return stub.deleteUptimeCheckConfigCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the list of IP addresses that checkers run from + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
+   *   for (UptimeCheckIp element : uptimeCheckServiceClient.listUptimeCheckIps(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 ListUptimeCheckIpsPagedResponse listUptimeCheckIps( + ListUptimeCheckIpsRequest request) { + return listUptimeCheckIpsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the list of IP addresses that checkers run from + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
+   *   ApiFuture<ListUptimeCheckIpsPagedResponse> future = uptimeCheckServiceClient.listUptimeCheckIpsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (UptimeCheckIp element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listUptimeCheckIpsPagedCallable() { + return stub.listUptimeCheckIpsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the list of IP addresses that checkers run from + * + *

Sample code: + * + *


+   * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+   *   ListUptimeCheckIpsRequest request = ListUptimeCheckIpsRequest.newBuilder().build();
+   *   while (true) {
+   *     ListUptimeCheckIpsResponse response = uptimeCheckServiceClient.listUptimeCheckIpsCallable().call(request);
+   *     for (UptimeCheckIp element : response.getUptimeCheckIpsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listUptimeCheckIpsCallable() { + return stub.listUptimeCheckIpsCallable(); + } + + @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 ListUptimeCheckConfigsPagedResponse + extends AbstractPagedListResponse< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + UptimeCheckConfig, + ListUptimeCheckConfigsPage, + ListUptimeCheckConfigsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListUptimeCheckConfigsRequest, ListUptimeCheckConfigsResponse, UptimeCheckConfig> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListUptimeCheckConfigsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListUptimeCheckConfigsPagedResponse apply(ListUptimeCheckConfigsPage input) { + return new ListUptimeCheckConfigsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListUptimeCheckConfigsPagedResponse(ListUptimeCheckConfigsPage page) { + super(page, ListUptimeCheckConfigsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListUptimeCheckConfigsPage + extends AbstractPage< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + UptimeCheckConfig, + ListUptimeCheckConfigsPage> { + + private ListUptimeCheckConfigsPage( + PageContext< + ListUptimeCheckConfigsRequest, ListUptimeCheckConfigsResponse, UptimeCheckConfig> + context, + ListUptimeCheckConfigsResponse response) { + super(context, response); + } + + private static ListUptimeCheckConfigsPage createEmptyPage() { + return new ListUptimeCheckConfigsPage(null, null); + } + + @Override + protected ListUptimeCheckConfigsPage createPage( + PageContext< + ListUptimeCheckConfigsRequest, ListUptimeCheckConfigsResponse, UptimeCheckConfig> + context, + ListUptimeCheckConfigsResponse response) { + return new ListUptimeCheckConfigsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListUptimeCheckConfigsRequest, ListUptimeCheckConfigsResponse, UptimeCheckConfig> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListUptimeCheckConfigsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + UptimeCheckConfig, + ListUptimeCheckConfigsPage, + ListUptimeCheckConfigsFixedSizeCollection> { + + private ListUptimeCheckConfigsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListUptimeCheckConfigsFixedSizeCollection createEmptyCollection() { + return new ListUptimeCheckConfigsFixedSizeCollection(null, 0); + } + + @Override + protected ListUptimeCheckConfigsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListUptimeCheckConfigsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListUptimeCheckIpsPagedResponse + extends AbstractPagedListResponse< + ListUptimeCheckIpsRequest, + ListUptimeCheckIpsResponse, + UptimeCheckIp, + ListUptimeCheckIpsPage, + ListUptimeCheckIpsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListUptimeCheckIpsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListUptimeCheckIpsPagedResponse apply(ListUptimeCheckIpsPage input) { + return new ListUptimeCheckIpsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListUptimeCheckIpsPagedResponse(ListUptimeCheckIpsPage page) { + super(page, ListUptimeCheckIpsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListUptimeCheckIpsPage + extends AbstractPage< + ListUptimeCheckIpsRequest, + ListUptimeCheckIpsResponse, + UptimeCheckIp, + ListUptimeCheckIpsPage> { + + private ListUptimeCheckIpsPage( + PageContext context, + ListUptimeCheckIpsResponse response) { + super(context, response); + } + + private static ListUptimeCheckIpsPage createEmptyPage() { + return new ListUptimeCheckIpsPage(null, null); + } + + @Override + protected ListUptimeCheckIpsPage createPage( + PageContext context, + ListUptimeCheckIpsResponse response) { + return new ListUptimeCheckIpsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListUptimeCheckIpsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListUptimeCheckIpsRequest, + ListUptimeCheckIpsResponse, + UptimeCheckIp, + ListUptimeCheckIpsPage, + ListUptimeCheckIpsFixedSizeCollection> { + + private ListUptimeCheckIpsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListUptimeCheckIpsFixedSizeCollection createEmptyCollection() { + return new ListUptimeCheckIpsFixedSizeCollection(null, 0); + } + + @Override + protected ListUptimeCheckIpsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListUptimeCheckIpsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/UptimeCheckServiceSettings.java b/src/main/java/com/google/cloud/monitoring/v3/UptimeCheckServiceSettings.java new file mode 100644 index 00000000..22acba94 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/UptimeCheckServiceSettings.java @@ -0,0 +1,258 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse; +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.ClientSettings; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.cloud.monitoring.v3.stub.UptimeCheckServiceStubSettings; +import com.google.monitoring.v3.CreateUptimeCheckConfigRequest; +import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest; +import com.google.monitoring.v3.GetUptimeCheckConfigRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsResponse; +import com.google.monitoring.v3.ListUptimeCheckIpsRequest; +import com.google.monitoring.v3.ListUptimeCheckIpsResponse; +import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest; +import com.google.monitoring.v3.UptimeCheckConfig; +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 UptimeCheckServiceClient}. + * + *

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

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

+ * 
+ * UptimeCheckServiceSettings.Builder uptimeCheckServiceSettingsBuilder =
+ *     UptimeCheckServiceSettings.newBuilder();
+ * uptimeCheckServiceSettingsBuilder.getUptimeCheckConfigSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * UptimeCheckServiceSettings uptimeCheckServiceSettings = uptimeCheckServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class UptimeCheckServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listUptimeCheckConfigs. */ + public PagedCallSettings< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + ListUptimeCheckConfigsPagedResponse> + listUptimeCheckConfigsSettings() { + return ((UptimeCheckServiceStubSettings) getStubSettings()).listUptimeCheckConfigsSettings(); + } + + /** Returns the object with the settings used for calls to getUptimeCheckConfig. */ + public UnaryCallSettings + getUptimeCheckConfigSettings() { + return ((UptimeCheckServiceStubSettings) getStubSettings()).getUptimeCheckConfigSettings(); + } + + /** Returns the object with the settings used for calls to createUptimeCheckConfig. */ + public UnaryCallSettings + createUptimeCheckConfigSettings() { + return ((UptimeCheckServiceStubSettings) getStubSettings()).createUptimeCheckConfigSettings(); + } + + /** Returns the object with the settings used for calls to updateUptimeCheckConfig. */ + public UnaryCallSettings + updateUptimeCheckConfigSettings() { + return ((UptimeCheckServiceStubSettings) getStubSettings()).updateUptimeCheckConfigSettings(); + } + + /** Returns the object with the settings used for calls to deleteUptimeCheckConfig. */ + public UnaryCallSettings + deleteUptimeCheckConfigSettings() { + return ((UptimeCheckServiceStubSettings) getStubSettings()).deleteUptimeCheckConfigSettings(); + } + + /** Returns the object with the settings used for calls to listUptimeCheckIps. */ + public PagedCallSettings< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, ListUptimeCheckIpsPagedResponse> + listUptimeCheckIpsSettings() { + return ((UptimeCheckServiceStubSettings) getStubSettings()).listUptimeCheckIpsSettings(); + } + + public static final UptimeCheckServiceSettings create(UptimeCheckServiceStubSettings stub) + throws IOException { + return new UptimeCheckServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return UptimeCheckServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return UptimeCheckServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return UptimeCheckServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return UptimeCheckServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return UptimeCheckServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return UptimeCheckServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return UptimeCheckServiceStubSettings.defaultApiClientHeaderProviderBuilder(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected UptimeCheckServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for UptimeCheckServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(UptimeCheckServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(UptimeCheckServiceStubSettings.newBuilder()); + } + + protected Builder(UptimeCheckServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(UptimeCheckServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public UptimeCheckServiceStubSettings.Builder getStubSettingsBuilder() { + return ((UptimeCheckServiceStubSettings.Builder) getStubSettings()); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods( + getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); + return this; + } + + /** Returns the builder for the settings used for calls to listUptimeCheckConfigs. */ + public PagedCallSettings.Builder< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + ListUptimeCheckConfigsPagedResponse> + listUptimeCheckConfigsSettings() { + return getStubSettingsBuilder().listUptimeCheckConfigsSettings(); + } + + /** Returns the builder for the settings used for calls to getUptimeCheckConfig. */ + public UnaryCallSettings.Builder + getUptimeCheckConfigSettings() { + return getStubSettingsBuilder().getUptimeCheckConfigSettings(); + } + + /** Returns the builder for the settings used for calls to createUptimeCheckConfig. */ + public UnaryCallSettings.Builder + createUptimeCheckConfigSettings() { + return getStubSettingsBuilder().createUptimeCheckConfigSettings(); + } + + /** Returns the builder for the settings used for calls to updateUptimeCheckConfig. */ + public UnaryCallSettings.Builder + updateUptimeCheckConfigSettings() { + return getStubSettingsBuilder().updateUptimeCheckConfigSettings(); + } + + /** Returns the builder for the settings used for calls to deleteUptimeCheckConfig. */ + public UnaryCallSettings.Builder + deleteUptimeCheckConfigSettings() { + return getStubSettingsBuilder().deleteUptimeCheckConfigSettings(); + } + + /** Returns the builder for the settings used for calls to listUptimeCheckIps. */ + public PagedCallSettings.Builder< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, ListUptimeCheckIpsPagedResponse> + listUptimeCheckIpsSettings() { + return getStubSettingsBuilder().listUptimeCheckIpsSettings(); + } + + @Override + public UptimeCheckServiceSettings build() throws IOException { + return new UptimeCheckServiceSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/package-info.java b/src/main/java/com/google/cloud/monitoring/v3/package-info.java new file mode 100644 index 00000000..4c9f41ee --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/package-info.java @@ -0,0 +1,121 @@ +/* + * 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. + */ + +/** + * A client to Stackdriver Monitoring API. + * + *

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

======================== AlertPolicyServiceClient ======================== + * + *

Service Description: The AlertPolicyService API is used to manage (list, create, delete, edit) + * alert policies in Stackdriver Monitoring. An alerting policy is a description of the conditions + * under which some aspect of your system is considered to be "unhealthy" and the ways to notify + * people or services about this state. In addition to using this API, alert policies can also be + * managed through [Stackdriver Monitoring](https://cloud.google.com/monitoring/docs/), which can be + * reached by clicking the "Monitoring" tab in [Cloud Console](https://console.cloud.google.com/). + * + *

Sample for AlertPolicyServiceClient: + * + *

+ * 
+ * try (AlertPolicyServiceClient alertPolicyServiceClient = AlertPolicyServiceClient.create()) {
+ *   AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]");
+ *   AlertPolicy response = alertPolicyServiceClient.getAlertPolicy(name);
+ * }
+ * 
+ * 
+ * + * ================== GroupServiceClient ================== + * + *

Service Description: The Group API lets you inspect and manage your + * [groups](#google.monitoring.v3.Group). + * + *

A group is a named filter that is used to identify a collection of monitored resources. Groups + * are typically used to mirror the physical and/or logical topology of the environment. Because + * group membership is computed dynamically, monitored resources that are started in the future are + * automatically placed in matching groups. By using a group to name monitored resources in, for + * example, an alert policy, the target of that alert policy is updated automatically as monitored + * resources are added and removed from the infrastructure. + * + *

Sample for GroupServiceClient: + * + *

+ * 
+ * try (GroupServiceClient groupServiceClient = GroupServiceClient.create()) {
+ *   GroupName name = GroupName.of("[PROJECT]", "[GROUP]");
+ *   Group response = groupServiceClient.getGroup(name);
+ * }
+ * 
+ * 
+ * + * =================== MetricServiceClient =================== + * + *

Service Description: Manages metric descriptors, monitored resource descriptors, and time + * series data. + * + *

Sample for MetricServiceClient: + * + *

+ * 
+ * try (MetricServiceClient metricServiceClient = MetricServiceClient.create()) {
+ *   MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
+ *   MonitoredResourceDescriptor response = metricServiceClient.getMonitoredResourceDescriptor(name);
+ * }
+ * 
+ * 
+ * + * ================================ NotificationChannelServiceClient + * ================================ + * + *

Service Description: The Notification Channel API provides access to configuration that + * controls how messages related to incidents are sent. + * + *

Sample for NotificationChannelServiceClient: + * + *

+ * 
+ * try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) {
+ *   NotificationChannelDescriptorName name = NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
+ *   NotificationChannelDescriptor response = notificationChannelServiceClient.getNotificationChannelDescriptor(name);
+ * }
+ * 
+ * 
+ * + * ======================== UptimeCheckServiceClient ======================== + * + *

Service Description: The UptimeCheckService API is used to manage (list, create, delete, edit) + * Uptime check configurations in the Stackdriver Monitoring product. An Uptime check is a piece of + * configuration that determines which resources and services to monitor for availability. These + * configurations can also be configured interactively by navigating to the [Cloud Console] + * (http://console.cloud.google.com), selecting the appropriate project, clicking on "Monitoring" on + * the left-hand side to navigate to Stackdriver, and then clicking on "Uptime". + * + *

Sample for UptimeCheckServiceClient: + * + *

+ * 
+ * try (UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.create()) {
+ *   UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]");
+ *   UptimeCheckConfig response = uptimeCheckServiceClient.getUptimeCheckConfig(name);
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.monitoring.v3; + +import javax.annotation.Generated; diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStub.java new file mode 100644 index 00000000..8af23ae2 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStub.java @@ -0,0 +1,71 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.AlertPolicyServiceClient.ListAlertPoliciesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.monitoring.v3.AlertPolicy; +import com.google.monitoring.v3.CreateAlertPolicyRequest; +import com.google.monitoring.v3.DeleteAlertPolicyRequest; +import com.google.monitoring.v3.GetAlertPolicyRequest; +import com.google.monitoring.v3.ListAlertPoliciesRequest; +import com.google.monitoring.v3.ListAlertPoliciesResponse; +import com.google.monitoring.v3.UpdateAlertPolicyRequest; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class AlertPolicyServiceStub implements BackgroundResource { + + public UnaryCallable + listAlertPoliciesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listAlertPoliciesPagedCallable()"); + } + + public UnaryCallable + listAlertPoliciesCallable() { + throw new UnsupportedOperationException("Not implemented: listAlertPoliciesCallable()"); + } + + public UnaryCallable getAlertPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getAlertPolicyCallable()"); + } + + public UnaryCallable createAlertPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: createAlertPolicyCallable()"); + } + + public UnaryCallable deleteAlertPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: deleteAlertPolicyCallable()"); + } + + public UnaryCallable updateAlertPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: updateAlertPolicyCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStubSettings.java b/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStubSettings.java new file mode 100644 index 00000000..6a2e2cf0 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/AlertPolicyServiceStubSettings.java @@ -0,0 +1,455 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.AlertPolicyServiceClient.ListAlertPoliciesPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.AlertPolicy; +import com.google.monitoring.v3.CreateAlertPolicyRequest; +import com.google.monitoring.v3.DeleteAlertPolicyRequest; +import com.google.monitoring.v3.GetAlertPolicyRequest; +import com.google.monitoring.v3.ListAlertPoliciesRequest; +import com.google.monitoring.v3.ListAlertPoliciesResponse; +import com.google.monitoring.v3.UpdateAlertPolicyRequest; +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 AlertPolicyServiceStub}. + * + *

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

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

+ * 
+ * AlertPolicyServiceStubSettings.Builder alertPolicyServiceSettingsBuilder =
+ *     AlertPolicyServiceStubSettings.newBuilder();
+ * alertPolicyServiceSettingsBuilder.getAlertPolicySettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * AlertPolicyServiceStubSettings alertPolicyServiceSettings = alertPolicyServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class AlertPolicyServiceStubSettings 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/monitoring") + .add("https://www.googleapis.com/auth/monitoring.read") + .add("https://www.googleapis.com/auth/monitoring.write") + .build(); + + private final PagedCallSettings< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse> + listAlertPoliciesSettings; + private final UnaryCallSettings getAlertPolicySettings; + private final UnaryCallSettings createAlertPolicySettings; + private final UnaryCallSettings deleteAlertPolicySettings; + private final UnaryCallSettings updateAlertPolicySettings; + + /** Returns the object with the settings used for calls to listAlertPolicies. */ + public PagedCallSettings< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse> + listAlertPoliciesSettings() { + return listAlertPoliciesSettings; + } + + /** Returns the object with the settings used for calls to getAlertPolicy. */ + public UnaryCallSettings getAlertPolicySettings() { + return getAlertPolicySettings; + } + + /** Returns the object with the settings used for calls to createAlertPolicy. */ + public UnaryCallSettings createAlertPolicySettings() { + return createAlertPolicySettings; + } + + /** Returns the object with the settings used for calls to deleteAlertPolicy. */ + public UnaryCallSettings deleteAlertPolicySettings() { + return deleteAlertPolicySettings; + } + + /** Returns the object with the settings used for calls to updateAlertPolicy. */ + public UnaryCallSettings updateAlertPolicySettings() { + return updateAlertPolicySettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public AlertPolicyServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcAlertPolicyServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + 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 "monitoring.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(AlertPolicyServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected AlertPolicyServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listAlertPoliciesSettings = settingsBuilder.listAlertPoliciesSettings().build(); + getAlertPolicySettings = settingsBuilder.getAlertPolicySettings().build(); + createAlertPolicySettings = settingsBuilder.createAlertPolicySettings().build(); + deleteAlertPolicySettings = settingsBuilder.deleteAlertPolicySettings().build(); + updateAlertPolicySettings = settingsBuilder.updateAlertPolicySettings().build(); + } + + private static final PagedListDescriptor< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, AlertPolicy> + LIST_ALERT_POLICIES_PAGE_STR_DESC = + new PagedListDescriptor< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, AlertPolicy>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListAlertPoliciesRequest injectToken( + ListAlertPoliciesRequest payload, String token) { + return ListAlertPoliciesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListAlertPoliciesRequest injectPageSize( + ListAlertPoliciesRequest payload, int pageSize) { + return ListAlertPoliciesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListAlertPoliciesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListAlertPoliciesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListAlertPoliciesResponse payload) { + return payload.getAlertPoliciesList() != null + ? payload.getAlertPoliciesList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse> + LIST_ALERT_POLICIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListAlertPoliciesRequest, + ListAlertPoliciesResponse, + ListAlertPoliciesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListAlertPoliciesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_ALERT_POLICIES_PAGE_STR_DESC, request, context); + return ListAlertPoliciesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for AlertPolicyServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse> + listAlertPoliciesSettings; + private final UnaryCallSettings.Builder + getAlertPolicySettings; + private final UnaryCallSettings.Builder + createAlertPolicySettings; + private final UnaryCallSettings.Builder + deleteAlertPolicySettings; + private final UnaryCallSettings.Builder + updateAlertPolicySettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + listAlertPoliciesSettings = PagedCallSettings.newBuilder(LIST_ALERT_POLICIES_PAGE_STR_FACT); + + getAlertPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createAlertPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteAlertPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateAlertPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listAlertPoliciesSettings, + getAlertPolicySettings, + createAlertPolicySettings, + deleteAlertPolicySettings, + updateAlertPolicySettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .listAlertPoliciesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getAlertPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createAlertPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteAlertPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateAlertPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(AlertPolicyServiceStubSettings settings) { + super(settings); + + listAlertPoliciesSettings = settings.listAlertPoliciesSettings.toBuilder(); + getAlertPolicySettings = settings.getAlertPolicySettings.toBuilder(); + createAlertPolicySettings = settings.createAlertPolicySettings.toBuilder(); + deleteAlertPolicySettings = settings.deleteAlertPolicySettings.toBuilder(); + updateAlertPolicySettings = settings.updateAlertPolicySettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listAlertPoliciesSettings, + getAlertPolicySettings, + createAlertPolicySettings, + deleteAlertPolicySettings, + updateAlertPolicySettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to listAlertPolicies. */ + public PagedCallSettings.Builder< + ListAlertPoliciesRequest, ListAlertPoliciesResponse, ListAlertPoliciesPagedResponse> + listAlertPoliciesSettings() { + return listAlertPoliciesSettings; + } + + /** Returns the builder for the settings used for calls to getAlertPolicy. */ + public UnaryCallSettings.Builder getAlertPolicySettings() { + return getAlertPolicySettings; + } + + /** Returns the builder for the settings used for calls to createAlertPolicy. */ + public UnaryCallSettings.Builder + createAlertPolicySettings() { + return createAlertPolicySettings; + } + + /** Returns the builder for the settings used for calls to deleteAlertPolicy. */ + public UnaryCallSettings.Builder deleteAlertPolicySettings() { + return deleteAlertPolicySettings; + } + + /** Returns the builder for the settings used for calls to updateAlertPolicy. */ + public UnaryCallSettings.Builder + updateAlertPolicySettings() { + return updateAlertPolicySettings; + } + + @Override + public AlertPolicyServiceStubSettings build() throws IOException { + return new AlertPolicyServiceStubSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GroupServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GroupServiceStub.java new file mode 100644 index 00000000..30c3ba28 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GroupServiceStub.java @@ -0,0 +1,82 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupMembersPagedResponse; +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.monitoring.v3.CreateGroupRequest; +import com.google.monitoring.v3.DeleteGroupRequest; +import com.google.monitoring.v3.GetGroupRequest; +import com.google.monitoring.v3.Group; +import com.google.monitoring.v3.ListGroupMembersRequest; +import com.google.monitoring.v3.ListGroupMembersResponse; +import com.google.monitoring.v3.ListGroupsRequest; +import com.google.monitoring.v3.ListGroupsResponse; +import com.google.monitoring.v3.UpdateGroupRequest; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class GroupServiceStub implements BackgroundResource { + + public UnaryCallable listGroupsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listGroupsPagedCallable()"); + } + + public UnaryCallable listGroupsCallable() { + throw new UnsupportedOperationException("Not implemented: listGroupsCallable()"); + } + + public UnaryCallable getGroupCallable() { + throw new UnsupportedOperationException("Not implemented: getGroupCallable()"); + } + + public UnaryCallable createGroupCallable() { + throw new UnsupportedOperationException("Not implemented: createGroupCallable()"); + } + + public UnaryCallable updateGroupCallable() { + throw new UnsupportedOperationException("Not implemented: updateGroupCallable()"); + } + + public UnaryCallable deleteGroupCallable() { + throw new UnsupportedOperationException("Not implemented: deleteGroupCallable()"); + } + + public UnaryCallable + listGroupMembersPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listGroupMembersPagedCallable()"); + } + + public UnaryCallable + listGroupMembersCallable() { + throw new UnsupportedOperationException("Not implemented: listGroupMembersCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GroupServiceStubSettings.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GroupServiceStubSettings.java new file mode 100644 index 00000000..091f3505 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GroupServiceStubSettings.java @@ -0,0 +1,531 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupMembersPagedResponse; +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupsPagedResponse; + +import com.google.api.MonitoredResource; +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.CreateGroupRequest; +import com.google.monitoring.v3.DeleteGroupRequest; +import com.google.monitoring.v3.GetGroupRequest; +import com.google.monitoring.v3.Group; +import com.google.monitoring.v3.ListGroupMembersRequest; +import com.google.monitoring.v3.ListGroupMembersResponse; +import com.google.monitoring.v3.ListGroupsRequest; +import com.google.monitoring.v3.ListGroupsResponse; +import com.google.monitoring.v3.UpdateGroupRequest; +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 GroupServiceStub}. + * + *

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

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

+ * 
+ * GroupServiceStubSettings.Builder groupServiceSettingsBuilder =
+ *     GroupServiceStubSettings.newBuilder();
+ * groupServiceSettingsBuilder.getGroupSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * GroupServiceStubSettings groupServiceSettings = groupServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class GroupServiceStubSettings 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/monitoring") + .add("https://www.googleapis.com/auth/monitoring.read") + .add("https://www.googleapis.com/auth/monitoring.write") + .build(); + + private final PagedCallSettings + listGroupsSettings; + private final UnaryCallSettings getGroupSettings; + private final UnaryCallSettings createGroupSettings; + private final UnaryCallSettings updateGroupSettings; + private final UnaryCallSettings deleteGroupSettings; + private final PagedCallSettings< + ListGroupMembersRequest, ListGroupMembersResponse, ListGroupMembersPagedResponse> + listGroupMembersSettings; + + /** Returns the object with the settings used for calls to listGroups. */ + public PagedCallSettings + listGroupsSettings() { + return listGroupsSettings; + } + + /** Returns the object with the settings used for calls to getGroup. */ + public UnaryCallSettings getGroupSettings() { + return getGroupSettings; + } + + /** Returns the object with the settings used for calls to createGroup. */ + public UnaryCallSettings createGroupSettings() { + return createGroupSettings; + } + + /** Returns the object with the settings used for calls to updateGroup. */ + public UnaryCallSettings updateGroupSettings() { + return updateGroupSettings; + } + + /** Returns the object with the settings used for calls to deleteGroup. */ + public UnaryCallSettings deleteGroupSettings() { + return deleteGroupSettings; + } + + /** Returns the object with the settings used for calls to listGroupMembers. */ + public PagedCallSettings< + ListGroupMembersRequest, ListGroupMembersResponse, ListGroupMembersPagedResponse> + listGroupMembersSettings() { + return listGroupMembersSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public GroupServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcGroupServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + 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 "monitoring.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(GroupServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected GroupServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listGroupsSettings = settingsBuilder.listGroupsSettings().build(); + getGroupSettings = settingsBuilder.getGroupSettings().build(); + createGroupSettings = settingsBuilder.createGroupSettings().build(); + updateGroupSettings = settingsBuilder.updateGroupSettings().build(); + deleteGroupSettings = settingsBuilder.deleteGroupSettings().build(); + listGroupMembersSettings = settingsBuilder.listGroupMembersSettings().build(); + } + + private static final PagedListDescriptor + LIST_GROUPS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListGroupsRequest injectToken(ListGroupsRequest payload, String token) { + return ListGroupsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListGroupsRequest injectPageSize(ListGroupsRequest payload, int pageSize) { + return ListGroupsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListGroupsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListGroupsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListGroupsResponse payload) { + return payload.getGroupList() != null + ? payload.getGroupList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + ListGroupMembersRequest, ListGroupMembersResponse, MonitoredResource> + LIST_GROUP_MEMBERS_PAGE_STR_DESC = + new PagedListDescriptor< + ListGroupMembersRequest, ListGroupMembersResponse, MonitoredResource>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListGroupMembersRequest injectToken( + ListGroupMembersRequest payload, String token) { + return ListGroupMembersRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListGroupMembersRequest injectPageSize( + ListGroupMembersRequest payload, int pageSize) { + return ListGroupMembersRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListGroupMembersRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListGroupMembersResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListGroupMembersResponse payload) { + return payload.getMembersList() != null + ? payload.getMembersList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListGroupsRequest, ListGroupsResponse, ListGroupsPagedResponse> + LIST_GROUPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListGroupsRequest, ListGroupsResponse, ListGroupsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListGroupsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_GROUPS_PAGE_STR_DESC, request, context); + return ListGroupsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListGroupMembersRequest, ListGroupMembersResponse, ListGroupMembersPagedResponse> + LIST_GROUP_MEMBERS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListGroupMembersRequest, ListGroupMembersResponse, ListGroupMembersPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListGroupMembersRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_GROUP_MEMBERS_PAGE_STR_DESC, request, context); + return ListGroupMembersPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for GroupServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + ListGroupsRequest, ListGroupsResponse, ListGroupsPagedResponse> + listGroupsSettings; + private final UnaryCallSettings.Builder getGroupSettings; + private final UnaryCallSettings.Builder createGroupSettings; + private final UnaryCallSettings.Builder updateGroupSettings; + private final UnaryCallSettings.Builder deleteGroupSettings; + private final PagedCallSettings.Builder< + ListGroupMembersRequest, ListGroupMembersResponse, ListGroupMembersPagedResponse> + listGroupMembersSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + listGroupsSettings = PagedCallSettings.newBuilder(LIST_GROUPS_PAGE_STR_FACT); + + getGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteGroupSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listGroupMembersSettings = PagedCallSettings.newBuilder(LIST_GROUP_MEMBERS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listGroupsSettings, + getGroupSettings, + createGroupSettings, + updateGroupSettings, + deleteGroupSettings, + listGroupMembersSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .listGroupsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteGroupSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listGroupMembersSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(GroupServiceStubSettings settings) { + super(settings); + + listGroupsSettings = settings.listGroupsSettings.toBuilder(); + getGroupSettings = settings.getGroupSettings.toBuilder(); + createGroupSettings = settings.createGroupSettings.toBuilder(); + updateGroupSettings = settings.updateGroupSettings.toBuilder(); + deleteGroupSettings = settings.deleteGroupSettings.toBuilder(); + listGroupMembersSettings = settings.listGroupMembersSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listGroupsSettings, + getGroupSettings, + createGroupSettings, + updateGroupSettings, + deleteGroupSettings, + listGroupMembersSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to listGroups. */ + public PagedCallSettings.Builder + listGroupsSettings() { + return listGroupsSettings; + } + + /** Returns the builder for the settings used for calls to getGroup. */ + public UnaryCallSettings.Builder getGroupSettings() { + return getGroupSettings; + } + + /** Returns the builder for the settings used for calls to createGroup. */ + public UnaryCallSettings.Builder createGroupSettings() { + return createGroupSettings; + } + + /** Returns the builder for the settings used for calls to updateGroup. */ + public UnaryCallSettings.Builder updateGroupSettings() { + return updateGroupSettings; + } + + /** Returns the builder for the settings used for calls to deleteGroup. */ + public UnaryCallSettings.Builder deleteGroupSettings() { + return deleteGroupSettings; + } + + /** Returns the builder for the settings used for calls to listGroupMembers. */ + public PagedCallSettings.Builder< + ListGroupMembersRequest, ListGroupMembersResponse, ListGroupMembersPagedResponse> + listGroupMembersSettings() { + return listGroupMembersSettings; + } + + @Override + public GroupServiceStubSettings build() throws IOException { + return new GroupServiceStubSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcAlertPolicyServiceCallableFactory.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcAlertPolicyServiceCallableFactory.java new file mode 100644 index 00000000..959fa30b --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcAlertPolicyServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * 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.monitoring.v3.stub; + +import com.google.api.core.BetaApi; +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.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcAlertPolicyServiceCallableFactory 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 pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcAlertPolicyServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcAlertPolicyServiceStub.java new file mode 100644 index 00000000..82218990 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcAlertPolicyServiceStub.java @@ -0,0 +1,308 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.AlertPolicyServiceClient.ListAlertPoliciesPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.monitoring.v3.AlertPolicy; +import com.google.monitoring.v3.CreateAlertPolicyRequest; +import com.google.monitoring.v3.DeleteAlertPolicyRequest; +import com.google.monitoring.v3.GetAlertPolicyRequest; +import com.google.monitoring.v3.ListAlertPoliciesRequest; +import com.google.monitoring.v3.ListAlertPoliciesResponse; +import com.google.monitoring.v3.UpdateAlertPolicyRequest; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcAlertPolicyServiceStub extends AlertPolicyServiceStub { + + private static final MethodDescriptor + listAlertPoliciesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.AlertPolicyService/ListAlertPolicies") + .setRequestMarshaller( + ProtoUtils.marshaller(ListAlertPoliciesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListAlertPoliciesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getAlertPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.AlertPolicyService/GetAlertPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(GetAlertPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(AlertPolicy.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createAlertPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.AlertPolicyService/CreateAlertPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateAlertPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(AlertPolicy.getDefaultInstance())) + .build(); + private static final MethodDescriptor + deleteAlertPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.AlertPolicyService/DeleteAlertPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteAlertPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateAlertPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.AlertPolicyService/UpdateAlertPolicy") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateAlertPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(AlertPolicy.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + listAlertPoliciesCallable; + private final UnaryCallable + listAlertPoliciesPagedCallable; + private final UnaryCallable getAlertPolicyCallable; + private final UnaryCallable createAlertPolicyCallable; + private final UnaryCallable deleteAlertPolicyCallable; + private final UnaryCallable updateAlertPolicyCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcAlertPolicyServiceStub create(AlertPolicyServiceStubSettings settings) + throws IOException { + return new GrpcAlertPolicyServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcAlertPolicyServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcAlertPolicyServiceStub( + AlertPolicyServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcAlertPolicyServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcAlertPolicyServiceStub( + AlertPolicyServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcAlertPolicyServiceStub, 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 GrpcAlertPolicyServiceStub( + AlertPolicyServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcAlertPolicyServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcAlertPolicyServiceStub, 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 GrpcAlertPolicyServiceStub( + AlertPolicyServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings + listAlertPoliciesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listAlertPoliciesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListAlertPoliciesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getAlertPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getAlertPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetAlertPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings createAlertPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createAlertPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateAlertPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteAlertPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteAlertPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteAlertPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateAlertPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateAlertPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateAlertPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "alert_policy.name", String.valueOf(request.getAlertPolicy().getName())); + return params.build(); + } + }) + .build(); + + this.listAlertPoliciesCallable = + callableFactory.createUnaryCallable( + listAlertPoliciesTransportSettings, + settings.listAlertPoliciesSettings(), + clientContext); + this.listAlertPoliciesPagedCallable = + callableFactory.createPagedCallable( + listAlertPoliciesTransportSettings, + settings.listAlertPoliciesSettings(), + clientContext); + this.getAlertPolicyCallable = + callableFactory.createUnaryCallable( + getAlertPolicyTransportSettings, settings.getAlertPolicySettings(), clientContext); + this.createAlertPolicyCallable = + callableFactory.createUnaryCallable( + createAlertPolicyTransportSettings, + settings.createAlertPolicySettings(), + clientContext); + this.deleteAlertPolicyCallable = + callableFactory.createUnaryCallable( + deleteAlertPolicyTransportSettings, + settings.deleteAlertPolicySettings(), + clientContext); + this.updateAlertPolicyCallable = + callableFactory.createUnaryCallable( + updateAlertPolicyTransportSettings, + settings.updateAlertPolicySettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable + listAlertPoliciesPagedCallable() { + return listAlertPoliciesPagedCallable; + } + + public UnaryCallable + listAlertPoliciesCallable() { + return listAlertPoliciesCallable; + } + + public UnaryCallable getAlertPolicyCallable() { + return getAlertPolicyCallable; + } + + public UnaryCallable createAlertPolicyCallable() { + return createAlertPolicyCallable; + } + + public UnaryCallable deleteAlertPolicyCallable() { + return deleteAlertPolicyCallable; + } + + public UnaryCallable updateAlertPolicyCallable() { + return updateAlertPolicyCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcGroupServiceCallableFactory.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcGroupServiceCallableFactory.java new file mode 100644 index 00000000..344a0b16 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcGroupServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * 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.monitoring.v3.stub; + +import com.google.api.core.BetaApi; +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.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcGroupServiceCallableFactory 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 pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcGroupServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcGroupServiceStub.java new file mode 100644 index 00000000..31ff1308 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcGroupServiceStub.java @@ -0,0 +1,327 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupMembersPagedResponse; +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.monitoring.v3.CreateGroupRequest; +import com.google.monitoring.v3.DeleteGroupRequest; +import com.google.monitoring.v3.GetGroupRequest; +import com.google.monitoring.v3.Group; +import com.google.monitoring.v3.ListGroupMembersRequest; +import com.google.monitoring.v3.ListGroupMembersResponse; +import com.google.monitoring.v3.ListGroupsRequest; +import com.google.monitoring.v3.ListGroupsResponse; +import com.google.monitoring.v3.UpdateGroupRequest; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcGroupServiceStub extends GroupServiceStub { + + private static final MethodDescriptor + listGroupsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.GroupService/ListGroups") + .setRequestMarshaller(ProtoUtils.marshaller(ListGroupsRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ListGroupsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor getGroupMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.GroupService/GetGroup") + .setRequestMarshaller(ProtoUtils.marshaller(GetGroupRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Group.getDefaultInstance())) + .build(); + private static final MethodDescriptor createGroupMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.GroupService/CreateGroup") + .setRequestMarshaller(ProtoUtils.marshaller(CreateGroupRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Group.getDefaultInstance())) + .build(); + private static final MethodDescriptor updateGroupMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.GroupService/UpdateGroup") + .setRequestMarshaller(ProtoUtils.marshaller(UpdateGroupRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Group.getDefaultInstance())) + .build(); + private static final MethodDescriptor deleteGroupMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.GroupService/DeleteGroup") + .setRequestMarshaller(ProtoUtils.marshaller(DeleteGroupRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listGroupMembersMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.GroupService/ListGroupMembers") + .setRequestMarshaller( + ProtoUtils.marshaller(ListGroupMembersRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListGroupMembersResponse.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable listGroupsCallable; + private final UnaryCallable listGroupsPagedCallable; + private final UnaryCallable getGroupCallable; + private final UnaryCallable createGroupCallable; + private final UnaryCallable updateGroupCallable; + private final UnaryCallable deleteGroupCallable; + private final UnaryCallable + listGroupMembersCallable; + private final UnaryCallable + listGroupMembersPagedCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcGroupServiceStub create(GroupServiceStubSettings settings) + throws IOException { + return new GrpcGroupServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcGroupServiceStub create(ClientContext clientContext) throws IOException { + return new GrpcGroupServiceStub(GroupServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcGroupServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcGroupServiceStub( + GroupServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcGroupServiceStub, 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 GrpcGroupServiceStub(GroupServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcGroupServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcGroupServiceStub, 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 GrpcGroupServiceStub( + GroupServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings listGroupsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listGroupsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListGroupsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getGroupTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getGroupMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetGroupRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings createGroupTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createGroupMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateGroupRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateGroupTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateGroupMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateGroupRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("group.name", String.valueOf(request.getGroup().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteGroupTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteGroupMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteGroupRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listGroupMembersTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listGroupMembersMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListGroupMembersRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + + this.listGroupsCallable = + callableFactory.createUnaryCallable( + listGroupsTransportSettings, settings.listGroupsSettings(), clientContext); + this.listGroupsPagedCallable = + callableFactory.createPagedCallable( + listGroupsTransportSettings, settings.listGroupsSettings(), clientContext); + this.getGroupCallable = + callableFactory.createUnaryCallable( + getGroupTransportSettings, settings.getGroupSettings(), clientContext); + this.createGroupCallable = + callableFactory.createUnaryCallable( + createGroupTransportSettings, settings.createGroupSettings(), clientContext); + this.updateGroupCallable = + callableFactory.createUnaryCallable( + updateGroupTransportSettings, settings.updateGroupSettings(), clientContext); + this.deleteGroupCallable = + callableFactory.createUnaryCallable( + deleteGroupTransportSettings, settings.deleteGroupSettings(), clientContext); + this.listGroupMembersCallable = + callableFactory.createUnaryCallable( + listGroupMembersTransportSettings, settings.listGroupMembersSettings(), clientContext); + this.listGroupMembersPagedCallable = + callableFactory.createPagedCallable( + listGroupMembersTransportSettings, settings.listGroupMembersSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable listGroupsPagedCallable() { + return listGroupsPagedCallable; + } + + public UnaryCallable listGroupsCallable() { + return listGroupsCallable; + } + + public UnaryCallable getGroupCallable() { + return getGroupCallable; + } + + public UnaryCallable createGroupCallable() { + return createGroupCallable; + } + + public UnaryCallable updateGroupCallable() { + return updateGroupCallable; + } + + public UnaryCallable deleteGroupCallable() { + return deleteGroupCallable; + } + + public UnaryCallable + listGroupMembersPagedCallable() { + return listGroupMembersPagedCallable; + } + + public UnaryCallable + listGroupMembersCallable() { + return listGroupMembersCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcMetricServiceCallableFactory.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcMetricServiceCallableFactory.java new file mode 100644 index 00000000..a9e34bea --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcMetricServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * 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.monitoring.v3.stub; + +import com.google.api.core.BetaApi; +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.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcMetricServiceCallableFactory 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 pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcMetricServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcMetricServiceStub.java new file mode 100644 index 00000000..4c6256a8 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcMetricServiceStub.java @@ -0,0 +1,464 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMetricDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMonitoredResourceDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListTimeSeriesPagedResponse; + +import com.google.api.MetricDescriptor; +import com.google.api.MonitoredResourceDescriptor; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.monitoring.v3.CreateMetricDescriptorRequest; +import com.google.monitoring.v3.CreateTimeSeriesRequest; +import com.google.monitoring.v3.DeleteMetricDescriptorRequest; +import com.google.monitoring.v3.GetMetricDescriptorRequest; +import com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest; +import com.google.monitoring.v3.ListMetricDescriptorsRequest; +import com.google.monitoring.v3.ListMetricDescriptorsResponse; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; +import com.google.monitoring.v3.ListTimeSeriesRequest; +import com.google.monitoring.v3.ListTimeSeriesResponse; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcMetricServiceStub extends MetricServiceStub { + + private static final MethodDescriptor< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> + listMonitoredResourceDescriptorsMethodDescriptor = + MethodDescriptor + . + newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.MetricService/ListMonitoredResourceDescriptors") + .setRequestMarshaller( + ProtoUtils.marshaller( + ListMonitoredResourceDescriptorsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller( + ListMonitoredResourceDescriptorsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor< + GetMonitoredResourceDescriptorRequest, MonitoredResourceDescriptor> + getMonitoredResourceDescriptorMethodDescriptor = + MethodDescriptor + .newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.MetricService/GetMonitoredResourceDescriptor") + .setRequestMarshaller( + ProtoUtils.marshaller(GetMonitoredResourceDescriptorRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(MonitoredResourceDescriptor.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listMetricDescriptorsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.MetricService/ListMetricDescriptors") + .setRequestMarshaller( + ProtoUtils.marshaller(ListMetricDescriptorsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListMetricDescriptorsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getMetricDescriptorMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.MetricService/GetMetricDescriptor") + .setRequestMarshaller( + ProtoUtils.marshaller(GetMetricDescriptorRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(MetricDescriptor.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createMetricDescriptorMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.MetricService/CreateMetricDescriptor") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateMetricDescriptorRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(MetricDescriptor.getDefaultInstance())) + .build(); + private static final MethodDescriptor + deleteMetricDescriptorMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.MetricService/DeleteMetricDescriptor") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteMetricDescriptorRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listTimeSeriesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.MetricService/ListTimeSeries") + .setRequestMarshaller( + ProtoUtils.marshaller(ListTimeSeriesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListTimeSeriesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createTimeSeriesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.MetricService/CreateTimeSeries") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateTimeSeriesRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> + listMonitoredResourceDescriptorsCallable; + private final UnaryCallable< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsPagedCallable; + private final UnaryCallable + getMonitoredResourceDescriptorCallable; + private final UnaryCallable + listMetricDescriptorsCallable; + private final UnaryCallable + listMetricDescriptorsPagedCallable; + private final UnaryCallable + getMetricDescriptorCallable; + private final UnaryCallable + createMetricDescriptorCallable; + private final UnaryCallable deleteMetricDescriptorCallable; + private final UnaryCallable listTimeSeriesCallable; + private final UnaryCallable + listTimeSeriesPagedCallable; + private final UnaryCallable createTimeSeriesCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcMetricServiceStub create(MetricServiceStubSettings settings) + throws IOException { + return new GrpcMetricServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcMetricServiceStub create(ClientContext clientContext) throws IOException { + return new GrpcMetricServiceStub(MetricServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcMetricServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcMetricServiceStub( + MetricServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcMetricServiceStub, 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 GrpcMetricServiceStub(MetricServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcMetricServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcMetricServiceStub, 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 GrpcMetricServiceStub( + MetricServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> + listMonitoredResourceDescriptorsTransportSettings = + GrpcCallSettings + . + newBuilder() + .setMethodDescriptor(listMonitoredResourceDescriptorsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + ListMonitoredResourceDescriptorsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getMonitoredResourceDescriptorTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(getMonitoredResourceDescriptorMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + GetMonitoredResourceDescriptorRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listMetricDescriptorsTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(listMetricDescriptorsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListMetricDescriptorsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getMetricDescriptorTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getMetricDescriptorMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetMetricDescriptorRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + createMetricDescriptorTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createMetricDescriptorMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateMetricDescriptorRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteMetricDescriptorTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteMetricDescriptorMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteMetricDescriptorRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listTimeSeriesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listTimeSeriesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListTimeSeriesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings createTimeSeriesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createTimeSeriesMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateTimeSeriesRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + + this.listMonitoredResourceDescriptorsCallable = + callableFactory.createUnaryCallable( + listMonitoredResourceDescriptorsTransportSettings, + settings.listMonitoredResourceDescriptorsSettings(), + clientContext); + this.listMonitoredResourceDescriptorsPagedCallable = + callableFactory.createPagedCallable( + listMonitoredResourceDescriptorsTransportSettings, + settings.listMonitoredResourceDescriptorsSettings(), + clientContext); + this.getMonitoredResourceDescriptorCallable = + callableFactory.createUnaryCallable( + getMonitoredResourceDescriptorTransportSettings, + settings.getMonitoredResourceDescriptorSettings(), + clientContext); + this.listMetricDescriptorsCallable = + callableFactory.createUnaryCallable( + listMetricDescriptorsTransportSettings, + settings.listMetricDescriptorsSettings(), + clientContext); + this.listMetricDescriptorsPagedCallable = + callableFactory.createPagedCallable( + listMetricDescriptorsTransportSettings, + settings.listMetricDescriptorsSettings(), + clientContext); + this.getMetricDescriptorCallable = + callableFactory.createUnaryCallable( + getMetricDescriptorTransportSettings, + settings.getMetricDescriptorSettings(), + clientContext); + this.createMetricDescriptorCallable = + callableFactory.createUnaryCallable( + createMetricDescriptorTransportSettings, + settings.createMetricDescriptorSettings(), + clientContext); + this.deleteMetricDescriptorCallable = + callableFactory.createUnaryCallable( + deleteMetricDescriptorTransportSettings, + settings.deleteMetricDescriptorSettings(), + clientContext); + this.listTimeSeriesCallable = + callableFactory.createUnaryCallable( + listTimeSeriesTransportSettings, settings.listTimeSeriesSettings(), clientContext); + this.listTimeSeriesPagedCallable = + callableFactory.createPagedCallable( + listTimeSeriesTransportSettings, settings.listTimeSeriesSettings(), clientContext); + this.createTimeSeriesCallable = + callableFactory.createUnaryCallable( + createTimeSeriesTransportSettings, settings.createTimeSeriesSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsPagedCallable() { + return listMonitoredResourceDescriptorsPagedCallable; + } + + public UnaryCallable< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> + listMonitoredResourceDescriptorsCallable() { + return listMonitoredResourceDescriptorsCallable; + } + + public UnaryCallable + getMonitoredResourceDescriptorCallable() { + return getMonitoredResourceDescriptorCallable; + } + + public UnaryCallable + listMetricDescriptorsPagedCallable() { + return listMetricDescriptorsPagedCallable; + } + + public UnaryCallable + listMetricDescriptorsCallable() { + return listMetricDescriptorsCallable; + } + + public UnaryCallable getMetricDescriptorCallable() { + return getMetricDescriptorCallable; + } + + public UnaryCallable + createMetricDescriptorCallable() { + return createMetricDescriptorCallable; + } + + public UnaryCallable deleteMetricDescriptorCallable() { + return deleteMetricDescriptorCallable; + } + + public UnaryCallable + listTimeSeriesPagedCallable() { + return listTimeSeriesPagedCallable; + } + + public UnaryCallable listTimeSeriesCallable() { + return listTimeSeriesCallable; + } + + public UnaryCallable createTimeSeriesCallable() { + return createTimeSeriesCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcNotificationChannelServiceCallableFactory.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcNotificationChannelServiceCallableFactory.java new file mode 100644 index 00000000..40f8719b --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcNotificationChannelServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * 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.monitoring.v3.stub; + +import com.google.api.core.BetaApi; +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.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcNotificationChannelServiceCallableFactory 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 pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcNotificationChannelServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcNotificationChannelServiceStub.java new file mode 100644 index 00000000..3f104869 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcNotificationChannelServiceStub.java @@ -0,0 +1,586 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.monitoring.v3.CreateNotificationChannelRequest; +import com.google.monitoring.v3.DeleteNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelDescriptorRequest; +import com.google.monitoring.v3.GetNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse; +import com.google.monitoring.v3.ListNotificationChannelsRequest; +import com.google.monitoring.v3.ListNotificationChannelsResponse; +import com.google.monitoring.v3.NotificationChannel; +import com.google.monitoring.v3.NotificationChannelDescriptor; +import com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.UpdateNotificationChannelRequest; +import com.google.monitoring.v3.VerifyNotificationChannelRequest; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcNotificationChannelServiceStub extends NotificationChannelServiceStub { + + private static final MethodDescriptor< + ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse> + listNotificationChannelDescriptorsMethodDescriptor = + MethodDescriptor + . + newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/ListNotificationChannelDescriptors") + .setRequestMarshaller( + ProtoUtils.marshaller( + ListNotificationChannelDescriptorsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller( + ListNotificationChannelDescriptorsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor< + GetNotificationChannelDescriptorRequest, NotificationChannelDescriptor> + getNotificationChannelDescriptorMethodDescriptor = + MethodDescriptor + .newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/GetNotificationChannelDescriptor") + .setRequestMarshaller( + ProtoUtils.marshaller( + GetNotificationChannelDescriptorRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(NotificationChannelDescriptor.getDefaultInstance())) + .build(); + private static final MethodDescriptor< + ListNotificationChannelsRequest, ListNotificationChannelsResponse> + listNotificationChannelsMethodDescriptor = + MethodDescriptor + .newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/ListNotificationChannels") + .setRequestMarshaller( + ProtoUtils.marshaller(ListNotificationChannelsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListNotificationChannelsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getNotificationChannelMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/GetNotificationChannel") + .setRequestMarshaller( + ProtoUtils.marshaller(GetNotificationChannelRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(NotificationChannel.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createNotificationChannelMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/CreateNotificationChannel") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateNotificationChannelRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(NotificationChannel.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateNotificationChannelMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/UpdateNotificationChannel") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateNotificationChannelRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(NotificationChannel.getDefaultInstance())) + .build(); + private static final MethodDescriptor + deleteNotificationChannelMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/DeleteNotificationChannel") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteNotificationChannelRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + private static final MethodDescriptor + sendNotificationChannelVerificationCodeMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/SendNotificationChannelVerificationCode") + .setRequestMarshaller( + ProtoUtils.marshaller( + SendNotificationChannelVerificationCodeRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + private static final MethodDescriptor< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeMethodDescriptor = + MethodDescriptor + . + newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/GetNotificationChannelVerificationCode") + .setRequestMarshaller( + ProtoUtils.marshaller( + GetNotificationChannelVerificationCodeRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller( + GetNotificationChannelVerificationCodeResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + verifyNotificationChannelMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + "google.monitoring.v3.NotificationChannelService/VerifyNotificationChannel") + .setRequestMarshaller( + ProtoUtils.marshaller(VerifyNotificationChannelRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(NotificationChannel.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable< + ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse> + listNotificationChannelDescriptorsCallable; + private final UnaryCallable< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsPagedCallable; + private final UnaryCallable< + GetNotificationChannelDescriptorRequest, NotificationChannelDescriptor> + getNotificationChannelDescriptorCallable; + private final UnaryCallable + listNotificationChannelsCallable; + private final UnaryCallable< + ListNotificationChannelsRequest, ListNotificationChannelsPagedResponse> + listNotificationChannelsPagedCallable; + private final UnaryCallable + getNotificationChannelCallable; + private final UnaryCallable + createNotificationChannelCallable; + private final UnaryCallable + updateNotificationChannelCallable; + private final UnaryCallable + deleteNotificationChannelCallable; + private final UnaryCallable + sendNotificationChannelVerificationCodeCallable; + private final UnaryCallable< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeCallable; + private final UnaryCallable + verifyNotificationChannelCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcNotificationChannelServiceStub create( + NotificationChannelServiceStubSettings settings) throws IOException { + return new GrpcNotificationChannelServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcNotificationChannelServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcNotificationChannelServiceStub( + NotificationChannelServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcNotificationChannelServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcNotificationChannelServiceStub( + NotificationChannelServiceStubSettings.newBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of GrpcNotificationChannelServiceStub, 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 GrpcNotificationChannelServiceStub( + NotificationChannelServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcNotificationChannelServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcNotificationChannelServiceStub, 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 GrpcNotificationChannelServiceStub( + NotificationChannelServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings< + ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse> + listNotificationChannelDescriptorsTransportSettings = + GrpcCallSettings + . + newBuilder() + .setMethodDescriptor(listNotificationChannelDescriptorsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + ListNotificationChannelDescriptorsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getNotificationChannelDescriptorTransportSettings = + GrpcCallSettings + . + newBuilder() + .setMethodDescriptor(getNotificationChannelDescriptorMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + GetNotificationChannelDescriptorRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listNotificationChannelsTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(listNotificationChannelsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListNotificationChannelsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getNotificationChannelTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getNotificationChannelMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetNotificationChannelRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + createNotificationChannelTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createNotificationChannelMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateNotificationChannelRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + updateNotificationChannelTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateNotificationChannelMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateNotificationChannelRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "notification_channel.name", + String.valueOf(request.getNotificationChannel().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + deleteNotificationChannelTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteNotificationChannelMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteNotificationChannelRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + sendNotificationChannelVerificationCodeTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(sendNotificationChannelVerificationCodeMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + SendNotificationChannelVerificationCodeRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeTransportSettings = + GrpcCallSettings + . + newBuilder() + .setMethodDescriptor(getNotificationChannelVerificationCodeMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract( + GetNotificationChannelVerificationCodeRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + verifyNotificationChannelTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(verifyNotificationChannelMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(VerifyNotificationChannelRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + + this.listNotificationChannelDescriptorsCallable = + callableFactory.createUnaryCallable( + listNotificationChannelDescriptorsTransportSettings, + settings.listNotificationChannelDescriptorsSettings(), + clientContext); + this.listNotificationChannelDescriptorsPagedCallable = + callableFactory.createPagedCallable( + listNotificationChannelDescriptorsTransportSettings, + settings.listNotificationChannelDescriptorsSettings(), + clientContext); + this.getNotificationChannelDescriptorCallable = + callableFactory.createUnaryCallable( + getNotificationChannelDescriptorTransportSettings, + settings.getNotificationChannelDescriptorSettings(), + clientContext); + this.listNotificationChannelsCallable = + callableFactory.createUnaryCallable( + listNotificationChannelsTransportSettings, + settings.listNotificationChannelsSettings(), + clientContext); + this.listNotificationChannelsPagedCallable = + callableFactory.createPagedCallable( + listNotificationChannelsTransportSettings, + settings.listNotificationChannelsSettings(), + clientContext); + this.getNotificationChannelCallable = + callableFactory.createUnaryCallable( + getNotificationChannelTransportSettings, + settings.getNotificationChannelSettings(), + clientContext); + this.createNotificationChannelCallable = + callableFactory.createUnaryCallable( + createNotificationChannelTransportSettings, + settings.createNotificationChannelSettings(), + clientContext); + this.updateNotificationChannelCallable = + callableFactory.createUnaryCallable( + updateNotificationChannelTransportSettings, + settings.updateNotificationChannelSettings(), + clientContext); + this.deleteNotificationChannelCallable = + callableFactory.createUnaryCallable( + deleteNotificationChannelTransportSettings, + settings.deleteNotificationChannelSettings(), + clientContext); + this.sendNotificationChannelVerificationCodeCallable = + callableFactory.createUnaryCallable( + sendNotificationChannelVerificationCodeTransportSettings, + settings.sendNotificationChannelVerificationCodeSettings(), + clientContext); + this.getNotificationChannelVerificationCodeCallable = + callableFactory.createUnaryCallable( + getNotificationChannelVerificationCodeTransportSettings, + settings.getNotificationChannelVerificationCodeSettings(), + clientContext); + this.verifyNotificationChannelCallable = + callableFactory.createUnaryCallable( + verifyNotificationChannelTransportSettings, + settings.verifyNotificationChannelSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsPagedCallable() { + return listNotificationChannelDescriptorsPagedCallable; + } + + public UnaryCallable< + ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse> + listNotificationChannelDescriptorsCallable() { + return listNotificationChannelDescriptorsCallable; + } + + public UnaryCallable + getNotificationChannelDescriptorCallable() { + return getNotificationChannelDescriptorCallable; + } + + public UnaryCallable + listNotificationChannelsPagedCallable() { + return listNotificationChannelsPagedCallable; + } + + public UnaryCallable + listNotificationChannelsCallable() { + return listNotificationChannelsCallable; + } + + public UnaryCallable + getNotificationChannelCallable() { + return getNotificationChannelCallable; + } + + public UnaryCallable + createNotificationChannelCallable() { + return createNotificationChannelCallable; + } + + public UnaryCallable + updateNotificationChannelCallable() { + return updateNotificationChannelCallable; + } + + public UnaryCallable + deleteNotificationChannelCallable() { + return deleteNotificationChannelCallable; + } + + public UnaryCallable + sendNotificationChannelVerificationCodeCallable() { + return sendNotificationChannelVerificationCodeCallable; + } + + public UnaryCallable< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeCallable() { + return getNotificationChannelVerificationCodeCallable; + } + + public UnaryCallable + verifyNotificationChannelCallable() { + return verifyNotificationChannelCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcUptimeCheckServiceCallableFactory.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcUptimeCheckServiceCallableFactory.java new file mode 100644 index 00000000..aa1cbcf7 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcUptimeCheckServiceCallableFactory.java @@ -0,0 +1,115 @@ +/* + * 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.monitoring.v3.stub; + +import com.google.api.core.BetaApi; +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.stub.OperationsStub; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC callable factory implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator") +@BetaApi("The surface for use by generated code is not stable yet and may change in the future.") +public class GrpcUptimeCheckServiceCallableFactory 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 pagedCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createPagedCallable( + grpcCallSettings, pagedCallSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + GrpcCallSettings grpcCallSettings, + BatchingCallSettings batchingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBatchingCallable( + grpcCallSettings, batchingCallSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + GrpcCallSettings grpcCallSettings, + OperationCallSettings operationCallSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + return GrpcCallableFactory.createOperationCallable( + grpcCallSettings, operationCallSettings, clientContext, operationsStub); + } + + @Override + public + BidiStreamingCallable createBidiStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createBidiStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + GrpcCallSettings grpcCallSettings, + ServerStreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createServerStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } + + @Override + public + ClientStreamingCallable createClientStreamingCallable( + GrpcCallSettings grpcCallSettings, + StreamingCallSettings streamingCallSettings, + ClientContext clientContext) { + return GrpcCallableFactory.createClientStreamingCallable( + grpcCallSettings, streamingCallSettings, clientContext); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcUptimeCheckServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcUptimeCheckServiceStub.java new file mode 100644 index 00000000..cf0d10b0 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/GrpcUptimeCheckServiceStub.java @@ -0,0 +1,367 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse; +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.grpc.GrpcCallSettings; +import com.google.api.gax.grpc.GrpcStubCallableFactory; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.RequestParamsExtractor; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableMap; +import com.google.monitoring.v3.CreateUptimeCheckConfigRequest; +import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest; +import com.google.monitoring.v3.GetUptimeCheckConfigRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsResponse; +import com.google.monitoring.v3.ListUptimeCheckIpsRequest; +import com.google.monitoring.v3.ListUptimeCheckIpsResponse; +import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest; +import com.google.monitoring.v3.UptimeCheckConfig; +import com.google.protobuf.Empty; +import io.grpc.MethodDescriptor; +import io.grpc.protobuf.ProtoUtils; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * gRPC stub implementation for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public class GrpcUptimeCheckServiceStub extends UptimeCheckServiceStub { + + private static final MethodDescriptor< + ListUptimeCheckConfigsRequest, ListUptimeCheckConfigsResponse> + listUptimeCheckConfigsMethodDescriptor = + MethodDescriptor + .newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.UptimeCheckService/ListUptimeCheckConfigs") + .setRequestMarshaller( + ProtoUtils.marshaller(ListUptimeCheckConfigsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListUptimeCheckConfigsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getUptimeCheckConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.UptimeCheckService/GetUptimeCheckConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(GetUptimeCheckConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(UptimeCheckConfig.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createUptimeCheckConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.UptimeCheckService/CreateUptimeCheckConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateUptimeCheckConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(UptimeCheckConfig.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateUptimeCheckConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.UptimeCheckService/UpdateUptimeCheckConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateUptimeCheckConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(UptimeCheckConfig.getDefaultInstance())) + .build(); + private static final MethodDescriptor + deleteUptimeCheckConfigMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.UptimeCheckService/DeleteUptimeCheckConfig") + .setRequestMarshaller( + ProtoUtils.marshaller(DeleteUptimeCheckConfigRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listUptimeCheckIpsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.monitoring.v3.UptimeCheckService/ListUptimeCheckIps") + .setRequestMarshaller( + ProtoUtils.marshaller(ListUptimeCheckIpsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListUptimeCheckIpsResponse.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable + listUptimeCheckConfigsCallable; + private final UnaryCallable + listUptimeCheckConfigsPagedCallable; + private final UnaryCallable + getUptimeCheckConfigCallable; + private final UnaryCallable + createUptimeCheckConfigCallable; + private final UnaryCallable + updateUptimeCheckConfigCallable; + private final UnaryCallable + deleteUptimeCheckConfigCallable; + private final UnaryCallable + listUptimeCheckIpsCallable; + private final UnaryCallable + listUptimeCheckIpsPagedCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcUptimeCheckServiceStub create(UptimeCheckServiceStubSettings settings) + throws IOException { + return new GrpcUptimeCheckServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcUptimeCheckServiceStub create(ClientContext clientContext) + throws IOException { + return new GrpcUptimeCheckServiceStub( + UptimeCheckServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcUptimeCheckServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcUptimeCheckServiceStub( + UptimeCheckServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcUptimeCheckServiceStub, 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 GrpcUptimeCheckServiceStub( + UptimeCheckServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new GrpcUptimeCheckServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcUptimeCheckServiceStub, 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 GrpcUptimeCheckServiceStub( + UptimeCheckServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings + listUptimeCheckConfigsTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(listUptimeCheckConfigsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListUptimeCheckConfigsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getUptimeCheckConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getUptimeCheckConfigMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetUptimeCheckConfigRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + createUptimeCheckConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createUptimeCheckConfigMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateUptimeCheckConfigRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + updateUptimeCheckConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateUptimeCheckConfigMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateUptimeCheckConfigRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put( + "uptime_check_config.name", + String.valueOf(request.getUptimeCheckConfig().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + deleteUptimeCheckConfigTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteUptimeCheckConfigMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteUptimeCheckConfigRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listUptimeCheckIpsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listUptimeCheckIpsMethodDescriptor) + .build(); + + this.listUptimeCheckConfigsCallable = + callableFactory.createUnaryCallable( + listUptimeCheckConfigsTransportSettings, + settings.listUptimeCheckConfigsSettings(), + clientContext); + this.listUptimeCheckConfigsPagedCallable = + callableFactory.createPagedCallable( + listUptimeCheckConfigsTransportSettings, + settings.listUptimeCheckConfigsSettings(), + clientContext); + this.getUptimeCheckConfigCallable = + callableFactory.createUnaryCallable( + getUptimeCheckConfigTransportSettings, + settings.getUptimeCheckConfigSettings(), + clientContext); + this.createUptimeCheckConfigCallable = + callableFactory.createUnaryCallable( + createUptimeCheckConfigTransportSettings, + settings.createUptimeCheckConfigSettings(), + clientContext); + this.updateUptimeCheckConfigCallable = + callableFactory.createUnaryCallable( + updateUptimeCheckConfigTransportSettings, + settings.updateUptimeCheckConfigSettings(), + clientContext); + this.deleteUptimeCheckConfigCallable = + callableFactory.createUnaryCallable( + deleteUptimeCheckConfigTransportSettings, + settings.deleteUptimeCheckConfigSettings(), + clientContext); + this.listUptimeCheckIpsCallable = + callableFactory.createUnaryCallable( + listUptimeCheckIpsTransportSettings, + settings.listUptimeCheckIpsSettings(), + clientContext); + this.listUptimeCheckIpsPagedCallable = + callableFactory.createPagedCallable( + listUptimeCheckIpsTransportSettings, + settings.listUptimeCheckIpsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable + listUptimeCheckConfigsPagedCallable() { + return listUptimeCheckConfigsPagedCallable; + } + + public UnaryCallable + listUptimeCheckConfigsCallable() { + return listUptimeCheckConfigsCallable; + } + + public UnaryCallable + getUptimeCheckConfigCallable() { + return getUptimeCheckConfigCallable; + } + + public UnaryCallable + createUptimeCheckConfigCallable() { + return createUptimeCheckConfigCallable; + } + + public UnaryCallable + updateUptimeCheckConfigCallable() { + return updateUptimeCheckConfigCallable; + } + + public UnaryCallable deleteUptimeCheckConfigCallable() { + return deleteUptimeCheckConfigCallable; + } + + public UnaryCallable + listUptimeCheckIpsPagedCallable() { + return listUptimeCheckIpsPagedCallable; + } + + public UnaryCallable + listUptimeCheckIpsCallable() { + return listUptimeCheckIpsCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStub.java new file mode 100644 index 00000000..bff3e58d --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStub.java @@ -0,0 +1,110 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMetricDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMonitoredResourceDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListTimeSeriesPagedResponse; + +import com.google.api.MetricDescriptor; +import com.google.api.MonitoredResourceDescriptor; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.monitoring.v3.CreateMetricDescriptorRequest; +import com.google.monitoring.v3.CreateTimeSeriesRequest; +import com.google.monitoring.v3.DeleteMetricDescriptorRequest; +import com.google.monitoring.v3.GetMetricDescriptorRequest; +import com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest; +import com.google.monitoring.v3.ListMetricDescriptorsRequest; +import com.google.monitoring.v3.ListMetricDescriptorsResponse; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; +import com.google.monitoring.v3.ListTimeSeriesRequest; +import com.google.monitoring.v3.ListTimeSeriesResponse; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class MetricServiceStub implements BackgroundResource { + + public UnaryCallable< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listMonitoredResourceDescriptorsPagedCallable()"); + } + + public UnaryCallable< + ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse> + listMonitoredResourceDescriptorsCallable() { + throw new UnsupportedOperationException( + "Not implemented: listMonitoredResourceDescriptorsCallable()"); + } + + public UnaryCallable + getMonitoredResourceDescriptorCallable() { + throw new UnsupportedOperationException( + "Not implemented: getMonitoredResourceDescriptorCallable()"); + } + + public UnaryCallable + listMetricDescriptorsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listMetricDescriptorsPagedCallable()"); + } + + public UnaryCallable + listMetricDescriptorsCallable() { + throw new UnsupportedOperationException("Not implemented: listMetricDescriptorsCallable()"); + } + + public UnaryCallable getMetricDescriptorCallable() { + throw new UnsupportedOperationException("Not implemented: getMetricDescriptorCallable()"); + } + + public UnaryCallable + createMetricDescriptorCallable() { + throw new UnsupportedOperationException("Not implemented: createMetricDescriptorCallable()"); + } + + public UnaryCallable deleteMetricDescriptorCallable() { + throw new UnsupportedOperationException("Not implemented: deleteMetricDescriptorCallable()"); + } + + public UnaryCallable + listTimeSeriesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listTimeSeriesPagedCallable()"); + } + + public UnaryCallable listTimeSeriesCallable() { + throw new UnsupportedOperationException("Not implemented: listTimeSeriesCallable()"); + } + + public UnaryCallable createTimeSeriesCallable() { + throw new UnsupportedOperationException("Not implemented: createTimeSeriesCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStubSettings.java b/src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStubSettings.java new file mode 100644 index 00000000..8abae5e4 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/MetricServiceStubSettings.java @@ -0,0 +1,724 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMetricDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMonitoredResourceDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListTimeSeriesPagedResponse; + +import com.google.api.MetricDescriptor; +import com.google.api.MonitoredResourceDescriptor; +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.CreateMetricDescriptorRequest; +import com.google.monitoring.v3.CreateTimeSeriesRequest; +import com.google.monitoring.v3.DeleteMetricDescriptorRequest; +import com.google.monitoring.v3.GetMetricDescriptorRequest; +import com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest; +import com.google.monitoring.v3.ListMetricDescriptorsRequest; +import com.google.monitoring.v3.ListMetricDescriptorsResponse; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; +import com.google.monitoring.v3.ListTimeSeriesRequest; +import com.google.monitoring.v3.ListTimeSeriesResponse; +import com.google.monitoring.v3.TimeSeries; +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 MetricServiceStub}. + * + *

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

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

+ * 
+ * MetricServiceStubSettings.Builder metricServiceSettingsBuilder =
+ *     MetricServiceStubSettings.newBuilder();
+ * metricServiceSettingsBuilder.getMonitoredResourceDescriptorSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * MetricServiceStubSettings metricServiceSettings = metricServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class MetricServiceStubSettings 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/monitoring") + .add("https://www.googleapis.com/auth/monitoring.read") + .add("https://www.googleapis.com/auth/monitoring.write") + .build(); + + private final PagedCallSettings< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsSettings; + private final UnaryCallSettings< + GetMonitoredResourceDescriptorRequest, MonitoredResourceDescriptor> + getMonitoredResourceDescriptorSettings; + private final PagedCallSettings< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + ListMetricDescriptorsPagedResponse> + listMetricDescriptorsSettings; + private final UnaryCallSettings + getMetricDescriptorSettings; + private final UnaryCallSettings + createMetricDescriptorSettings; + private final UnaryCallSettings + deleteMetricDescriptorSettings; + private final PagedCallSettings< + ListTimeSeriesRequest, ListTimeSeriesResponse, ListTimeSeriesPagedResponse> + listTimeSeriesSettings; + private final UnaryCallSettings createTimeSeriesSettings; + + /** Returns the object with the settings used for calls to listMonitoredResourceDescriptors. */ + public PagedCallSettings< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsSettings() { + return listMonitoredResourceDescriptorsSettings; + } + + /** Returns the object with the settings used for calls to getMonitoredResourceDescriptor. */ + public UnaryCallSettings + getMonitoredResourceDescriptorSettings() { + return getMonitoredResourceDescriptorSettings; + } + + /** Returns the object with the settings used for calls to listMetricDescriptors. */ + public PagedCallSettings< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + ListMetricDescriptorsPagedResponse> + listMetricDescriptorsSettings() { + return listMetricDescriptorsSettings; + } + + /** Returns the object with the settings used for calls to getMetricDescriptor. */ + public UnaryCallSettings + getMetricDescriptorSettings() { + return getMetricDescriptorSettings; + } + + /** Returns the object with the settings used for calls to createMetricDescriptor. */ + public UnaryCallSettings + createMetricDescriptorSettings() { + return createMetricDescriptorSettings; + } + + /** Returns the object with the settings used for calls to deleteMetricDescriptor. */ + public UnaryCallSettings deleteMetricDescriptorSettings() { + return deleteMetricDescriptorSettings; + } + + /** Returns the object with the settings used for calls to listTimeSeries. */ + public PagedCallSettings< + ListTimeSeriesRequest, ListTimeSeriesResponse, ListTimeSeriesPagedResponse> + listTimeSeriesSettings() { + return listTimeSeriesSettings; + } + + /** Returns the object with the settings used for calls to createTimeSeries. */ + public UnaryCallSettings createTimeSeriesSettings() { + return createTimeSeriesSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public MetricServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcMetricServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + 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 "monitoring.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(MetricServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected MetricServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listMonitoredResourceDescriptorsSettings = + settingsBuilder.listMonitoredResourceDescriptorsSettings().build(); + getMonitoredResourceDescriptorSettings = + settingsBuilder.getMonitoredResourceDescriptorSettings().build(); + listMetricDescriptorsSettings = settingsBuilder.listMetricDescriptorsSettings().build(); + getMetricDescriptorSettings = settingsBuilder.getMetricDescriptorSettings().build(); + createMetricDescriptorSettings = settingsBuilder.createMetricDescriptorSettings().build(); + deleteMetricDescriptorSettings = settingsBuilder.deleteMetricDescriptorSettings().build(); + listTimeSeriesSettings = settingsBuilder.listTimeSeriesSettings().build(); + createTimeSeriesSettings = settingsBuilder.createTimeSeriesSettings().build(); + } + + private static final PagedListDescriptor< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor> + LIST_MONITORED_RESOURCE_DESCRIPTORS_PAGE_STR_DESC = + new PagedListDescriptor< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListMonitoredResourceDescriptorsRequest injectToken( + ListMonitoredResourceDescriptorsRequest payload, String token) { + return ListMonitoredResourceDescriptorsRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListMonitoredResourceDescriptorsRequest injectPageSize( + ListMonitoredResourceDescriptorsRequest payload, int pageSize) { + return ListMonitoredResourceDescriptorsRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListMonitoredResourceDescriptorsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListMonitoredResourceDescriptorsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListMonitoredResourceDescriptorsResponse payload) { + return payload.getResourceDescriptorsList() != null + ? payload.getResourceDescriptorsList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + ListMetricDescriptorsRequest, ListMetricDescriptorsResponse, MetricDescriptor> + LIST_METRIC_DESCRIPTORS_PAGE_STR_DESC = + new PagedListDescriptor< + ListMetricDescriptorsRequest, ListMetricDescriptorsResponse, MetricDescriptor>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListMetricDescriptorsRequest injectToken( + ListMetricDescriptorsRequest payload, String token) { + return ListMetricDescriptorsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListMetricDescriptorsRequest injectPageSize( + ListMetricDescriptorsRequest payload, int pageSize) { + return ListMetricDescriptorsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListMetricDescriptorsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListMetricDescriptorsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListMetricDescriptorsResponse payload) { + return payload.getMetricDescriptorsList() != null + ? payload.getMetricDescriptorsList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + ListTimeSeriesRequest, ListTimeSeriesResponse, TimeSeries> + LIST_TIME_SERIES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListTimeSeriesRequest injectToken(ListTimeSeriesRequest payload, String token) { + return ListTimeSeriesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListTimeSeriesRequest injectPageSize( + ListTimeSeriesRequest payload, int pageSize) { + return ListTimeSeriesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListTimeSeriesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListTimeSeriesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListTimeSeriesResponse payload) { + return payload.getTimeSeriesList() != null + ? payload.getTimeSeriesList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + ListMonitoredResourceDescriptorsPagedResponse> + LIST_MONITORED_RESOURCE_DESCRIPTORS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + ListMonitoredResourceDescriptorsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse> + callable, + ListMonitoredResourceDescriptorsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + MonitoredResourceDescriptor> + pageContext = + PageContext.create( + callable, + LIST_MONITORED_RESOURCE_DESCRIPTORS_PAGE_STR_DESC, + request, + context); + return ListMonitoredResourceDescriptorsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + ListMetricDescriptorsPagedResponse> + LIST_METRIC_DESCRIPTORS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + ListMetricDescriptorsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListMetricDescriptorsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListMetricDescriptorsRequest, ListMetricDescriptorsResponse, MetricDescriptor> + pageContext = + PageContext.create( + callable, LIST_METRIC_DESCRIPTORS_PAGE_STR_DESC, request, context); + return ListMetricDescriptorsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListTimeSeriesRequest, ListTimeSeriesResponse, ListTimeSeriesPagedResponse> + LIST_TIME_SERIES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListTimeSeriesRequest, ListTimeSeriesResponse, ListTimeSeriesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListTimeSeriesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_TIME_SERIES_PAGE_STR_DESC, request, context); + return ListTimeSeriesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for MetricServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsSettings; + private final UnaryCallSettings.Builder< + GetMonitoredResourceDescriptorRequest, MonitoredResourceDescriptor> + getMonitoredResourceDescriptorSettings; + private final PagedCallSettings.Builder< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + ListMetricDescriptorsPagedResponse> + listMetricDescriptorsSettings; + private final UnaryCallSettings.Builder + getMetricDescriptorSettings; + private final UnaryCallSettings.Builder + createMetricDescriptorSettings; + private final UnaryCallSettings.Builder + deleteMetricDescriptorSettings; + private final PagedCallSettings.Builder< + ListTimeSeriesRequest, ListTimeSeriesResponse, ListTimeSeriesPagedResponse> + listTimeSeriesSettings; + private final UnaryCallSettings.Builder + createTimeSeriesSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + listMonitoredResourceDescriptorsSettings = + PagedCallSettings.newBuilder(LIST_MONITORED_RESOURCE_DESCRIPTORS_PAGE_STR_FACT); + + getMonitoredResourceDescriptorSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listMetricDescriptorsSettings = + PagedCallSettings.newBuilder(LIST_METRIC_DESCRIPTORS_PAGE_STR_FACT); + + getMetricDescriptorSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createMetricDescriptorSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteMetricDescriptorSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listTimeSeriesSettings = PagedCallSettings.newBuilder(LIST_TIME_SERIES_PAGE_STR_FACT); + + createTimeSeriesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listMonitoredResourceDescriptorsSettings, + getMonitoredResourceDescriptorSettings, + listMetricDescriptorsSettings, + getMetricDescriptorSettings, + createMetricDescriptorSettings, + deleteMetricDescriptorSettings, + listTimeSeriesSettings, + createTimeSeriesSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .listMonitoredResourceDescriptorsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getMonitoredResourceDescriptorSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listMetricDescriptorsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getMetricDescriptorSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createMetricDescriptorSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteMetricDescriptorSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listTimeSeriesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createTimeSeriesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(MetricServiceStubSettings settings) { + super(settings); + + listMonitoredResourceDescriptorsSettings = + settings.listMonitoredResourceDescriptorsSettings.toBuilder(); + getMonitoredResourceDescriptorSettings = + settings.getMonitoredResourceDescriptorSettings.toBuilder(); + listMetricDescriptorsSettings = settings.listMetricDescriptorsSettings.toBuilder(); + getMetricDescriptorSettings = settings.getMetricDescriptorSettings.toBuilder(); + createMetricDescriptorSettings = settings.createMetricDescriptorSettings.toBuilder(); + deleteMetricDescriptorSettings = settings.deleteMetricDescriptorSettings.toBuilder(); + listTimeSeriesSettings = settings.listTimeSeriesSettings.toBuilder(); + createTimeSeriesSettings = settings.createTimeSeriesSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listMonitoredResourceDescriptorsSettings, + getMonitoredResourceDescriptorSettings, + listMetricDescriptorsSettings, + getMetricDescriptorSettings, + createMetricDescriptorSettings, + deleteMetricDescriptorSettings, + listTimeSeriesSettings, + createTimeSeriesSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to listMonitoredResourceDescriptors. */ + public PagedCallSettings.Builder< + ListMonitoredResourceDescriptorsRequest, + ListMonitoredResourceDescriptorsResponse, + ListMonitoredResourceDescriptorsPagedResponse> + listMonitoredResourceDescriptorsSettings() { + return listMonitoredResourceDescriptorsSettings; + } + + /** Returns the builder for the settings used for calls to getMonitoredResourceDescriptor. */ + public UnaryCallSettings.Builder< + GetMonitoredResourceDescriptorRequest, MonitoredResourceDescriptor> + getMonitoredResourceDescriptorSettings() { + return getMonitoredResourceDescriptorSettings; + } + + /** Returns the builder for the settings used for calls to listMetricDescriptors. */ + public PagedCallSettings.Builder< + ListMetricDescriptorsRequest, + ListMetricDescriptorsResponse, + ListMetricDescriptorsPagedResponse> + listMetricDescriptorsSettings() { + return listMetricDescriptorsSettings; + } + + /** Returns the builder for the settings used for calls to getMetricDescriptor. */ + public UnaryCallSettings.Builder + getMetricDescriptorSettings() { + return getMetricDescriptorSettings; + } + + /** Returns the builder for the settings used for calls to createMetricDescriptor. */ + public UnaryCallSettings.Builder + createMetricDescriptorSettings() { + return createMetricDescriptorSettings; + } + + /** Returns the builder for the settings used for calls to deleteMetricDescriptor. */ + public UnaryCallSettings.Builder + deleteMetricDescriptorSettings() { + return deleteMetricDescriptorSettings; + } + + /** Returns the builder for the settings used for calls to listTimeSeries. */ + public PagedCallSettings.Builder< + ListTimeSeriesRequest, ListTimeSeriesResponse, ListTimeSeriesPagedResponse> + listTimeSeriesSettings() { + return listTimeSeriesSettings; + } + + /** Returns the builder for the settings used for calls to createTimeSeries. */ + public UnaryCallSettings.Builder createTimeSeriesSettings() { + return createTimeSeriesSettings; + } + + @Override + public MetricServiceStubSettings build() throws IOException { + return new MetricServiceStubSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/NotificationChannelServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/NotificationChannelServiceStub.java new file mode 100644 index 00000000..ebfb6fa0 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/NotificationChannelServiceStub.java @@ -0,0 +1,125 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.monitoring.v3.CreateNotificationChannelRequest; +import com.google.monitoring.v3.DeleteNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelDescriptorRequest; +import com.google.monitoring.v3.GetNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse; +import com.google.monitoring.v3.ListNotificationChannelsRequest; +import com.google.monitoring.v3.ListNotificationChannelsResponse; +import com.google.monitoring.v3.NotificationChannel; +import com.google.monitoring.v3.NotificationChannelDescriptor; +import com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.UpdateNotificationChannelRequest; +import com.google.monitoring.v3.VerifyNotificationChannelRequest; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class NotificationChannelServiceStub implements BackgroundResource { + + public UnaryCallable< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listNotificationChannelDescriptorsPagedCallable()"); + } + + public UnaryCallable< + ListNotificationChannelDescriptorsRequest, ListNotificationChannelDescriptorsResponse> + listNotificationChannelDescriptorsCallable() { + throw new UnsupportedOperationException( + "Not implemented: listNotificationChannelDescriptorsCallable()"); + } + + public UnaryCallable + getNotificationChannelDescriptorCallable() { + throw new UnsupportedOperationException( + "Not implemented: getNotificationChannelDescriptorCallable()"); + } + + public UnaryCallable + listNotificationChannelsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listNotificationChannelsPagedCallable()"); + } + + public UnaryCallable + listNotificationChannelsCallable() { + throw new UnsupportedOperationException("Not implemented: listNotificationChannelsCallable()"); + } + + public UnaryCallable + getNotificationChannelCallable() { + throw new UnsupportedOperationException("Not implemented: getNotificationChannelCallable()"); + } + + public UnaryCallable + createNotificationChannelCallable() { + throw new UnsupportedOperationException("Not implemented: createNotificationChannelCallable()"); + } + + public UnaryCallable + updateNotificationChannelCallable() { + throw new UnsupportedOperationException("Not implemented: updateNotificationChannelCallable()"); + } + + public UnaryCallable + deleteNotificationChannelCallable() { + throw new UnsupportedOperationException("Not implemented: deleteNotificationChannelCallable()"); + } + + public UnaryCallable + sendNotificationChannelVerificationCodeCallable() { + throw new UnsupportedOperationException( + "Not implemented: sendNotificationChannelVerificationCodeCallable()"); + } + + public UnaryCallable< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeCallable() { + throw new UnsupportedOperationException( + "Not implemented: getNotificationChannelVerificationCodeCallable()"); + } + + public UnaryCallable + verifyNotificationChannelCallable() { + throw new UnsupportedOperationException("Not implemented: verifyNotificationChannelCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/NotificationChannelServiceStubSettings.java b/src/main/java/com/google/cloud/monitoring/v3/stub/NotificationChannelServiceStubSettings.java new file mode 100644 index 00000000..26b3506a --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/NotificationChannelServiceStubSettings.java @@ -0,0 +1,761 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.CreateNotificationChannelRequest; +import com.google.monitoring.v3.DeleteNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelDescriptorRequest; +import com.google.monitoring.v3.GetNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse; +import com.google.monitoring.v3.ListNotificationChannelsRequest; +import com.google.monitoring.v3.ListNotificationChannelsResponse; +import com.google.monitoring.v3.NotificationChannel; +import com.google.monitoring.v3.NotificationChannelDescriptor; +import com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.UpdateNotificationChannelRequest; +import com.google.monitoring.v3.VerifyNotificationChannelRequest; +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 NotificationChannelServiceStub}. + * + *

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

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

+ * 
+ * NotificationChannelServiceStubSettings.Builder notificationChannelServiceSettingsBuilder =
+ *     NotificationChannelServiceStubSettings.newBuilder();
+ * notificationChannelServiceSettingsBuilder.getNotificationChannelDescriptorSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * NotificationChannelServiceStubSettings notificationChannelServiceSettings = notificationChannelServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class NotificationChannelServiceStubSettings + 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/monitoring") + .add("https://www.googleapis.com/auth/monitoring.read") + .add("https://www.googleapis.com/auth/monitoring.write") + .build(); + + private final PagedCallSettings< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsSettings; + private final UnaryCallSettings< + GetNotificationChannelDescriptorRequest, NotificationChannelDescriptor> + getNotificationChannelDescriptorSettings; + private final PagedCallSettings< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + ListNotificationChannelsPagedResponse> + listNotificationChannelsSettings; + private final UnaryCallSettings + getNotificationChannelSettings; + private final UnaryCallSettings + createNotificationChannelSettings; + private final UnaryCallSettings + updateNotificationChannelSettings; + private final UnaryCallSettings + deleteNotificationChannelSettings; + private final UnaryCallSettings + sendNotificationChannelVerificationCodeSettings; + private final UnaryCallSettings< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeSettings; + private final UnaryCallSettings + verifyNotificationChannelSettings; + + /** Returns the object with the settings used for calls to listNotificationChannelDescriptors. */ + public PagedCallSettings< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsSettings() { + return listNotificationChannelDescriptorsSettings; + } + + /** Returns the object with the settings used for calls to getNotificationChannelDescriptor. */ + public UnaryCallSettings + getNotificationChannelDescriptorSettings() { + return getNotificationChannelDescriptorSettings; + } + + /** Returns the object with the settings used for calls to listNotificationChannels. */ + public PagedCallSettings< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + ListNotificationChannelsPagedResponse> + listNotificationChannelsSettings() { + return listNotificationChannelsSettings; + } + + /** Returns the object with the settings used for calls to getNotificationChannel. */ + public UnaryCallSettings + getNotificationChannelSettings() { + return getNotificationChannelSettings; + } + + /** Returns the object with the settings used for calls to createNotificationChannel. */ + public UnaryCallSettings + createNotificationChannelSettings() { + return createNotificationChannelSettings; + } + + /** Returns the object with the settings used for calls to updateNotificationChannel. */ + public UnaryCallSettings + updateNotificationChannelSettings() { + return updateNotificationChannelSettings; + } + + /** Returns the object with the settings used for calls to deleteNotificationChannel. */ + public UnaryCallSettings + deleteNotificationChannelSettings() { + return deleteNotificationChannelSettings; + } + + /** + * Returns the object with the settings used for calls to sendNotificationChannelVerificationCode. + */ + public UnaryCallSettings + sendNotificationChannelVerificationCodeSettings() { + return sendNotificationChannelVerificationCodeSettings; + } + + /** + * Returns the object with the settings used for calls to getNotificationChannelVerificationCode. + */ + public UnaryCallSettings< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeSettings() { + return getNotificationChannelVerificationCodeSettings; + } + + /** Returns the object with the settings used for calls to verifyNotificationChannel. */ + public UnaryCallSettings + verifyNotificationChannelSettings() { + return verifyNotificationChannelSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public NotificationChannelServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcNotificationChannelServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + 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 "monitoring.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(NotificationChannelServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected NotificationChannelServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listNotificationChannelDescriptorsSettings = + settingsBuilder.listNotificationChannelDescriptorsSettings().build(); + getNotificationChannelDescriptorSettings = + settingsBuilder.getNotificationChannelDescriptorSettings().build(); + listNotificationChannelsSettings = settingsBuilder.listNotificationChannelsSettings().build(); + getNotificationChannelSettings = settingsBuilder.getNotificationChannelSettings().build(); + createNotificationChannelSettings = settingsBuilder.createNotificationChannelSettings().build(); + updateNotificationChannelSettings = settingsBuilder.updateNotificationChannelSettings().build(); + deleteNotificationChannelSettings = settingsBuilder.deleteNotificationChannelSettings().build(); + sendNotificationChannelVerificationCodeSettings = + settingsBuilder.sendNotificationChannelVerificationCodeSettings().build(); + getNotificationChannelVerificationCodeSettings = + settingsBuilder.getNotificationChannelVerificationCodeSettings().build(); + verifyNotificationChannelSettings = settingsBuilder.verifyNotificationChannelSettings().build(); + } + + private static final PagedListDescriptor< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor> + LIST_NOTIFICATION_CHANNEL_DESCRIPTORS_PAGE_STR_DESC = + new PagedListDescriptor< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListNotificationChannelDescriptorsRequest injectToken( + ListNotificationChannelDescriptorsRequest payload, String token) { + return ListNotificationChannelDescriptorsRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListNotificationChannelDescriptorsRequest injectPageSize( + ListNotificationChannelDescriptorsRequest payload, int pageSize) { + return ListNotificationChannelDescriptorsRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListNotificationChannelDescriptorsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListNotificationChannelDescriptorsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListNotificationChannelDescriptorsResponse payload) { + return payload.getChannelDescriptorsList() != null + ? payload.getChannelDescriptorsList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + ListNotificationChannelsRequest, ListNotificationChannelsResponse, NotificationChannel> + LIST_NOTIFICATION_CHANNELS_PAGE_STR_DESC = + new PagedListDescriptor< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListNotificationChannelsRequest injectToken( + ListNotificationChannelsRequest payload, String token) { + return ListNotificationChannelsRequest.newBuilder(payload) + .setPageToken(token) + .build(); + } + + @Override + public ListNotificationChannelsRequest injectPageSize( + ListNotificationChannelsRequest payload, int pageSize) { + return ListNotificationChannelsRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListNotificationChannelsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListNotificationChannelsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListNotificationChannelsResponse payload) { + return payload.getNotificationChannelsList() != null + ? payload.getNotificationChannelsList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + ListNotificationChannelDescriptorsPagedResponse> + LIST_NOTIFICATION_CHANNEL_DESCRIPTORS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + ListNotificationChannelDescriptorsPagedResponse>() { + @Override + public ApiFuture + getFuturePagedResponse( + UnaryCallable< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse> + callable, + ListNotificationChannelDescriptorsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + NotificationChannelDescriptor> + pageContext = + PageContext.create( + callable, + LIST_NOTIFICATION_CHANNEL_DESCRIPTORS_PAGE_STR_DESC, + request, + context); + return ListNotificationChannelDescriptorsPagedResponse.createAsync( + pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + ListNotificationChannelsPagedResponse> + LIST_NOTIFICATION_CHANNELS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + ListNotificationChannelsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListNotificationChannelsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + NotificationChannel> + pageContext = + PageContext.create( + callable, LIST_NOTIFICATION_CHANNELS_PAGE_STR_DESC, request, context); + return ListNotificationChannelsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for NotificationChannelServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsSettings; + private final UnaryCallSettings.Builder< + GetNotificationChannelDescriptorRequest, NotificationChannelDescriptor> + getNotificationChannelDescriptorSettings; + private final PagedCallSettings.Builder< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + ListNotificationChannelsPagedResponse> + listNotificationChannelsSettings; + private final UnaryCallSettings.Builder + getNotificationChannelSettings; + private final UnaryCallSettings.Builder + createNotificationChannelSettings; + private final UnaryCallSettings.Builder + updateNotificationChannelSettings; + private final UnaryCallSettings.Builder + deleteNotificationChannelSettings; + private final UnaryCallSettings.Builder + sendNotificationChannelVerificationCodeSettings; + private final UnaryCallSettings.Builder< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeSettings; + private final UnaryCallSettings.Builder + verifyNotificationChannelSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + listNotificationChannelDescriptorsSettings = + PagedCallSettings.newBuilder(LIST_NOTIFICATION_CHANNEL_DESCRIPTORS_PAGE_STR_FACT); + + getNotificationChannelDescriptorSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listNotificationChannelsSettings = + PagedCallSettings.newBuilder(LIST_NOTIFICATION_CHANNELS_PAGE_STR_FACT); + + getNotificationChannelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createNotificationChannelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateNotificationChannelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteNotificationChannelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + sendNotificationChannelVerificationCodeSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getNotificationChannelVerificationCodeSettings = + UnaryCallSettings.newUnaryCallSettingsBuilder(); + + verifyNotificationChannelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listNotificationChannelDescriptorsSettings, + getNotificationChannelDescriptorSettings, + listNotificationChannelsSettings, + getNotificationChannelSettings, + createNotificationChannelSettings, + updateNotificationChannelSettings, + deleteNotificationChannelSettings, + sendNotificationChannelVerificationCodeSettings, + getNotificationChannelVerificationCodeSettings, + verifyNotificationChannelSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .listNotificationChannelDescriptorsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getNotificationChannelDescriptorSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listNotificationChannelsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getNotificationChannelSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createNotificationChannelSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateNotificationChannelSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteNotificationChannelSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .sendNotificationChannelVerificationCodeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getNotificationChannelVerificationCodeSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .verifyNotificationChannelSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(NotificationChannelServiceStubSettings settings) { + super(settings); + + listNotificationChannelDescriptorsSettings = + settings.listNotificationChannelDescriptorsSettings.toBuilder(); + getNotificationChannelDescriptorSettings = + settings.getNotificationChannelDescriptorSettings.toBuilder(); + listNotificationChannelsSettings = settings.listNotificationChannelsSettings.toBuilder(); + getNotificationChannelSettings = settings.getNotificationChannelSettings.toBuilder(); + createNotificationChannelSettings = settings.createNotificationChannelSettings.toBuilder(); + updateNotificationChannelSettings = settings.updateNotificationChannelSettings.toBuilder(); + deleteNotificationChannelSettings = settings.deleteNotificationChannelSettings.toBuilder(); + sendNotificationChannelVerificationCodeSettings = + settings.sendNotificationChannelVerificationCodeSettings.toBuilder(); + getNotificationChannelVerificationCodeSettings = + settings.getNotificationChannelVerificationCodeSettings.toBuilder(); + verifyNotificationChannelSettings = settings.verifyNotificationChannelSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listNotificationChannelDescriptorsSettings, + getNotificationChannelDescriptorSettings, + listNotificationChannelsSettings, + getNotificationChannelSettings, + createNotificationChannelSettings, + updateNotificationChannelSettings, + deleteNotificationChannelSettings, + sendNotificationChannelVerificationCodeSettings, + getNotificationChannelVerificationCodeSettings, + verifyNotificationChannelSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** + * Returns the builder for the settings used for calls to listNotificationChannelDescriptors. + */ + public PagedCallSettings.Builder< + ListNotificationChannelDescriptorsRequest, + ListNotificationChannelDescriptorsResponse, + ListNotificationChannelDescriptorsPagedResponse> + listNotificationChannelDescriptorsSettings() { + return listNotificationChannelDescriptorsSettings; + } + + /** Returns the builder for the settings used for calls to getNotificationChannelDescriptor. */ + public UnaryCallSettings.Builder< + GetNotificationChannelDescriptorRequest, NotificationChannelDescriptor> + getNotificationChannelDescriptorSettings() { + return getNotificationChannelDescriptorSettings; + } + + /** Returns the builder for the settings used for calls to listNotificationChannels. */ + public PagedCallSettings.Builder< + ListNotificationChannelsRequest, + ListNotificationChannelsResponse, + ListNotificationChannelsPagedResponse> + listNotificationChannelsSettings() { + return listNotificationChannelsSettings; + } + + /** Returns the builder for the settings used for calls to getNotificationChannel. */ + public UnaryCallSettings.Builder + getNotificationChannelSettings() { + return getNotificationChannelSettings; + } + + /** Returns the builder for the settings used for calls to createNotificationChannel. */ + public UnaryCallSettings.Builder + createNotificationChannelSettings() { + return createNotificationChannelSettings; + } + + /** Returns the builder for the settings used for calls to updateNotificationChannel. */ + public UnaryCallSettings.Builder + updateNotificationChannelSettings() { + return updateNotificationChannelSettings; + } + + /** Returns the builder for the settings used for calls to deleteNotificationChannel. */ + public UnaryCallSettings.Builder + deleteNotificationChannelSettings() { + return deleteNotificationChannelSettings; + } + + /** + * Returns the builder for the settings used for calls to + * sendNotificationChannelVerificationCode. + */ + public UnaryCallSettings.Builder + sendNotificationChannelVerificationCodeSettings() { + return sendNotificationChannelVerificationCodeSettings; + } + + /** + * Returns the builder for the settings used for calls to + * getNotificationChannelVerificationCode. + */ + public UnaryCallSettings.Builder< + GetNotificationChannelVerificationCodeRequest, + GetNotificationChannelVerificationCodeResponse> + getNotificationChannelVerificationCodeSettings() { + return getNotificationChannelVerificationCodeSettings; + } + + /** Returns the builder for the settings used for calls to verifyNotificationChannel. */ + public UnaryCallSettings.Builder + verifyNotificationChannelSettings() { + return verifyNotificationChannelSettings; + } + + @Override + public NotificationChannelServiceStubSettings build() throws IOException { + return new NotificationChannelServiceStubSettings(this); + } + } +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/UptimeCheckServiceStub.java b/src/main/java/com/google/cloud/monitoring/v3/stub/UptimeCheckServiceStub.java new file mode 100644 index 00000000..ef9d02ff --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/UptimeCheckServiceStub.java @@ -0,0 +1,88 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse; +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.monitoring.v3.CreateUptimeCheckConfigRequest; +import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest; +import com.google.monitoring.v3.GetUptimeCheckConfigRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsResponse; +import com.google.monitoring.v3.ListUptimeCheckIpsRequest; +import com.google.monitoring.v3.ListUptimeCheckIpsResponse; +import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest; +import com.google.monitoring.v3.UptimeCheckConfig; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Stackdriver Monitoring API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator") +@BetaApi("A restructuring of stub classes is planned, so this may break in the future") +public abstract class UptimeCheckServiceStub implements BackgroundResource { + + public UnaryCallable + listUptimeCheckConfigsPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listUptimeCheckConfigsPagedCallable()"); + } + + public UnaryCallable + listUptimeCheckConfigsCallable() { + throw new UnsupportedOperationException("Not implemented: listUptimeCheckConfigsCallable()"); + } + + public UnaryCallable + getUptimeCheckConfigCallable() { + throw new UnsupportedOperationException("Not implemented: getUptimeCheckConfigCallable()"); + } + + public UnaryCallable + createUptimeCheckConfigCallable() { + throw new UnsupportedOperationException("Not implemented: createUptimeCheckConfigCallable()"); + } + + public UnaryCallable + updateUptimeCheckConfigCallable() { + throw new UnsupportedOperationException("Not implemented: updateUptimeCheckConfigCallable()"); + } + + public UnaryCallable deleteUptimeCheckConfigCallable() { + throw new UnsupportedOperationException("Not implemented: deleteUptimeCheckConfigCallable()"); + } + + public UnaryCallable + listUptimeCheckIpsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listUptimeCheckIpsPagedCallable()"); + } + + public UnaryCallable + listUptimeCheckIpsCallable() { + throw new UnsupportedOperationException("Not implemented: listUptimeCheckIpsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/src/main/java/com/google/cloud/monitoring/v3/stub/UptimeCheckServiceStubSettings.java b/src/main/java/com/google/cloud/monitoring/v3/stub/UptimeCheckServiceStubSettings.java new file mode 100644 index 00000000..e482d3a6 --- /dev/null +++ b/src/main/java/com/google/cloud/monitoring/v3/stub/UptimeCheckServiceStubSettings.java @@ -0,0 +1,580 @@ +/* + * 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.monitoring.v3.stub; + +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse; +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckIpsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.CreateUptimeCheckConfigRequest; +import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest; +import com.google.monitoring.v3.GetUptimeCheckConfigRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsResponse; +import com.google.monitoring.v3.ListUptimeCheckIpsRequest; +import com.google.monitoring.v3.ListUptimeCheckIpsResponse; +import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest; +import com.google.monitoring.v3.UptimeCheckConfig; +import com.google.monitoring.v3.UptimeCheckIp; +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 UptimeCheckServiceStub}. + * + *

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

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

+ * 
+ * UptimeCheckServiceStubSettings.Builder uptimeCheckServiceSettingsBuilder =
+ *     UptimeCheckServiceStubSettings.newBuilder();
+ * uptimeCheckServiceSettingsBuilder.getUptimeCheckConfigSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * UptimeCheckServiceStubSettings uptimeCheckServiceSettings = uptimeCheckServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +public class UptimeCheckServiceStubSettings 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/monitoring") + .add("https://www.googleapis.com/auth/monitoring.read") + .add("https://www.googleapis.com/auth/monitoring.write") + .build(); + + private final PagedCallSettings< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + ListUptimeCheckConfigsPagedResponse> + listUptimeCheckConfigsSettings; + private final UnaryCallSettings + getUptimeCheckConfigSettings; + private final UnaryCallSettings + createUptimeCheckConfigSettings; + private final UnaryCallSettings + updateUptimeCheckConfigSettings; + private final UnaryCallSettings + deleteUptimeCheckConfigSettings; + private final PagedCallSettings< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, ListUptimeCheckIpsPagedResponse> + listUptimeCheckIpsSettings; + + /** Returns the object with the settings used for calls to listUptimeCheckConfigs. */ + public PagedCallSettings< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + ListUptimeCheckConfigsPagedResponse> + listUptimeCheckConfigsSettings() { + return listUptimeCheckConfigsSettings; + } + + /** Returns the object with the settings used for calls to getUptimeCheckConfig. */ + public UnaryCallSettings + getUptimeCheckConfigSettings() { + return getUptimeCheckConfigSettings; + } + + /** Returns the object with the settings used for calls to createUptimeCheckConfig. */ + public UnaryCallSettings + createUptimeCheckConfigSettings() { + return createUptimeCheckConfigSettings; + } + + /** Returns the object with the settings used for calls to updateUptimeCheckConfig. */ + public UnaryCallSettings + updateUptimeCheckConfigSettings() { + return updateUptimeCheckConfigSettings; + } + + /** Returns the object with the settings used for calls to deleteUptimeCheckConfig. */ + public UnaryCallSettings + deleteUptimeCheckConfigSettings() { + return deleteUptimeCheckConfigSettings; + } + + /** Returns the object with the settings used for calls to listUptimeCheckIps. */ + public PagedCallSettings< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, ListUptimeCheckIpsPagedResponse> + listUptimeCheckIpsSettings() { + return listUptimeCheckIpsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public UptimeCheckServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcUptimeCheckServiceStub.create(this); + } else { + throw new UnsupportedOperationException( + "Transport not supported: " + 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 "monitoring.googleapis.com:443"; + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return DEFAULT_SERVICE_SCOPES; + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return InstantiatingGrpcChannelProvider.newBuilder() + .setMaxInboundMessageSize(Integer.MAX_VALUE); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return defaultGrpcTransportProviderBuilder().build(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(UptimeCheckServiceStubSettings.class)) + .setTransportToken( + GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder() { + return Builder.createDefault(); + } + + /** Returns a new builder for this class. */ + public static Builder newBuilder(ClientContext clientContext) { + return new Builder(clientContext); + } + + /** Returns a builder containing all the values of this settings class. */ + public Builder toBuilder() { + return new Builder(this); + } + + protected UptimeCheckServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listUptimeCheckConfigsSettings = settingsBuilder.listUptimeCheckConfigsSettings().build(); + getUptimeCheckConfigSettings = settingsBuilder.getUptimeCheckConfigSettings().build(); + createUptimeCheckConfigSettings = settingsBuilder.createUptimeCheckConfigSettings().build(); + updateUptimeCheckConfigSettings = settingsBuilder.updateUptimeCheckConfigSettings().build(); + deleteUptimeCheckConfigSettings = settingsBuilder.deleteUptimeCheckConfigSettings().build(); + listUptimeCheckIpsSettings = settingsBuilder.listUptimeCheckIpsSettings().build(); + } + + private static final PagedListDescriptor< + ListUptimeCheckConfigsRequest, ListUptimeCheckConfigsResponse, UptimeCheckConfig> + LIST_UPTIME_CHECK_CONFIGS_PAGE_STR_DESC = + new PagedListDescriptor< + ListUptimeCheckConfigsRequest, ListUptimeCheckConfigsResponse, UptimeCheckConfig>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListUptimeCheckConfigsRequest injectToken( + ListUptimeCheckConfigsRequest payload, String token) { + return ListUptimeCheckConfigsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListUptimeCheckConfigsRequest injectPageSize( + ListUptimeCheckConfigsRequest payload, int pageSize) { + return ListUptimeCheckConfigsRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListUptimeCheckConfigsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListUptimeCheckConfigsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListUptimeCheckConfigsResponse payload) { + return payload.getUptimeCheckConfigsList() != null + ? payload.getUptimeCheckConfigsList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, UptimeCheckIp> + LIST_UPTIME_CHECK_IPS_PAGE_STR_DESC = + new PagedListDescriptor< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, UptimeCheckIp>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListUptimeCheckIpsRequest injectToken( + ListUptimeCheckIpsRequest payload, String token) { + return ListUptimeCheckIpsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListUptimeCheckIpsRequest injectPageSize( + ListUptimeCheckIpsRequest payload, int pageSize) { + return ListUptimeCheckIpsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListUptimeCheckIpsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListUptimeCheckIpsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListUptimeCheckIpsResponse payload) { + return payload.getUptimeCheckIpsList() != null + ? payload.getUptimeCheckIpsList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + ListUptimeCheckConfigsPagedResponse> + LIST_UPTIME_CHECK_CONFIGS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + ListUptimeCheckConfigsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListUptimeCheckConfigsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + UptimeCheckConfig> + pageContext = + PageContext.create( + callable, LIST_UPTIME_CHECK_CONFIGS_PAGE_STR_DESC, request, context); + return ListUptimeCheckConfigsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, ListUptimeCheckIpsPagedResponse> + LIST_UPTIME_CHECK_IPS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListUptimeCheckIpsRequest, + ListUptimeCheckIpsResponse, + ListUptimeCheckIpsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListUptimeCheckIpsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_UPTIME_CHECK_IPS_PAGE_STR_DESC, request, context); + return ListUptimeCheckIpsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for UptimeCheckServiceStubSettings. */ + public static class Builder + extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + ListUptimeCheckConfigsPagedResponse> + listUptimeCheckConfigsSettings; + private final UnaryCallSettings.Builder + getUptimeCheckConfigSettings; + private final UnaryCallSettings.Builder + createUptimeCheckConfigSettings; + private final UnaryCallSettings.Builder + updateUptimeCheckConfigSettings; + private final UnaryCallSettings.Builder + deleteUptimeCheckConfigSettings; + private final PagedCallSettings.Builder< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, ListUptimeCheckIpsPagedResponse> + listUptimeCheckIpsSettings; + + private static final ImmutableMap> + RETRYABLE_CODE_DEFINITIONS; + + static { + ImmutableMap.Builder> definitions = + ImmutableMap.builder(); + definitions.put( + "idempotent", + ImmutableSet.copyOf( + Lists.newArrayList( + StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE))); + definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.newArrayList())); + RETRYABLE_CODE_DEFINITIONS = definitions.build(); + } + + private static final ImmutableMap RETRY_PARAM_DEFINITIONS; + + static { + ImmutableMap.Builder definitions = ImmutableMap.builder(); + RetrySettings settings = null; + settings = + RetrySettings.newBuilder() + .setInitialRetryDelay(Duration.ofMillis(100L)) + .setRetryDelayMultiplier(1.3) + .setMaxRetryDelay(Duration.ofMillis(60000L)) + .setInitialRpcTimeout(Duration.ofMillis(20000L)) + .setRpcTimeoutMultiplier(1.0) + .setMaxRpcTimeout(Duration.ofMillis(20000L)) + .setTotalTimeout(Duration.ofMillis(600000L)) + .build(); + definitions.put("default", settings); + RETRY_PARAM_DEFINITIONS = definitions.build(); + } + + protected Builder() { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(clientContext); + + listUptimeCheckConfigsSettings = + PagedCallSettings.newBuilder(LIST_UPTIME_CHECK_CONFIGS_PAGE_STR_FACT); + + getUptimeCheckConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createUptimeCheckConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateUptimeCheckConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + deleteUptimeCheckConfigSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listUptimeCheckIpsSettings = + PagedCallSettings.newBuilder(LIST_UPTIME_CHECK_IPS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listUptimeCheckConfigsSettings, + getUptimeCheckConfigSettings, + createUptimeCheckConfigSettings, + updateUptimeCheckConfigSettings, + deleteUptimeCheckConfigSettings, + listUptimeCheckIpsSettings); + + initDefaults(this); + } + + private static Builder createDefault() { + Builder builder = new Builder((ClientContext) null); + builder.setTransportChannelProvider(defaultTransportChannelProvider()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + return initDefaults(builder); + } + + private static Builder initDefaults(Builder builder) { + + builder + .listUptimeCheckConfigsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getUptimeCheckConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createUptimeCheckConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateUptimeCheckConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteUptimeCheckConfigSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listUptimeCheckIpsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(UptimeCheckServiceStubSettings settings) { + super(settings); + + listUptimeCheckConfigsSettings = settings.listUptimeCheckConfigsSettings.toBuilder(); + getUptimeCheckConfigSettings = settings.getUptimeCheckConfigSettings.toBuilder(); + createUptimeCheckConfigSettings = settings.createUptimeCheckConfigSettings.toBuilder(); + updateUptimeCheckConfigSettings = settings.updateUptimeCheckConfigSettings.toBuilder(); + deleteUptimeCheckConfigSettings = settings.deleteUptimeCheckConfigSettings.toBuilder(); + listUptimeCheckIpsSettings = settings.listUptimeCheckIpsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + listUptimeCheckConfigsSettings, + getUptimeCheckConfigSettings, + createUptimeCheckConfigSettings, + updateUptimeCheckConfigSettings, + deleteUptimeCheckConfigSettings, + listUptimeCheckIpsSettings); + } + + // NEXT_MAJOR_VER: remove 'throws Exception' + /** + * Applies the given settings updater function to all of the unary API methods in this service. + * + *

Note: This method does not support applying settings to streaming methods. + */ + public Builder applyToAllUnaryMethods( + ApiFunction, Void> settingsUpdater) throws Exception { + super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater); + return this; + } + + public ImmutableList> unaryMethodSettingsBuilders() { + return unaryMethodSettingsBuilders; + } + + /** Returns the builder for the settings used for calls to listUptimeCheckConfigs. */ + public PagedCallSettings.Builder< + ListUptimeCheckConfigsRequest, + ListUptimeCheckConfigsResponse, + ListUptimeCheckConfigsPagedResponse> + listUptimeCheckConfigsSettings() { + return listUptimeCheckConfigsSettings; + } + + /** Returns the builder for the settings used for calls to getUptimeCheckConfig. */ + public UnaryCallSettings.Builder + getUptimeCheckConfigSettings() { + return getUptimeCheckConfigSettings; + } + + /** Returns the builder for the settings used for calls to createUptimeCheckConfig. */ + public UnaryCallSettings.Builder + createUptimeCheckConfigSettings() { + return createUptimeCheckConfigSettings; + } + + /** Returns the builder for the settings used for calls to updateUptimeCheckConfig. */ + public UnaryCallSettings.Builder + updateUptimeCheckConfigSettings() { + return updateUptimeCheckConfigSettings; + } + + /** Returns the builder for the settings used for calls to deleteUptimeCheckConfig. */ + public UnaryCallSettings.Builder + deleteUptimeCheckConfigSettings() { + return deleteUptimeCheckConfigSettings; + } + + /** Returns the builder for the settings used for calls to listUptimeCheckIps. */ + public PagedCallSettings.Builder< + ListUptimeCheckIpsRequest, ListUptimeCheckIpsResponse, ListUptimeCheckIpsPagedResponse> + listUptimeCheckIpsSettings() { + return listUptimeCheckIpsSettings; + } + + @Override + public UptimeCheckServiceStubSettings build() throws IOException { + return new UptimeCheckServiceStubSettings(this); + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClientTest.java b/src/test/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClientTest.java new file mode 100644 index 00000000..6b1d701f --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/AlertPolicyServiceClientTest.java @@ -0,0 +1,317 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.AlertPolicyServiceClient.ListAlertPoliciesPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.AlertPolicy; +import com.google.monitoring.v3.AlertPolicyName; +import com.google.monitoring.v3.CreateAlertPolicyRequest; +import com.google.monitoring.v3.DeleteAlertPolicyRequest; +import com.google.monitoring.v3.GetAlertPolicyRequest; +import com.google.monitoring.v3.ListAlertPoliciesRequest; +import com.google.monitoring.v3.ListAlertPoliciesResponse; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.UpdateAlertPolicyRequest; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class AlertPolicyServiceClientTest { + private static MockAlertPolicyService mockAlertPolicyService; + private static MockGroupService mockGroupService; + private static MockMetricService mockMetricService; + private static MockNotificationChannelService mockNotificationChannelService; + private static MockUptimeCheckService mockUptimeCheckService; + private static MockServiceHelper serviceHelper; + private AlertPolicyServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockAlertPolicyService = new MockAlertPolicyService(); + mockGroupService = new MockGroupService(); + mockMetricService = new MockMetricService(); + mockNotificationChannelService = new MockNotificationChannelService(); + mockUptimeCheckService = new MockUptimeCheckService(); + serviceHelper = + new MockServiceHelper( + "in-process-1", + Arrays.asList( + mockAlertPolicyService, + mockGroupService, + mockMetricService, + mockNotificationChannelService, + mockUptimeCheckService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + AlertPolicyServiceSettings settings = + AlertPolicyServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = AlertPolicyServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void listAlertPoliciesTest() { + String nextPageToken = ""; + AlertPolicy alertPoliciesElement = AlertPolicy.newBuilder().build(); + List alertPolicies = Arrays.asList(alertPoliciesElement); + ListAlertPoliciesResponse expectedResponse = + ListAlertPoliciesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllAlertPolicies(alertPolicies) + .build(); + mockAlertPolicyService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + + ListAlertPoliciesPagedResponse pagedListResponse = client.listAlertPolicies(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAlertPoliciesList().get(0), resources.get(0)); + + List actualRequests = mockAlertPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListAlertPoliciesRequest actualRequest = (ListAlertPoliciesRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listAlertPoliciesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAlertPolicyService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + + client.listAlertPolicies(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getAlertPolicyTest() { + String name2 = "name2-1052831874"; + String displayName = "displayName1615086568"; + AlertPolicy expectedResponse = + AlertPolicy.newBuilder().setName(name2).setDisplayName(displayName).build(); + mockAlertPolicyService.addResponse(expectedResponse); + + AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]"); + + AlertPolicy actualResponse = client.getAlertPolicy(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockAlertPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetAlertPolicyRequest actualRequest = (GetAlertPolicyRequest) actualRequests.get(0); + + Assert.assertEquals(name, AlertPolicyName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getAlertPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAlertPolicyService.addException(exception); + + try { + AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]"); + + client.getAlertPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createAlertPolicyTest() { + String name2 = "name2-1052831874"; + String displayName = "displayName1615086568"; + AlertPolicy expectedResponse = + AlertPolicy.newBuilder().setName(name2).setDisplayName(displayName).build(); + mockAlertPolicyService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + AlertPolicy alertPolicy = AlertPolicy.newBuilder().build(); + + AlertPolicy actualResponse = client.createAlertPolicy(name, alertPolicy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockAlertPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateAlertPolicyRequest actualRequest = (CreateAlertPolicyRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertEquals(alertPolicy, actualRequest.getAlertPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createAlertPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAlertPolicyService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + AlertPolicy alertPolicy = AlertPolicy.newBuilder().build(); + + client.createAlertPolicy(name, alertPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteAlertPolicyTest() { + Empty expectedResponse = Empty.newBuilder().build(); + mockAlertPolicyService.addResponse(expectedResponse); + + AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]"); + + client.deleteAlertPolicy(name); + + List actualRequests = mockAlertPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteAlertPolicyRequest actualRequest = (DeleteAlertPolicyRequest) actualRequests.get(0); + + Assert.assertEquals(name, AlertPolicyName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteAlertPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAlertPolicyService.addException(exception); + + try { + AlertPolicyName name = AlertPolicyName.of("[PROJECT]", "[ALERT_POLICY]"); + + client.deleteAlertPolicy(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateAlertPolicyTest() { + String name = "name3373707"; + String displayName = "displayName1615086568"; + AlertPolicy expectedResponse = + AlertPolicy.newBuilder().setName(name).setDisplayName(displayName).build(); + mockAlertPolicyService.addResponse(expectedResponse); + + FieldMask updateMask = FieldMask.newBuilder().build(); + AlertPolicy alertPolicy = AlertPolicy.newBuilder().build(); + + AlertPolicy actualResponse = client.updateAlertPolicy(updateMask, alertPolicy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockAlertPolicyService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateAlertPolicyRequest actualRequest = (UpdateAlertPolicyRequest) actualRequests.get(0); + + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertEquals(alertPolicy, actualRequest.getAlertPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateAlertPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockAlertPolicyService.addException(exception); + + try { + FieldMask updateMask = FieldMask.newBuilder().build(); + AlertPolicy alertPolicy = AlertPolicy.newBuilder().build(); + + client.updateAlertPolicy(updateMask, alertPolicy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/GroupServiceClientTest.java b/src/test/java/com/google/cloud/monitoring/v3/GroupServiceClientTest.java new file mode 100644 index 00000000..802f5158 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/GroupServiceClientTest.java @@ -0,0 +1,391 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupMembersPagedResponse; +import static com.google.cloud.monitoring.v3.GroupServiceClient.ListGroupsPagedResponse; + +import com.google.api.MonitoredResource; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.CreateGroupRequest; +import com.google.monitoring.v3.DeleteGroupRequest; +import com.google.monitoring.v3.GetGroupRequest; +import com.google.monitoring.v3.Group; +import com.google.monitoring.v3.GroupName; +import com.google.monitoring.v3.ListGroupMembersRequest; +import com.google.monitoring.v3.ListGroupMembersResponse; +import com.google.monitoring.v3.ListGroupsRequest; +import com.google.monitoring.v3.ListGroupsResponse; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.UpdateGroupRequest; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class GroupServiceClientTest { + private static MockAlertPolicyService mockAlertPolicyService; + private static MockGroupService mockGroupService; + private static MockMetricService mockMetricService; + private static MockNotificationChannelService mockNotificationChannelService; + private static MockUptimeCheckService mockUptimeCheckService; + private static MockServiceHelper serviceHelper; + private GroupServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockAlertPolicyService = new MockAlertPolicyService(); + mockGroupService = new MockGroupService(); + mockMetricService = new MockMetricService(); + mockNotificationChannelService = new MockNotificationChannelService(); + mockUptimeCheckService = new MockUptimeCheckService(); + serviceHelper = + new MockServiceHelper( + "in-process-1", + Arrays.asList( + mockAlertPolicyService, + mockGroupService, + mockMetricService, + mockNotificationChannelService, + mockUptimeCheckService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + GroupServiceSettings settings = + GroupServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = GroupServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void listGroupsTest() { + String nextPageToken = ""; + Group groupElement = Group.newBuilder().build(); + List group = Arrays.asList(groupElement); + ListGroupsResponse expectedResponse = + ListGroupsResponse.newBuilder().setNextPageToken(nextPageToken).addAllGroup(group).build(); + mockGroupService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + + ListGroupsPagedResponse pagedListResponse = client.listGroups(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getGroupList().get(0), resources.get(0)); + + List actualRequests = mockGroupService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListGroupsRequest actualRequest = (ListGroupsRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listGroupsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockGroupService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + + client.listGroups(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getGroupTest() { + GroupName name2 = GroupName.of("[PROJECT]", "[GROUP]"); + String displayName = "displayName1615086568"; + GroupName parentName = GroupName.of("[PROJECT]", "[GROUP]"); + String filter = "filter-1274492040"; + boolean isCluster = false; + Group expectedResponse = + Group.newBuilder() + .setName(name2.toString()) + .setDisplayName(displayName) + .setParentName(parentName.toString()) + .setFilter(filter) + .setIsCluster(isCluster) + .build(); + mockGroupService.addResponse(expectedResponse); + + GroupName name = GroupName.of("[PROJECT]", "[GROUP]"); + + Group actualResponse = client.getGroup(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockGroupService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetGroupRequest actualRequest = (GetGroupRequest) actualRequests.get(0); + + Assert.assertEquals(name, GroupName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getGroupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockGroupService.addException(exception); + + try { + GroupName name = GroupName.of("[PROJECT]", "[GROUP]"); + + client.getGroup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createGroupTest() { + GroupName name2 = GroupName.of("[PROJECT]", "[GROUP]"); + String displayName = "displayName1615086568"; + GroupName parentName = GroupName.of("[PROJECT]", "[GROUP]"); + String filter = "filter-1274492040"; + boolean isCluster = false; + Group expectedResponse = + Group.newBuilder() + .setName(name2.toString()) + .setDisplayName(displayName) + .setParentName(parentName.toString()) + .setFilter(filter) + .setIsCluster(isCluster) + .build(); + mockGroupService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + Group group = Group.newBuilder().build(); + + Group actualResponse = client.createGroup(name, group); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockGroupService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateGroupRequest actualRequest = (CreateGroupRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertEquals(group, actualRequest.getGroup()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createGroupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockGroupService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + Group group = Group.newBuilder().build(); + + client.createGroup(name, group); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateGroupTest() { + GroupName name = GroupName.of("[PROJECT]", "[GROUP]"); + String displayName = "displayName1615086568"; + GroupName parentName = GroupName.of("[PROJECT]", "[GROUP]"); + String filter = "filter-1274492040"; + boolean isCluster = false; + Group expectedResponse = + Group.newBuilder() + .setName(name.toString()) + .setDisplayName(displayName) + .setParentName(parentName.toString()) + .setFilter(filter) + .setIsCluster(isCluster) + .build(); + mockGroupService.addResponse(expectedResponse); + + Group group = Group.newBuilder().build(); + + Group actualResponse = client.updateGroup(group); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockGroupService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateGroupRequest actualRequest = (UpdateGroupRequest) actualRequests.get(0); + + Assert.assertEquals(group, actualRequest.getGroup()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateGroupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockGroupService.addException(exception); + + try { + Group group = Group.newBuilder().build(); + + client.updateGroup(group); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteGroupTest() { + Empty expectedResponse = Empty.newBuilder().build(); + mockGroupService.addResponse(expectedResponse); + + GroupName name = GroupName.of("[PROJECT]", "[GROUP]"); + + client.deleteGroup(name); + + List actualRequests = mockGroupService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteGroupRequest actualRequest = (DeleteGroupRequest) actualRequests.get(0); + + Assert.assertEquals(name, GroupName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteGroupExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockGroupService.addException(exception); + + try { + GroupName name = GroupName.of("[PROJECT]", "[GROUP]"); + + client.deleteGroup(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listGroupMembersTest() { + String nextPageToken = ""; + int totalSize = 705419236; + MonitoredResource membersElement = MonitoredResource.newBuilder().build(); + List members = Arrays.asList(membersElement); + ListGroupMembersResponse expectedResponse = + ListGroupMembersResponse.newBuilder() + .setNextPageToken(nextPageToken) + .setTotalSize(totalSize) + .addAllMembers(members) + .build(); + mockGroupService.addResponse(expectedResponse); + + GroupName name = GroupName.of("[PROJECT]", "[GROUP]"); + + ListGroupMembersPagedResponse pagedListResponse = client.listGroupMembers(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getMembersList().get(0), resources.get(0)); + + List actualRequests = mockGroupService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListGroupMembersRequest actualRequest = (ListGroupMembersRequest) actualRequests.get(0); + + Assert.assertEquals(name, GroupName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listGroupMembersExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockGroupService.addException(exception); + + try { + GroupName name = GroupName.of("[PROJECT]", "[GROUP]"); + + client.listGroupMembers(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/MetricServiceClientTest.java b/src/test/java/com/google/cloud/monitoring/v3/MetricServiceClientTest.java new file mode 100644 index 00000000..24a9a003 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MetricServiceClientTest.java @@ -0,0 +1,507 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMetricDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMonitoredResourceDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListTimeSeriesPagedResponse; + +import com.google.api.MetricDescriptor; +import com.google.api.MonitoredResourceDescriptor; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.CreateMetricDescriptorRequest; +import com.google.monitoring.v3.CreateTimeSeriesRequest; +import com.google.monitoring.v3.DeleteMetricDescriptorRequest; +import com.google.monitoring.v3.GetMetricDescriptorRequest; +import com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest; +import com.google.monitoring.v3.ListMetricDescriptorsRequest; +import com.google.monitoring.v3.ListMetricDescriptorsResponse; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; +import com.google.monitoring.v3.ListTimeSeriesRequest; +import com.google.monitoring.v3.ListTimeSeriesResponse; +import com.google.monitoring.v3.MetricDescriptorName; +import com.google.monitoring.v3.MonitoredResourceDescriptorName; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.TimeInterval; +import com.google.monitoring.v3.TimeSeries; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class MetricServiceClientTest { + private static MockAlertPolicyService mockAlertPolicyService; + private static MockGroupService mockGroupService; + private static MockMetricService mockMetricService; + private static MockNotificationChannelService mockNotificationChannelService; + private static MockUptimeCheckService mockUptimeCheckService; + private static MockServiceHelper serviceHelper; + private MetricServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockAlertPolicyService = new MockAlertPolicyService(); + mockGroupService = new MockGroupService(); + mockMetricService = new MockMetricService(); + mockNotificationChannelService = new MockNotificationChannelService(); + mockUptimeCheckService = new MockUptimeCheckService(); + serviceHelper = + new MockServiceHelper( + "in-process-1", + Arrays.asList( + mockAlertPolicyService, + mockGroupService, + mockMetricService, + mockNotificationChannelService, + mockUptimeCheckService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + MetricServiceSettings settings = + MetricServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = MetricServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void listMonitoredResourceDescriptorsTest() { + String nextPageToken = ""; + MonitoredResourceDescriptor resourceDescriptorsElement = + MonitoredResourceDescriptor.newBuilder().build(); + List resourceDescriptors = + Arrays.asList(resourceDescriptorsElement); + ListMonitoredResourceDescriptorsResponse expectedResponse = + ListMonitoredResourceDescriptorsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllResourceDescriptors(resourceDescriptors) + .build(); + mockMetricService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + + ListMonitoredResourceDescriptorsPagedResponse pagedListResponse = + client.listMonitoredResourceDescriptors(name); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getResourceDescriptorsList().get(0), resources.get(0)); + + List actualRequests = mockMetricService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListMonitoredResourceDescriptorsRequest actualRequest = + (ListMonitoredResourceDescriptorsRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listMonitoredResourceDescriptorsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockMetricService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + + client.listMonitoredResourceDescriptors(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getMonitoredResourceDescriptorTest() { + String name2 = "name2-1052831874"; + String type = "type3575610"; + String displayName = "displayName1615086568"; + String description = "description-1724546052"; + MonitoredResourceDescriptor expectedResponse = + MonitoredResourceDescriptor.newBuilder() + .setName(name2) + .setType(type) + .setDisplayName(displayName) + .setDescription(description) + .build(); + mockMetricService.addResponse(expectedResponse); + + MonitoredResourceDescriptorName name = + MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]"); + + MonitoredResourceDescriptor actualResponse = client.getMonitoredResourceDescriptor(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockMetricService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetMonitoredResourceDescriptorRequest actualRequest = + (GetMonitoredResourceDescriptorRequest) actualRequests.get(0); + + Assert.assertEquals(name, MonitoredResourceDescriptorName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getMonitoredResourceDescriptorExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockMetricService.addException(exception); + + try { + MonitoredResourceDescriptorName name = + MonitoredResourceDescriptorName.of("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]"); + + client.getMonitoredResourceDescriptor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listMetricDescriptorsTest() { + String nextPageToken = ""; + MetricDescriptor metricDescriptorsElement = MetricDescriptor.newBuilder().build(); + List metricDescriptors = Arrays.asList(metricDescriptorsElement); + ListMetricDescriptorsResponse expectedResponse = + ListMetricDescriptorsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllMetricDescriptors(metricDescriptors) + .build(); + mockMetricService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + + ListMetricDescriptorsPagedResponse pagedListResponse = client.listMetricDescriptors(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getMetricDescriptorsList().get(0), resources.get(0)); + + List actualRequests = mockMetricService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListMetricDescriptorsRequest actualRequest = + (ListMetricDescriptorsRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listMetricDescriptorsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockMetricService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + + client.listMetricDescriptors(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getMetricDescriptorTest() { + String name2 = "name2-1052831874"; + String type = "type3575610"; + String unit = "unit3594628"; + String description = "description-1724546052"; + String displayName = "displayName1615086568"; + MetricDescriptor expectedResponse = + MetricDescriptor.newBuilder() + .setName(name2) + .setType(type) + .setUnit(unit) + .setDescription(description) + .setDisplayName(displayName) + .build(); + mockMetricService.addResponse(expectedResponse); + + MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]"); + + MetricDescriptor actualResponse = client.getMetricDescriptor(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockMetricService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetMetricDescriptorRequest actualRequest = (GetMetricDescriptorRequest) actualRequests.get(0); + + Assert.assertEquals(name, MetricDescriptorName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getMetricDescriptorExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockMetricService.addException(exception); + + try { + MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]"); + + client.getMetricDescriptor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createMetricDescriptorTest() { + String name2 = "name2-1052831874"; + String type = "type3575610"; + String unit = "unit3594628"; + String description = "description-1724546052"; + String displayName = "displayName1615086568"; + MetricDescriptor expectedResponse = + MetricDescriptor.newBuilder() + .setName(name2) + .setType(type) + .setUnit(unit) + .setDescription(description) + .setDisplayName(displayName) + .build(); + mockMetricService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build(); + + MetricDescriptor actualResponse = client.createMetricDescriptor(name, metricDescriptor); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockMetricService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateMetricDescriptorRequest actualRequest = + (CreateMetricDescriptorRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertEquals(metricDescriptor, actualRequest.getMetricDescriptor()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createMetricDescriptorExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockMetricService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + MetricDescriptor metricDescriptor = MetricDescriptor.newBuilder().build(); + + client.createMetricDescriptor(name, metricDescriptor); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteMetricDescriptorTest() { + Empty expectedResponse = Empty.newBuilder().build(); + mockMetricService.addResponse(expectedResponse); + + MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]"); + + client.deleteMetricDescriptor(name); + + List actualRequests = mockMetricService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteMetricDescriptorRequest actualRequest = + (DeleteMetricDescriptorRequest) actualRequests.get(0); + + Assert.assertEquals(name, MetricDescriptorName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteMetricDescriptorExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockMetricService.addException(exception); + + try { + MetricDescriptorName name = MetricDescriptorName.of("[PROJECT]", "[METRIC_DESCRIPTOR]"); + + client.deleteMetricDescriptor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listTimeSeriesTest() { + String nextPageToken = ""; + TimeSeries timeSeriesElement = TimeSeries.newBuilder().build(); + List timeSeries = Arrays.asList(timeSeriesElement); + ListTimeSeriesResponse expectedResponse = + ListTimeSeriesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllTimeSeries(timeSeries) + .build(); + mockMetricService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + String filter = "filter-1274492040"; + TimeInterval interval = TimeInterval.newBuilder().build(); + ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL; + + ListTimeSeriesPagedResponse pagedListResponse = + client.listTimeSeries(name, filter, interval, view); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getTimeSeriesList().get(0), resources.get(0)); + + List actualRequests = mockMetricService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListTimeSeriesRequest actualRequest = (ListTimeSeriesRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertEquals(filter, actualRequest.getFilter()); + Assert.assertEquals(interval, actualRequest.getInterval()); + Assert.assertEquals(view, actualRequest.getView()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listTimeSeriesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockMetricService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + String filter = "filter-1274492040"; + TimeInterval interval = TimeInterval.newBuilder().build(); + ListTimeSeriesRequest.TimeSeriesView view = ListTimeSeriesRequest.TimeSeriesView.FULL; + + client.listTimeSeries(name, filter, interval, view); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createTimeSeriesTest() { + Empty expectedResponse = Empty.newBuilder().build(); + mockMetricService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + List timeSeries = new ArrayList<>(); + + client.createTimeSeries(name, timeSeries); + + List actualRequests = mockMetricService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateTimeSeriesRequest actualRequest = (CreateTimeSeriesRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertEquals(timeSeries, actualRequest.getTimeSeriesList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createTimeSeriesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockMetricService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + List timeSeries = new ArrayList<>(); + + client.createTimeSeries(name, timeSeries); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/MetricServiceSmokeTest.java b/src/test/java/com/google/cloud/monitoring/v3/MetricServiceSmokeTest.java new file mode 100644 index 00000000..2f61f966 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MetricServiceSmokeTest.java @@ -0,0 +1,66 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.MetricServiceClient.ListMonitoredResourceDescriptorsPagedResponse; + +import com.google.common.base.Preconditions; +import com.google.monitoring.v3.ProjectName; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class MetricServiceSmokeTest { + private static final String PROJECT_ENV_NAME = "GOOGLE_CLOUD_PROJECT"; + private static final String LEGACY_PROJECT_ENV_NAME = "GCLOUD_PROJECT"; + + @Test + public void run() { + main(null); + } + + public static void main(String args[]) { + Logger.getLogger("").setLevel(Level.WARNING); + try { + executeNoCatch(getProjectId()); + System.out.println("OK"); + } catch (Exception e) { + System.err.println("Failed with exception:"); + e.printStackTrace(System.err); + System.exit(1); + } + } + + public static void executeNoCatch(String projectId) throws Exception { + try (MetricServiceClient client = MetricServiceClient.create()) { + ProjectName name = ProjectName.of(projectId); + + ListMonitoredResourceDescriptorsPagedResponse pagedResponse = + client.listMonitoredResourceDescriptors(name); + } + } + + private static String getProjectId() { + String projectId = System.getProperty(PROJECT_ENV_NAME, System.getenv(PROJECT_ENV_NAME)); + if (projectId == null) { + projectId = + System.getProperty(LEGACY_PROJECT_ENV_NAME, System.getenv(LEGACY_PROJECT_ENV_NAME)); + } + Preconditions.checkArgument(projectId != null, "A project ID is required."); + return projectId; + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/MockAlertPolicyService.java b/src/test/java/com/google/cloud/monitoring/v3/MockAlertPolicyService.java new file mode 100644 index 00000000..1a820d6d --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockAlertPolicyService.java @@ -0,0 +1,57 @@ +/* + * 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.monitoring.v3; + +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockAlertPolicyService implements MockGrpcService { + private final MockAlertPolicyServiceImpl serviceImpl; + + public MockAlertPolicyService() { + serviceImpl = new MockAlertPolicyServiceImpl(); + } + + @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/src/test/java/com/google/cloud/monitoring/v3/MockAlertPolicyServiceImpl.java b/src/test/java/com/google/cloud/monitoring/v3/MockAlertPolicyServiceImpl.java new file mode 100644 index 00000000..6fec82cd --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockAlertPolicyServiceImpl.java @@ -0,0 +1,142 @@ +/* + * 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.monitoring.v3; + +import com.google.api.core.BetaApi; +import com.google.monitoring.v3.AlertPolicy; +import com.google.monitoring.v3.AlertPolicyServiceGrpc.AlertPolicyServiceImplBase; +import com.google.monitoring.v3.CreateAlertPolicyRequest; +import com.google.monitoring.v3.DeleteAlertPolicyRequest; +import com.google.monitoring.v3.GetAlertPolicyRequest; +import com.google.monitoring.v3.ListAlertPoliciesRequest; +import com.google.monitoring.v3.ListAlertPoliciesResponse; +import com.google.monitoring.v3.UpdateAlertPolicyRequest; +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockAlertPolicyServiceImpl extends AlertPolicyServiceImplBase { + private List requests; + private Queue responses; + + public MockAlertPolicyServiceImpl() { + 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 listAlertPolicies( + ListAlertPoliciesRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListAlertPoliciesResponse) { + requests.add(request); + responseObserver.onNext((ListAlertPoliciesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getAlertPolicy( + GetAlertPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof AlertPolicy) { + requests.add(request); + responseObserver.onNext((AlertPolicy) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createAlertPolicy( + CreateAlertPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof AlertPolicy) { + requests.add(request); + responseObserver.onNext((AlertPolicy) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteAlertPolicy( + DeleteAlertPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } + + @Override + public void updateAlertPolicy( + UpdateAlertPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof AlertPolicy) { + requests.add(request); + responseObserver.onNext((AlertPolicy) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/MockGroupService.java b/src/test/java/com/google/cloud/monitoring/v3/MockGroupService.java new file mode 100644 index 00000000..e77b5a87 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockGroupService.java @@ -0,0 +1,57 @@ +/* + * 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.monitoring.v3; + +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockGroupService implements MockGrpcService { + private final MockGroupServiceImpl serviceImpl; + + public MockGroupService() { + serviceImpl = new MockGroupServiceImpl(); + } + + @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/src/test/java/com/google/cloud/monitoring/v3/MockGroupServiceImpl.java b/src/test/java/com/google/cloud/monitoring/v3/MockGroupServiceImpl.java new file mode 100644 index 00000000..f53588b5 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockGroupServiceImpl.java @@ -0,0 +1,154 @@ +/* + * 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.monitoring.v3; + +import com.google.api.core.BetaApi; +import com.google.monitoring.v3.CreateGroupRequest; +import com.google.monitoring.v3.DeleteGroupRequest; +import com.google.monitoring.v3.GetGroupRequest; +import com.google.monitoring.v3.Group; +import com.google.monitoring.v3.GroupServiceGrpc.GroupServiceImplBase; +import com.google.monitoring.v3.ListGroupMembersRequest; +import com.google.monitoring.v3.ListGroupMembersResponse; +import com.google.monitoring.v3.ListGroupsRequest; +import com.google.monitoring.v3.ListGroupsResponse; +import com.google.monitoring.v3.UpdateGroupRequest; +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockGroupServiceImpl extends GroupServiceImplBase { + private List requests; + private Queue responses; + + public MockGroupServiceImpl() { + 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 listGroups( + ListGroupsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListGroupsResponse) { + requests.add(request); + responseObserver.onNext((ListGroupsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getGroup(GetGroupRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Group) { + requests.add(request); + responseObserver.onNext((Group) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createGroup(CreateGroupRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Group) { + requests.add(request); + responseObserver.onNext((Group) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateGroup(UpdateGroupRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Group) { + requests.add(request); + responseObserver.onNext((Group) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteGroup(DeleteGroupRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } + + @Override + public void listGroupMembers( + ListGroupMembersRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListGroupMembersResponse) { + requests.add(request); + responseObserver.onNext((ListGroupMembersResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/MockMetricService.java b/src/test/java/com/google/cloud/monitoring/v3/MockMetricService.java new file mode 100644 index 00000000..fee781c5 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockMetricService.java @@ -0,0 +1,57 @@ +/* + * 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.monitoring.v3; + +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockMetricService implements MockGrpcService { + private final MockMetricServiceImpl serviceImpl; + + public MockMetricService() { + serviceImpl = new MockMetricServiceImpl(); + } + + @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/src/test/java/com/google/cloud/monitoring/v3/MockMetricServiceImpl.java b/src/test/java/com/google/cloud/monitoring/v3/MockMetricServiceImpl.java new file mode 100644 index 00000000..9a75d1f9 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockMetricServiceImpl.java @@ -0,0 +1,195 @@ +/* + * 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.monitoring.v3; + +import com.google.api.MetricDescriptor; +import com.google.api.MonitoredResourceDescriptor; +import com.google.api.core.BetaApi; +import com.google.monitoring.v3.CreateMetricDescriptorRequest; +import com.google.monitoring.v3.CreateTimeSeriesRequest; +import com.google.monitoring.v3.DeleteMetricDescriptorRequest; +import com.google.monitoring.v3.GetMetricDescriptorRequest; +import com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest; +import com.google.monitoring.v3.ListMetricDescriptorsRequest; +import com.google.monitoring.v3.ListMetricDescriptorsResponse; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsRequest; +import com.google.monitoring.v3.ListMonitoredResourceDescriptorsResponse; +import com.google.monitoring.v3.ListTimeSeriesRequest; +import com.google.monitoring.v3.ListTimeSeriesResponse; +import com.google.monitoring.v3.MetricServiceGrpc.MetricServiceImplBase; +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockMetricServiceImpl extends MetricServiceImplBase { + private List requests; + private Queue responses; + + public MockMetricServiceImpl() { + 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 listMonitoredResourceDescriptors( + ListMonitoredResourceDescriptorsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListMonitoredResourceDescriptorsResponse) { + requests.add(request); + responseObserver.onNext((ListMonitoredResourceDescriptorsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getMonitoredResourceDescriptor( + GetMonitoredResourceDescriptorRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof MonitoredResourceDescriptor) { + requests.add(request); + responseObserver.onNext((MonitoredResourceDescriptor) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listMetricDescriptors( + ListMetricDescriptorsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListMetricDescriptorsResponse) { + requests.add(request); + responseObserver.onNext((ListMetricDescriptorsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getMetricDescriptor( + GetMetricDescriptorRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof MetricDescriptor) { + requests.add(request); + responseObserver.onNext((MetricDescriptor) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createMetricDescriptor( + CreateMetricDescriptorRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof MetricDescriptor) { + requests.add(request); + responseObserver.onNext((MetricDescriptor) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteMetricDescriptor( + DeleteMetricDescriptorRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } + + @Override + public void listTimeSeries( + ListTimeSeriesRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListTimeSeriesResponse) { + requests.add(request); + responseObserver.onNext((ListTimeSeriesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createTimeSeries( + CreateTimeSeriesRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/MockNotificationChannelService.java b/src/test/java/com/google/cloud/monitoring/v3/MockNotificationChannelService.java new file mode 100644 index 00000000..7667e6d6 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockNotificationChannelService.java @@ -0,0 +1,57 @@ +/* + * 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.monitoring.v3; + +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockNotificationChannelService implements MockGrpcService { + private final MockNotificationChannelServiceImpl serviceImpl; + + public MockNotificationChannelService() { + serviceImpl = new MockNotificationChannelServiceImpl(); + } + + @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/src/test/java/com/google/cloud/monitoring/v3/MockNotificationChannelServiceImpl.java b/src/test/java/com/google/cloud/monitoring/v3/MockNotificationChannelServiceImpl.java new file mode 100644 index 00000000..ad688d02 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockNotificationChannelServiceImpl.java @@ -0,0 +1,232 @@ +/* + * 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.monitoring.v3; + +import com.google.api.core.BetaApi; +import com.google.monitoring.v3.CreateNotificationChannelRequest; +import com.google.monitoring.v3.DeleteNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelDescriptorRequest; +import com.google.monitoring.v3.GetNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse; +import com.google.monitoring.v3.ListNotificationChannelsRequest; +import com.google.monitoring.v3.ListNotificationChannelsResponse; +import com.google.monitoring.v3.NotificationChannel; +import com.google.monitoring.v3.NotificationChannelDescriptor; +import com.google.monitoring.v3.NotificationChannelServiceGrpc.NotificationChannelServiceImplBase; +import com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.UpdateNotificationChannelRequest; +import com.google.monitoring.v3.VerifyNotificationChannelRequest; +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockNotificationChannelServiceImpl extends NotificationChannelServiceImplBase { + private List requests; + private Queue responses; + + public MockNotificationChannelServiceImpl() { + 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 listNotificationChannelDescriptors( + ListNotificationChannelDescriptorsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListNotificationChannelDescriptorsResponse) { + requests.add(request); + responseObserver.onNext((ListNotificationChannelDescriptorsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getNotificationChannelDescriptor( + GetNotificationChannelDescriptorRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof NotificationChannelDescriptor) { + requests.add(request); + responseObserver.onNext((NotificationChannelDescriptor) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listNotificationChannels( + ListNotificationChannelsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListNotificationChannelsResponse) { + requests.add(request); + responseObserver.onNext((ListNotificationChannelsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getNotificationChannel( + GetNotificationChannelRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof NotificationChannel) { + requests.add(request); + responseObserver.onNext((NotificationChannel) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createNotificationChannel( + CreateNotificationChannelRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof NotificationChannel) { + requests.add(request); + responseObserver.onNext((NotificationChannel) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateNotificationChannel( + UpdateNotificationChannelRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof NotificationChannel) { + requests.add(request); + responseObserver.onNext((NotificationChannel) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteNotificationChannel( + DeleteNotificationChannelRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } + + @Override + public void sendNotificationChannelVerificationCode( + SendNotificationChannelVerificationCodeRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } + + @Override + public void getNotificationChannelVerificationCode( + GetNotificationChannelVerificationCodeRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof GetNotificationChannelVerificationCodeResponse) { + requests.add(request); + responseObserver.onNext((GetNotificationChannelVerificationCodeResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void verifyNotificationChannel( + VerifyNotificationChannelRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof NotificationChannel) { + requests.add(request); + responseObserver.onNext((NotificationChannel) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckService.java b/src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckService.java new file mode 100644 index 00000000..868aa715 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckService.java @@ -0,0 +1,57 @@ +/* + * 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.monitoring.v3; + +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockUptimeCheckService implements MockGrpcService { + private final MockUptimeCheckServiceImpl serviceImpl; + + public MockUptimeCheckService() { + serviceImpl = new MockUptimeCheckServiceImpl(); + } + + @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/src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckServiceImpl.java b/src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckServiceImpl.java new file mode 100644 index 00000000..1ade4591 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/MockUptimeCheckServiceImpl.java @@ -0,0 +1,160 @@ +/* + * 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.monitoring.v3; + +import com.google.api.core.BetaApi; +import com.google.monitoring.v3.CreateUptimeCheckConfigRequest; +import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest; +import com.google.monitoring.v3.GetUptimeCheckConfigRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsResponse; +import com.google.monitoring.v3.ListUptimeCheckIpsRequest; +import com.google.monitoring.v3.ListUptimeCheckIpsResponse; +import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest; +import com.google.monitoring.v3.UptimeCheckConfig; +import com.google.monitoring.v3.UptimeCheckServiceGrpc.UptimeCheckServiceImplBase; +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; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockUptimeCheckServiceImpl extends UptimeCheckServiceImplBase { + private List requests; + private Queue responses; + + public MockUptimeCheckServiceImpl() { + 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 listUptimeCheckConfigs( + ListUptimeCheckConfigsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListUptimeCheckConfigsResponse) { + requests.add(request); + responseObserver.onNext((ListUptimeCheckConfigsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getUptimeCheckConfig( + GetUptimeCheckConfigRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof UptimeCheckConfig) { + requests.add(request); + responseObserver.onNext((UptimeCheckConfig) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createUptimeCheckConfig( + CreateUptimeCheckConfigRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof UptimeCheckConfig) { + requests.add(request); + responseObserver.onNext((UptimeCheckConfig) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateUptimeCheckConfig( + UpdateUptimeCheckConfigRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof UptimeCheckConfig) { + requests.add(request); + responseObserver.onNext((UptimeCheckConfig) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteUptimeCheckConfig( + DeleteUptimeCheckConfigRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + 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("Unrecognized response type")); + } + } + + @Override + public void listUptimeCheckIps( + ListUptimeCheckIpsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListUptimeCheckIpsResponse) { + requests.add(request); + responseObserver.onNext((ListUptimeCheckIpsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClientTest.java b/src/test/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClientTest.java new file mode 100644 index 00000000..e6f29121 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClientTest.java @@ -0,0 +1,604 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse; +import static com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.CreateNotificationChannelRequest; +import com.google.monitoring.v3.DeleteNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelDescriptorRequest; +import com.google.monitoring.v3.GetNotificationChannelRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest; +import com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse; +import com.google.monitoring.v3.ListNotificationChannelsRequest; +import com.google.monitoring.v3.ListNotificationChannelsResponse; +import com.google.monitoring.v3.NotificationChannel; +import com.google.monitoring.v3.NotificationChannelDescriptor; +import com.google.monitoring.v3.NotificationChannelDescriptorName; +import com.google.monitoring.v3.NotificationChannelName; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.SendNotificationChannelVerificationCodeRequest; +import com.google.monitoring.v3.UpdateNotificationChannelRequest; +import com.google.monitoring.v3.VerifyNotificationChannelRequest; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class NotificationChannelServiceClientTest { + private static MockAlertPolicyService mockAlertPolicyService; + private static MockGroupService mockGroupService; + private static MockMetricService mockMetricService; + private static MockNotificationChannelService mockNotificationChannelService; + private static MockUptimeCheckService mockUptimeCheckService; + private static MockServiceHelper serviceHelper; + private NotificationChannelServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockAlertPolicyService = new MockAlertPolicyService(); + mockGroupService = new MockGroupService(); + mockMetricService = new MockMetricService(); + mockNotificationChannelService = new MockNotificationChannelService(); + mockUptimeCheckService = new MockUptimeCheckService(); + serviceHelper = + new MockServiceHelper( + "in-process-1", + Arrays.asList( + mockAlertPolicyService, + mockGroupService, + mockMetricService, + mockNotificationChannelService, + mockUptimeCheckService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + NotificationChannelServiceSettings settings = + NotificationChannelServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = NotificationChannelServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void listNotificationChannelDescriptorsTest() { + String nextPageToken = ""; + NotificationChannelDescriptor channelDescriptorsElement = + NotificationChannelDescriptor.newBuilder().build(); + List channelDescriptors = + Arrays.asList(channelDescriptorsElement); + ListNotificationChannelDescriptorsResponse expectedResponse = + ListNotificationChannelDescriptorsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllChannelDescriptors(channelDescriptors) + .build(); + mockNotificationChannelService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + + ListNotificationChannelDescriptorsPagedResponse pagedListResponse = + client.listNotificationChannelDescriptors(name); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getChannelDescriptorsList().get(0), resources.get(0)); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListNotificationChannelDescriptorsRequest actualRequest = + (ListNotificationChannelDescriptorsRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listNotificationChannelDescriptorsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + + client.listNotificationChannelDescriptors(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getNotificationChannelDescriptorTest() { + String name2 = "name2-1052831874"; + String type = "type3575610"; + String displayName = "displayName1615086568"; + String description = "description-1724546052"; + NotificationChannelDescriptor expectedResponse = + NotificationChannelDescriptor.newBuilder() + .setName(name2) + .setType(type) + .setDisplayName(displayName) + .setDescription(description) + .build(); + mockNotificationChannelService.addResponse(expectedResponse); + + NotificationChannelDescriptorName name = + NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]"); + + NotificationChannelDescriptor actualResponse = client.getNotificationChannelDescriptor(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetNotificationChannelDescriptorRequest actualRequest = + (GetNotificationChannelDescriptorRequest) actualRequests.get(0); + + Assert.assertEquals(name, NotificationChannelDescriptorName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getNotificationChannelDescriptorExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + NotificationChannelDescriptorName name = + NotificationChannelDescriptorName.of("[PROJECT]", "[CHANNEL_DESCRIPTOR]"); + + client.getNotificationChannelDescriptor(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listNotificationChannelsTest() { + String nextPageToken = ""; + NotificationChannel notificationChannelsElement = NotificationChannel.newBuilder().build(); + List notificationChannels = Arrays.asList(notificationChannelsElement); + ListNotificationChannelsResponse expectedResponse = + ListNotificationChannelsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllNotificationChannels(notificationChannels) + .build(); + mockNotificationChannelService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + + ListNotificationChannelsPagedResponse pagedListResponse = client.listNotificationChannels(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getNotificationChannelsList().get(0), resources.get(0)); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListNotificationChannelsRequest actualRequest = + (ListNotificationChannelsRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listNotificationChannelsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + + client.listNotificationChannels(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getNotificationChannelTest() { + String type = "type3575610"; + String name2 = "name2-1052831874"; + String displayName = "displayName1615086568"; + String description = "description-1724546052"; + NotificationChannel expectedResponse = + NotificationChannel.newBuilder() + .setType(type) + .setName(name2) + .setDisplayName(displayName) + .setDescription(description) + .build(); + mockNotificationChannelService.addResponse(expectedResponse); + + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + + NotificationChannel actualResponse = client.getNotificationChannel(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetNotificationChannelRequest actualRequest = + (GetNotificationChannelRequest) actualRequests.get(0); + + Assert.assertEquals(name, NotificationChannelName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getNotificationChannelExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + + client.getNotificationChannel(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createNotificationChannelTest() { + String type = "type3575610"; + String name2 = "name2-1052831874"; + String displayName = "displayName1615086568"; + String description = "description-1724546052"; + NotificationChannel expectedResponse = + NotificationChannel.newBuilder() + .setType(type) + .setName(name2) + .setDisplayName(displayName) + .setDescription(description) + .build(); + mockNotificationChannelService.addResponse(expectedResponse); + + ProjectName name = ProjectName.of("[PROJECT]"); + NotificationChannel notificationChannel = NotificationChannel.newBuilder().build(); + + NotificationChannel actualResponse = + client.createNotificationChannel(name, notificationChannel); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateNotificationChannelRequest actualRequest = + (CreateNotificationChannelRequest) actualRequests.get(0); + + Assert.assertEquals(name, ProjectName.parse(actualRequest.getName())); + Assert.assertEquals(notificationChannel, actualRequest.getNotificationChannel()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createNotificationChannelExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + ProjectName name = ProjectName.of("[PROJECT]"); + NotificationChannel notificationChannel = NotificationChannel.newBuilder().build(); + + client.createNotificationChannel(name, notificationChannel); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateNotificationChannelTest() { + String type = "type3575610"; + String name = "name3373707"; + String displayName = "displayName1615086568"; + String description = "description-1724546052"; + NotificationChannel expectedResponse = + NotificationChannel.newBuilder() + .setType(type) + .setName(name) + .setDisplayName(displayName) + .setDescription(description) + .build(); + mockNotificationChannelService.addResponse(expectedResponse); + + FieldMask updateMask = FieldMask.newBuilder().build(); + NotificationChannel notificationChannel = NotificationChannel.newBuilder().build(); + + NotificationChannel actualResponse = + client.updateNotificationChannel(updateMask, notificationChannel); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateNotificationChannelRequest actualRequest = + (UpdateNotificationChannelRequest) actualRequests.get(0); + + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertEquals(notificationChannel, actualRequest.getNotificationChannel()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateNotificationChannelExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + FieldMask updateMask = FieldMask.newBuilder().build(); + NotificationChannel notificationChannel = NotificationChannel.newBuilder().build(); + + client.updateNotificationChannel(updateMask, notificationChannel); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteNotificationChannelTest() { + Empty expectedResponse = Empty.newBuilder().build(); + mockNotificationChannelService.addResponse(expectedResponse); + + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + boolean force = false; + + client.deleteNotificationChannel(name, force); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteNotificationChannelRequest actualRequest = + (DeleteNotificationChannelRequest) actualRequests.get(0); + + Assert.assertEquals(name, NotificationChannelName.parse(actualRequest.getName())); + Assert.assertEquals(force, actualRequest.getForce()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteNotificationChannelExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + boolean force = false; + + client.deleteNotificationChannel(name, force); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void sendNotificationChannelVerificationCodeTest() { + Empty expectedResponse = Empty.newBuilder().build(); + mockNotificationChannelService.addResponse(expectedResponse); + + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + + client.sendNotificationChannelVerificationCode(name); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SendNotificationChannelVerificationCodeRequest actualRequest = + (SendNotificationChannelVerificationCodeRequest) actualRequests.get(0); + + Assert.assertEquals(name, NotificationChannelName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void sendNotificationChannelVerificationCodeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + + client.sendNotificationChannelVerificationCode(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getNotificationChannelVerificationCodeTest() { + String code = "code3059181"; + GetNotificationChannelVerificationCodeResponse expectedResponse = + GetNotificationChannelVerificationCodeResponse.newBuilder().setCode(code).build(); + mockNotificationChannelService.addResponse(expectedResponse); + + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + + GetNotificationChannelVerificationCodeResponse actualResponse = + client.getNotificationChannelVerificationCode(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetNotificationChannelVerificationCodeRequest actualRequest = + (GetNotificationChannelVerificationCodeRequest) actualRequests.get(0); + + Assert.assertEquals(name, NotificationChannelName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getNotificationChannelVerificationCodeExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + + client.getNotificationChannelVerificationCode(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void verifyNotificationChannelTest() { + String type = "type3575610"; + String name2 = "name2-1052831874"; + String displayName = "displayName1615086568"; + String description = "description-1724546052"; + NotificationChannel expectedResponse = + NotificationChannel.newBuilder() + .setType(type) + .setName(name2) + .setDisplayName(displayName) + .setDescription(description) + .build(); + mockNotificationChannelService.addResponse(expectedResponse); + + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + String code = "code3059181"; + + NotificationChannel actualResponse = client.verifyNotificationChannel(name, code); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockNotificationChannelService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + VerifyNotificationChannelRequest actualRequest = + (VerifyNotificationChannelRequest) actualRequests.get(0); + + Assert.assertEquals(name, NotificationChannelName.parse(actualRequest.getName())); + Assert.assertEquals(code, actualRequest.getCode()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void verifyNotificationChannelExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockNotificationChannelService.addException(exception); + + try { + NotificationChannelName name = + NotificationChannelName.of("[PROJECT]", "[NOTIFICATION_CHANNEL]"); + String code = "code3059181"; + + client.verifyNotificationChannel(name, code); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/src/test/java/com/google/cloud/monitoring/v3/UptimeCheckServiceClientTest.java b/src/test/java/com/google/cloud/monitoring/v3/UptimeCheckServiceClientTest.java new file mode 100644 index 00000000..425aaf94 --- /dev/null +++ b/src/test/java/com/google/cloud/monitoring/v3/UptimeCheckServiceClientTest.java @@ -0,0 +1,336 @@ +/* + * 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.monitoring.v3; + +import static com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.monitoring.v3.CreateUptimeCheckConfigRequest; +import com.google.monitoring.v3.DeleteUptimeCheckConfigRequest; +import com.google.monitoring.v3.GetUptimeCheckConfigRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsRequest; +import com.google.monitoring.v3.ListUptimeCheckConfigsResponse; +import com.google.monitoring.v3.ProjectName; +import com.google.monitoring.v3.UpdateUptimeCheckConfigRequest; +import com.google.monitoring.v3.UptimeCheckConfig; +import com.google.monitoring.v3.UptimeCheckConfigName; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.Empty; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class UptimeCheckServiceClientTest { + private static MockAlertPolicyService mockAlertPolicyService; + private static MockGroupService mockGroupService; + private static MockMetricService mockMetricService; + private static MockNotificationChannelService mockNotificationChannelService; + private static MockUptimeCheckService mockUptimeCheckService; + private static MockServiceHelper serviceHelper; + private UptimeCheckServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockAlertPolicyService = new MockAlertPolicyService(); + mockGroupService = new MockGroupService(); + mockMetricService = new MockMetricService(); + mockNotificationChannelService = new MockNotificationChannelService(); + mockUptimeCheckService = new MockUptimeCheckService(); + serviceHelper = + new MockServiceHelper( + "in-process-1", + Arrays.asList( + mockAlertPolicyService, + mockGroupService, + mockMetricService, + mockNotificationChannelService, + mockUptimeCheckService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + UptimeCheckServiceSettings settings = + UptimeCheckServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = UptimeCheckServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void listUptimeCheckConfigsTest() { + String nextPageToken = ""; + int totalSize = 705419236; + UptimeCheckConfig uptimeCheckConfigsElement = UptimeCheckConfig.newBuilder().build(); + List uptimeCheckConfigs = Arrays.asList(uptimeCheckConfigsElement); + ListUptimeCheckConfigsResponse expectedResponse = + ListUptimeCheckConfigsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .setTotalSize(totalSize) + .addAllUptimeCheckConfigs(uptimeCheckConfigs) + .build(); + mockUptimeCheckService.addResponse(expectedResponse); + + String formattedParent = ProjectName.format("[PROJECT]"); + + ListUptimeCheckConfigsPagedResponse pagedListResponse = + client.listUptimeCheckConfigs(formattedParent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getUptimeCheckConfigsList().get(0), resources.get(0)); + + List actualRequests = mockUptimeCheckService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListUptimeCheckConfigsRequest actualRequest = + (ListUptimeCheckConfigsRequest) actualRequests.get(0); + + Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listUptimeCheckConfigsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockUptimeCheckService.addException(exception); + + try { + String formattedParent = ProjectName.format("[PROJECT]"); + + client.listUptimeCheckConfigs(formattedParent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getUptimeCheckConfigTest() { + String name2 = "name2-1052831874"; + String displayName = "displayName1615086568"; + boolean isInternal = true; + UptimeCheckConfig expectedResponse = + UptimeCheckConfig.newBuilder() + .setName(name2) + .setDisplayName(displayName) + .setIsInternal(isInternal) + .build(); + mockUptimeCheckService.addResponse(expectedResponse); + + UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]"); + + UptimeCheckConfig actualResponse = client.getUptimeCheckConfig(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockUptimeCheckService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetUptimeCheckConfigRequest actualRequest = (GetUptimeCheckConfigRequest) actualRequests.get(0); + + Assert.assertEquals(name, UptimeCheckConfigName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getUptimeCheckConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockUptimeCheckService.addException(exception); + + try { + UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]"); + + client.getUptimeCheckConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createUptimeCheckConfigTest() { + String name = "name3373707"; + String displayName = "displayName1615086568"; + boolean isInternal = true; + UptimeCheckConfig expectedResponse = + UptimeCheckConfig.newBuilder() + .setName(name) + .setDisplayName(displayName) + .setIsInternal(isInternal) + .build(); + mockUptimeCheckService.addResponse(expectedResponse); + + String formattedParent = ProjectName.format("[PROJECT]"); + UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build(); + + UptimeCheckConfig actualResponse = + client.createUptimeCheckConfig(formattedParent, uptimeCheckConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockUptimeCheckService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateUptimeCheckConfigRequest actualRequest = + (CreateUptimeCheckConfigRequest) actualRequests.get(0); + + Assert.assertEquals(formattedParent, actualRequest.getParent()); + Assert.assertEquals(uptimeCheckConfig, actualRequest.getUptimeCheckConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createUptimeCheckConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockUptimeCheckService.addException(exception); + + try { + String formattedParent = ProjectName.format("[PROJECT]"); + UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build(); + + client.createUptimeCheckConfig(formattedParent, uptimeCheckConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateUptimeCheckConfigTest() { + String name = "name3373707"; + String displayName = "displayName1615086568"; + boolean isInternal = true; + UptimeCheckConfig expectedResponse = + UptimeCheckConfig.newBuilder() + .setName(name) + .setDisplayName(displayName) + .setIsInternal(isInternal) + .build(); + mockUptimeCheckService.addResponse(expectedResponse); + + UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build(); + + UptimeCheckConfig actualResponse = client.updateUptimeCheckConfig(uptimeCheckConfig); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockUptimeCheckService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateUptimeCheckConfigRequest actualRequest = + (UpdateUptimeCheckConfigRequest) actualRequests.get(0); + + Assert.assertEquals(uptimeCheckConfig, actualRequest.getUptimeCheckConfig()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateUptimeCheckConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockUptimeCheckService.addException(exception); + + try { + UptimeCheckConfig uptimeCheckConfig = UptimeCheckConfig.newBuilder().build(); + + client.updateUptimeCheckConfig(uptimeCheckConfig); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void deleteUptimeCheckConfigTest() { + Empty expectedResponse = Empty.newBuilder().build(); + mockUptimeCheckService.addResponse(expectedResponse); + + UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]"); + + client.deleteUptimeCheckConfig(name); + + List actualRequests = mockUptimeCheckService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + DeleteUptimeCheckConfigRequest actualRequest = + (DeleteUptimeCheckConfigRequest) actualRequests.get(0); + + Assert.assertEquals(name, UptimeCheckConfigName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void deleteUptimeCheckConfigExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockUptimeCheckService.addException(exception); + + try { + UptimeCheckConfigName name = UptimeCheckConfigName.of("[PROJECT]", "[UPTIME_CHECK_CONFIG]"); + + client.deleteUptimeCheckConfig(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-monitoring/synth.metadata b/synth.metadata similarity index 100% rename from google-cloud-monitoring/synth.metadata rename to synth.metadata diff --git a/google-cloud-monitoring/synth.py b/synth.py similarity index 65% rename from google-cloud-monitoring/synth.py rename to synth.py index 1a15400c..543a5359 100644 --- a/google-cloud-monitoring/synth.py +++ b/synth.py @@ -31,10 +31,20 @@ config_path=config_pattern.format(version=version), artman_output_name='') - s.copy(library / f'gapic-google-cloud-{service}-{version}/src', 'src') - s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') - s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + package_name = f'com.google.cloud.{service}.{version}' + java.fix_proto_headers(library / f'proto-google-cloud-{service}-{version}') + java.fix_grpc_headers(library / f'grpc-google-cloud-{service}-{version}', package_name) - java.format_code('./src') - java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src') - java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src') + s.copy(library / f'gapic-google-cloud-{service}-{version}/src', f'google-cloud-{service}/src') + s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'grpc-google-cloud-{service}-{version}/src') + s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'proto-google-cloud-{service}-{version}/src') + + java.format_code(f'google-cloud-{service}/src') + java.format_code(f'grpc-google-cloud-{service}-{version}/src') + java.format_code(f'proto-google-cloud-{service}-{version}/src') + +common_templates = gcp.CommonTemplates() +templates = common_templates.java_library() +s.copy(templates, excludes=[ + 'README.md', +]) \ No newline at end of file diff --git a/versions.txt b/versions.txt new file mode 100644 index 00000000..605b7c4e --- /dev/null +++ b/versions.txt @@ -0,0 +1,6 @@ +# Format: +# module:released-version:current-version + +proto-google-cloud-monitoring-v3:1.80.1-SNAPSHOT:1.80.1-SNAPSHOT +grpc-google-cloud-monitoring-v3:1.80.1-SNAPSHOT:1.80.1-SNAPSHOT +google-cloud-monitoring:1.98.1-SNAPSHOT:1.98.1-SNAPSHOT \ No newline at end of file