diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..be260312 --- /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-billingbudgets/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. billingbudgets 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/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 00000000..ea80a33f --- /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-billingbudgets/.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..e655a284 --- /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-billingbudgets/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billingbudgets/.kokoro/build.sh" +} diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 00000000..b62630b2 --- /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-billingbudgets/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billingbudgets/.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..800393e5 --- /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-billingbudgets/.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..5993c80e --- /dev/null +++ b/.kokoro/continuous/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billingbudgets/.kokoro/build.sh" diff --git a/.kokoro/continuous/java8-win.cfg b/.kokoro/continuous/java8-win.cfg new file mode 100644 index 00000000..66708e2e --- /dev/null +++ b/.kokoro/continuous/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billingbudgets/.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..b162a42b --- /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-billingbudgets/.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-billingbudgets/.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..d50c6219 --- /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-billingbudgets \ + --package-name="billingbudgets" \ + --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..04c8e636 --- /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-billingbudgets/ + +# 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..e95a601d --- /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-billingbudgets/ + +# 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..b62630b2 --- /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-billingbudgets/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billingbudgets/.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..800393e5 --- /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-billingbudgets/.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..5993c80e --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billingbudgets/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 00000000..66708e2e --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billingbudgets/.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..8fcdc830 --- /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-billingbudgets/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billingbudgets/.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..800393e5 --- /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-billingbudgets/.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..5993c80e --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billingbudgets/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 00000000..66708e2e --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billingbudgets/.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..4269089c --- /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-billingbudgets/.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..6d400dc8 --- /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-billingbudgets/.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-billingbudgets/.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..f423dd61 --- /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-billingbudgets \ + --package-name="billingbudgets" \ + --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..cdced746 --- /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-billingbudgets/.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..dfd3857a --- /dev/null +++ b/.kokoro/release/drop.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billingbudgets/.kokoro/release/drop.sh" +} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 00000000..5c4551ef --- /dev/null +++ b/.kokoro/release/drop.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:drop -B \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/promote.cfg b/.kokoro/release/promote.cfg new file mode 100644 index 00000000..c8c4858a --- /dev/null +++ b/.kokoro/release/promote.cfg @@ -0,0 +1,6 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billingbudgets/.kokoro/release/promote.sh" +} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 00000000..1fa95fa5 --- /dev/null +++ b/.kokoro/release/promote.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -eo pipefail + +# STAGING_REPOSITORY_ID must be set +if [ -z "${STAGING_REPOSITORY_ID}" ]; then + echo "Missing STAGING_REPOSITORY_ID environment variable" + exit 1 +fi + +source $(dirname "$0")/common.sh + +pushd $(dirname "$0")/../../ + +setup_environment_secrets +create_settings_xml_file "settings.xml" + +mvn nexus-staging:release -B \ + -DperformRelease=true \ + --settings=settings.xml \ + -DstagingRepositoryId=${STAGING_REPOSITORY_ID} diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg new file mode 100644 index 00000000..609e9b0c --- /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-billingbudgets/.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..a0e7c0ee --- /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=billingbudgets +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..a78eeab7 --- /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-billingbudgets/.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..19c8c446 --- /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-billingbudgets/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-billingbudgets/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-billingbudgets" + } +} + +# 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/.repo-metadata.json b/.repo-metadata.json new file mode 100644 index 00000000..564c73f7 --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,9 @@ +{ + "name": "billingbudgets", + "name_pretty": "Google Cloud Billing Budgets", + "release_level": "alpha", + "language": "java", + "repo": "googleapis/java-billingbudgets", + "repo_short": "java-billingbudgets", + "distribution_name": "google-cloud-billingbudgets" +} 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 new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 00000000..2e0115be --- /dev/null +++ b/README.md @@ -0,0 +1,127 @@ +# Google Cloud Java Client for Google Cloud Billing Budgets + +Java idiomatic client for [Google Cloud Billing Budgets][api-reference]. + +[![Maven][maven-version-image]][maven-version-link] +![Stability][stability-image] + +- [Product Documentation][product-docs] +- [Client Library Documentation][javadocs] + +> Note: This client is a work-in-progress, and may occasionally +> make backwards-incompatible changes. + +## Quickstart + +[//]: # ({x-version-update-start:billingbudgets:released}) +If you are using Maven, add this to your pom.xml file +```xml + + com.google.cloud + google-cloud-billingbudgets + 0.102.0-beta + +``` +If you are using Gradle, add this to your dependencies +```Groovy +compile 'com.google.cloud:google-cloud-billingbudgets:0.102.0-beta' +``` +If you are using SBT, add this to your dependencies +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-billingbudgets" % "0.102.0-beta" +``` +[//]: # ({x-version-update-end}) + +## Authentication + +See the [Authentication][authentication] section in the base directory's README. + +## About Google Cloud Billing Budgets + +[Google Cloud Billing Budgets][api-reference] is a suite of Machine Learning products. + +See the [Google Cloud Billing Budgets client library docs][javadocs] to learn how to +use this Google Cloud Billing Budgets Client Library. + +## Getting Started + +### Prerequisites + +You will need a [Google Developers Console][developer-console] project with the +Google Cloud Billing Budgets API enabled. [Follow these instructions][create-project] to get your +project set up. You will also need to set up the local development environment by +[installing the Google Cloud SDK][cloud-sdk] and running the following commands in command line: +`gcloud auth login` and `gcloud config set project [YOUR PROJECT ID]`. + +### Installation and setup + +You'll need to obtain the `google-cloud-billingbudgets` library. See the [Quickstart](#quickstart) section +to add `google-cloud-billingbudgets` as a dependency in your code. + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. + +## Transport + +Google Cloud Billing Budgets uses gRPC for the transport layer. + +## Java Versions + +Java 7 or above is required for using this client. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + +It is currently in major version zero (``0.y.z``), which means that anything may change at any time +and the public API should not be considered stable. + +## Contributing + +Contributions to this library are always welcome and highly encouraged. + +See [CONTRIBUTING.md][contributing] documentation for more information on how to get started. + +Please note that this project is released with a Contributor Code of Conduct. By participating in +this project you agree to abide by its terms. See [Code of Conduct][code-of-conduct] for more +information. + +## License + +Apache 2.0 - See [LICENSE][license] for more information. + +## CI Status + +Java Version | Status +------------ | ------ +Java 7 | [![Kokoro CI][kokoro-badge-image-1]][kokoro-badge-link-1] +Java 8 | [![Kokoro CI][kokoro-badge-image-2]][kokoro-badge-link-2] +Java 8 OSX | [![Kokoro CI][kokoro-badge-image-3]][kokoro-badge-link-3] +Java 8 Windows | [![Kokoro CI][kokoro-badge-image-4]][kokoro-badge-link-4] +Java 11 | [![Kokoro CI][kokoro-badge-image-5]][kokoro-badge-link-5] + +[api-reference]: +[product-docs]: +[javadocs]: +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billingbudgets/java11.html +[stability-image]: https://img.shields.io/badge/stability-alpha-orange +[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-billingbudgets.svg +[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-billingbudgets&core=gav +[authentication]: https://github.com/googleapis/google-cloud-java#authentication +[developer-console]: https://console.developers.google.com/ +[create-project]: https://cloud.google.com/resource-manager/docs/creating-managing-projects +[cloud-sdk]: https://cloud.google.com/sdk/ +[troubleshooting]: https://github.com/googleapis/google-cloud-common/blob/master/troubleshooting/readme.md#troubleshooting +[contributing]: https://github.com/googleapis/java-billingbudgets/blob/master/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/java-billingbudgets/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/java-billingbudgets/blob/master/LICENSE \ No newline at end of file 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-billingbudgets-bom/pom.xml b/google-cloud-billingbudgets-bom/pom.xml new file mode 100644 index 00000000..5e600679 --- /dev/null +++ b/google-cloud-billingbudgets-bom/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + com.google.cloud + google-cloud-billingbudgets-bom + 0.0.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 0.2.1 + + + Google Cloud billingbudgets BOM + https://github.com/googleapis/java-billingbudgets + + BOM for Google Cloud billingbudgets + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-billingbudgets.git + scm:git:git@github.com:googleapis/java-billingbudgets.git + https://github.com/googleapis/java-billingbudgets + + + + + 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.api.grpc + grpc-google-cloud-billingbudgets-v1beta1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + proto-google-cloud-billingbudgets-v1beta1 + 0.0.1-SNAPSHOT + + + com.google.cloud + google-cloud-billingbudgets + 0.0.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + diff --git a/google-cloud-billingbudgets/pom.xml b/google-cloud-billingbudgets/pom.xml new file mode 100644 index 00000000..199aabf1 --- /dev/null +++ b/google-cloud-billingbudgets/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.google.cloud + google-cloud-billingbudgets + 0.0.1-SNAPSHOT + jar + Google Cloud billingbudgets + https://github.com/googleapis/java-billingbudgets + Java idiomatic client for Google Cloud billingbudgets + + com.google.cloud + google-cloud-billingbudgets-parent + 0.0.1-SNAPSHOT + + + google-cloud-billingbudgets + + + + 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-billingbudgets-v1beta1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + com.google.cloud + google-cloud-core + + + com.google.cloud + google-cloud-core-http + + + com.google.auth + google-auth-library-credentials + + + com.google.auth + google-auth-library-oauth2-http + + + com.google.http-client + google-http-client + + + com.google.http-client + google-http-client-jackson2 + + + + + junit + junit + test + + + org.easymock + easymock + test + + + com.google.api.grpc + grpc-google-cloud-billingbudgets-v1beta1 + test + + + com.google.cloud + google-cloud-core + test-jar + test + + + + com.google.api + gax-grpc + testlib + test + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceClient.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceClient.java new file mode 100644 index 00000000..3823db08 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceClient.java @@ -0,0 +1,537 @@ +/* + * 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.billing.budgets.v1beta1; + +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.billing.budgets.v1beta1.stub.BudgetServiceStub; +import com.google.cloud.billing.budgets.v1beta1.stub.BudgetServiceStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +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: BudgetService stores Cloud Billing budgets, which define a budget plan and + * rules to execute as we track spend against that plan. + * + *

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 (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+ *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ *   Budget budget = Budget.newBuilder().build();
+ *   CreateBudgetRequest request = CreateBudgetRequest.newBuilder()
+ *     .setParent(parent.toString())
+ *     .setBudget(budget)
+ *     .build();
+ *   Budget response = budgetServiceClient.createBudget(request);
+ * }
+ * 
+ * 
+ * + *

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

To customize credentials: + * + *

+ * 
+ * BudgetServiceSettings budgetServiceSettings =
+ *     BudgetServiceSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * BudgetServiceClient budgetServiceClient =
+ *     BudgetServiceClient.create(budgetServiceSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * BudgetServiceSettings budgetServiceSettings =
+ *     BudgetServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * BudgetServiceClient budgetServiceClient =
+ *     BudgetServiceClient.create(budgetServiceSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BudgetServiceClient implements BackgroundResource { + private final BudgetServiceSettings settings; + private final BudgetServiceStub stub; + + /** Constructs an instance of BudgetServiceClient with default settings. */ + public static final BudgetServiceClient create() throws IOException { + return create(BudgetServiceSettings.newBuilder().build()); + } + + /** + * Constructs an instance of BudgetServiceClient, 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 BudgetServiceClient create(BudgetServiceSettings settings) + throws IOException { + return new BudgetServiceClient(settings); + } + + /** + * Constructs an instance of BudgetServiceClient, using the given stub for making calls. This is + * for advanced usage - prefer to use BudgetServiceSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final BudgetServiceClient create(BudgetServiceStub stub) { + return new BudgetServiceClient(stub); + } + + /** + * Constructs an instance of BudgetServiceClient, 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 BudgetServiceClient(BudgetServiceSettings settings) throws IOException { + this.settings = settings; + this.stub = ((BudgetServiceStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected BudgetServiceClient(BudgetServiceStub stub) { + this.settings = null; + this.stub = stub; + } + + public final BudgetServiceSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public BudgetServiceStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new budget if none exists. There is a limit of 1,000 budgets per billing account. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Budget budget = Budget.newBuilder().build();
+   *   CreateBudgetRequest request = CreateBudgetRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setBudget(budget)
+   *     .build();
+   *   Budget response = budgetServiceClient.createBudget(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 Budget createBudget(CreateBudgetRequest request) { + return createBudgetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a new budget if none exists. There is a limit of 1,000 budgets per billing account. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Budget budget = Budget.newBuilder().build();
+   *   CreateBudgetRequest request = CreateBudgetRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .setBudget(budget)
+   *     .build();
+   *   ApiFuture<Budget> future = budgetServiceClient.createBudgetCallable().futureCall(request);
+   *   // Do something
+   *   Budget response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable createBudgetCallable() { + return stub.createBudgetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a budget and returns the updated budget. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   Budget budget = Budget.newBuilder().build();
+   *   UpdateBudgetRequest request = UpdateBudgetRequest.newBuilder()
+   *     .setBudget(budget)
+   *     .build();
+   *   Budget response = budgetServiceClient.updateBudget(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 Budget updateBudget(UpdateBudgetRequest request) { + return updateBudgetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a budget and returns the updated budget. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   Budget budget = Budget.newBuilder().build();
+   *   UpdateBudgetRequest request = UpdateBudgetRequest.newBuilder()
+   *     .setBudget(budget)
+   *     .build();
+   *   ApiFuture<Budget> future = budgetServiceClient.updateBudgetCallable().futureCall(request);
+   *   // Do something
+   *   Budget response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable updateBudgetCallable() { + return stub.updateBudgetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a budget. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   GetBudgetRequest request = GetBudgetRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   Budget response = budgetServiceClient.getBudget(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 Budget getBudget(GetBudgetRequest request) { + return getBudgetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns a budget. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   GetBudgetRequest request = GetBudgetRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Budget> future = budgetServiceClient.getBudgetCallable().futureCall(request);
+   *   // Do something
+   *   Budget response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getBudgetCallable() { + return stub.getBudgetCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the budgets for a billing account. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListBudgetsRequest request = ListBudgetsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   for (Budget element : budgetServiceClient.listBudgets(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 ListBudgetsPagedResponse listBudgets(ListBudgetsRequest request) { + return listBudgetsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the budgets for a billing account. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListBudgetsRequest request = ListBudgetsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<ListBudgetsPagedResponse> future = budgetServiceClient.listBudgetsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Budget element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listBudgetsPagedCallable() { + return stub.listBudgetsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Returns the budgets for a billing account. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListBudgetsRequest request = ListBudgetsRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   while (true) {
+   *     ListBudgetsResponse response = budgetServiceClient.listBudgetsCallable().call(request);
+   *     for (Budget element : response.getBudgetsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable listBudgetsCallable() { + return stub.listBudgetsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a budget. Returns successfully if already deleted. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   DeleteBudgetRequest request = DeleteBudgetRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   budgetServiceClient.deleteBudget(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 deleteBudget(DeleteBudgetRequest request) { + deleteBudgetCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Deletes a budget. Returns successfully if already deleted. + * + *

Sample code: + * + *


+   * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+   *   BudgetName name = BudgetName.of("[BILLING_ACCOUNT]", "[BUDGET]");
+   *   DeleteBudgetRequest request = DeleteBudgetRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<Void> future = budgetServiceClient.deleteBudgetCallable().futureCall(request);
+   *   // Do something
+   *   future.get();
+   * }
+   * 
+ */ + public final UnaryCallable deleteBudgetCallable() { + return stub.deleteBudgetCallable(); + } + + @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 ListBudgetsPagedResponse + extends AbstractPagedListResponse< + ListBudgetsRequest, + ListBudgetsResponse, + Budget, + ListBudgetsPage, + ListBudgetsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListBudgetsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListBudgetsPagedResponse apply(ListBudgetsPage input) { + return new ListBudgetsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListBudgetsPagedResponse(ListBudgetsPage page) { + super(page, ListBudgetsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListBudgetsPage + extends AbstractPage { + + private ListBudgetsPage( + PageContext context, + ListBudgetsResponse response) { + super(context, response); + } + + private static ListBudgetsPage createEmptyPage() { + return new ListBudgetsPage(null, null); + } + + @Override + protected ListBudgetsPage createPage( + PageContext context, + ListBudgetsResponse response) { + return new ListBudgetsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListBudgetsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListBudgetsRequest, + ListBudgetsResponse, + Budget, + ListBudgetsPage, + ListBudgetsFixedSizeCollection> { + + private ListBudgetsFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListBudgetsFixedSizeCollection createEmptyCollection() { + return new ListBudgetsFixedSizeCollection(null, 0); + } + + @Override + protected ListBudgetsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListBudgetsFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceSettings.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceSettings.java new file mode 100644 index 00000000..2623e464 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceSettings.java @@ -0,0 +1,223 @@ +/* + * 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.billing.budgets.v1beta1; + +import static com.google.cloud.billing.budgets.v1beta1.BudgetServiceClient.ListBudgetsPagedResponse; + +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.billing.budgets.v1beta1.stub.BudgetServiceStubSettings; +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 BudgetServiceClient}. + * + *

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

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

+ * 
+ * BudgetServiceSettings.Builder budgetServiceSettingsBuilder =
+ *     BudgetServiceSettings.newBuilder();
+ * budgetServiceSettingsBuilder.createBudgetSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * BudgetServiceSettings budgetServiceSettings = budgetServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BudgetServiceSettings extends ClientSettings { + /** Returns the object with the settings used for calls to createBudget. */ + public UnaryCallSettings createBudgetSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).createBudgetSettings(); + } + + /** Returns the object with the settings used for calls to updateBudget. */ + public UnaryCallSettings updateBudgetSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).updateBudgetSettings(); + } + + /** Returns the object with the settings used for calls to getBudget. */ + public UnaryCallSettings getBudgetSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).getBudgetSettings(); + } + + /** Returns the object with the settings used for calls to listBudgets. */ + public PagedCallSettings + listBudgetsSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).listBudgetsSettings(); + } + + /** Returns the object with the settings used for calls to deleteBudget. */ + public UnaryCallSettings deleteBudgetSettings() { + return ((BudgetServiceStubSettings) getStubSettings()).deleteBudgetSettings(); + } + + public static final BudgetServiceSettings create(BudgetServiceStubSettings stub) + throws IOException { + return new BudgetServiceSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return BudgetServiceStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return BudgetServiceStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return BudgetServiceStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return BudgetServiceStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return BudgetServiceStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return BudgetServiceStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return BudgetServiceStubSettings.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 BudgetServiceSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for BudgetServiceSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(BudgetServiceStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(BudgetServiceStubSettings.newBuilder()); + } + + protected Builder(BudgetServiceSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(BudgetServiceStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public BudgetServiceStubSettings.Builder getStubSettingsBuilder() { + return ((BudgetServiceStubSettings.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 createBudget. */ + public UnaryCallSettings.Builder createBudgetSettings() { + return getStubSettingsBuilder().createBudgetSettings(); + } + + /** Returns the builder for the settings used for calls to updateBudget. */ + public UnaryCallSettings.Builder updateBudgetSettings() { + return getStubSettingsBuilder().updateBudgetSettings(); + } + + /** Returns the builder for the settings used for calls to getBudget. */ + public UnaryCallSettings.Builder getBudgetSettings() { + return getStubSettingsBuilder().getBudgetSettings(); + } + + /** Returns the builder for the settings used for calls to listBudgets. */ + public PagedCallSettings.Builder< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse> + listBudgetsSettings() { + return getStubSettingsBuilder().listBudgetsSettings(); + } + + /** Returns the builder for the settings used for calls to deleteBudget. */ + public UnaryCallSettings.Builder deleteBudgetSettings() { + return getStubSettingsBuilder().deleteBudgetSettings(); + } + + @Override + public BudgetServiceSettings build() throws IOException { + return new BudgetServiceSettings(this); + } + } +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/package-info.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/package-info.java new file mode 100644 index 00000000..628bb515 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/package-info.java @@ -0,0 +1,46 @@ +/* + * 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 Cloud Billing Budget API. + * + *

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

=================== BudgetServiceClient =================== + * + *

Service Description: BudgetService stores Cloud Billing budgets, which define a budget plan + * and rules to execute as we track spend against that plan. + * + *

Sample for BudgetServiceClient: + * + *

+ * 
+ * try (BudgetServiceClient budgetServiceClient = BudgetServiceClient.create()) {
+ *   BillingAccountName parent = BillingAccountName.of("[BILLING_ACCOUNT]");
+ *   Budget budget = Budget.newBuilder().build();
+ *   CreateBudgetRequest request = CreateBudgetRequest.newBuilder()
+ *     .setParent(parent.toString())
+ *     .setBudget(budget)
+ *     .build();
+ *   Budget response = budgetServiceClient.createBudget(request);
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.billing.budgets.v1beta1; + +import javax.annotation.Generated; diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/BudgetServiceStub.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/BudgetServiceStub.java new file mode 100644 index 00000000..b36ca6a5 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/BudgetServiceStub.java @@ -0,0 +1,69 @@ +/* + * 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.billing.budgets.v1beta1.stub; + +import static com.google.cloud.billing.budgets.v1beta1.BudgetServiceClient.ListBudgetsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.billing.budgets.v1beta1.Budget; +import com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest; +import com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse; +import com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest; +import com.google.protobuf.Empty; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Cloud Billing Budget 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 BudgetServiceStub implements BackgroundResource { + + public UnaryCallable createBudgetCallable() { + throw new UnsupportedOperationException("Not implemented: createBudgetCallable()"); + } + + public UnaryCallable updateBudgetCallable() { + throw new UnsupportedOperationException("Not implemented: updateBudgetCallable()"); + } + + public UnaryCallable getBudgetCallable() { + throw new UnsupportedOperationException("Not implemented: getBudgetCallable()"); + } + + public UnaryCallable listBudgetsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listBudgetsPagedCallable()"); + } + + public UnaryCallable listBudgetsCallable() { + throw new UnsupportedOperationException("Not implemented: listBudgetsCallable()"); + } + + public UnaryCallable deleteBudgetCallable() { + throw new UnsupportedOperationException("Not implemented: deleteBudgetCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/BudgetServiceStubSettings.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/BudgetServiceStubSettings.java new file mode 100644 index 00000000..825d562e --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/BudgetServiceStubSettings.java @@ -0,0 +1,435 @@ +/* + * 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.billing.budgets.v1beta1.stub; + +import static com.google.cloud.billing.budgets.v1beta1.BudgetServiceClient.ListBudgetsPagedResponse; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.GaxProperties; +import com.google.api.gax.core.GoogleCredentialsProvider; +import com.google.api.gax.core.InstantiatingExecutorProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.GrpcTransportChannel; +import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.retrying.RetrySettings; +import com.google.api.gax.rpc.ApiCallContext; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.PagedListDescriptor; +import com.google.api.gax.rpc.PagedListResponseFactory; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.StubSettings; +import com.google.api.gax.rpc.TransportChannelProvider; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.billing.budgets.v1beta1.Budget; +import com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest; +import com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse; +import com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.protobuf.Empty; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; +import org.threeten.bp.Duration; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link BudgetServiceStub}. + * + *

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

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

+ * 
+ * BudgetServiceStubSettings.Builder budgetServiceSettingsBuilder =
+ *     BudgetServiceStubSettings.newBuilder();
+ * budgetServiceSettingsBuilder.createBudgetSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * BudgetServiceStubSettings budgetServiceSettings = budgetServiceSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class BudgetServiceStubSettings extends StubSettings { + /** The default scopes of the service. */ + private static final ImmutableList DEFAULT_SERVICE_SCOPES = + ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build(); + + private final UnaryCallSettings createBudgetSettings; + private final UnaryCallSettings updateBudgetSettings; + private final UnaryCallSettings getBudgetSettings; + private final PagedCallSettings + listBudgetsSettings; + private final UnaryCallSettings deleteBudgetSettings; + + /** Returns the object with the settings used for calls to createBudget. */ + public UnaryCallSettings createBudgetSettings() { + return createBudgetSettings; + } + + /** Returns the object with the settings used for calls to updateBudget. */ + public UnaryCallSettings updateBudgetSettings() { + return updateBudgetSettings; + } + + /** Returns the object with the settings used for calls to getBudget. */ + public UnaryCallSettings getBudgetSettings() { + return getBudgetSettings; + } + + /** Returns the object with the settings used for calls to listBudgets. */ + public PagedCallSettings + listBudgetsSettings() { + return listBudgetsSettings; + } + + /** Returns the object with the settings used for calls to deleteBudget. */ + public UnaryCallSettings deleteBudgetSettings() { + return deleteBudgetSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public BudgetServiceStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcBudgetServiceStub.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 "billingbudgets.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(BudgetServiceStubSettings.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 BudgetServiceStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + createBudgetSettings = settingsBuilder.createBudgetSettings().build(); + updateBudgetSettings = settingsBuilder.updateBudgetSettings().build(); + getBudgetSettings = settingsBuilder.getBudgetSettings().build(); + listBudgetsSettings = settingsBuilder.listBudgetsSettings().build(); + deleteBudgetSettings = settingsBuilder.deleteBudgetSettings().build(); + } + + private static final PagedListDescriptor + LIST_BUDGETS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListBudgetsRequest injectToken(ListBudgetsRequest payload, String token) { + return ListBudgetsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListBudgetsRequest injectPageSize(ListBudgetsRequest payload, int pageSize) { + return ListBudgetsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListBudgetsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListBudgetsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListBudgetsResponse payload) { + return payload.getBudgetsList() != null + ? payload.getBudgetsList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse> + LIST_BUDGETS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListBudgetsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_BUDGETS_PAGE_STR_DESC, request, context); + return ListBudgetsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for BudgetServiceStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder createBudgetSettings; + private final UnaryCallSettings.Builder updateBudgetSettings; + private final UnaryCallSettings.Builder getBudgetSettings; + private final PagedCallSettings.Builder< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse> + listBudgetsSettings; + private final UnaryCallSettings.Builder deleteBudgetSettings; + + 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); + + createBudgetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateBudgetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getBudgetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listBudgetsSettings = PagedCallSettings.newBuilder(LIST_BUDGETS_PAGE_STR_FACT); + + deleteBudgetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createBudgetSettings, + updateBudgetSettings, + getBudgetSettings, + listBudgetsSettings, + deleteBudgetSettings); + + 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 + .createBudgetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateBudgetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getBudgetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listBudgetsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .deleteBudgetSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(BudgetServiceStubSettings settings) { + super(settings); + + createBudgetSettings = settings.createBudgetSettings.toBuilder(); + updateBudgetSettings = settings.updateBudgetSettings.toBuilder(); + getBudgetSettings = settings.getBudgetSettings.toBuilder(); + listBudgetsSettings = settings.listBudgetsSettings.toBuilder(); + deleteBudgetSettings = settings.deleteBudgetSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + createBudgetSettings, + updateBudgetSettings, + getBudgetSettings, + listBudgetsSettings, + deleteBudgetSettings); + } + + // 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 createBudget. */ + public UnaryCallSettings.Builder createBudgetSettings() { + return createBudgetSettings; + } + + /** Returns the builder for the settings used for calls to updateBudget. */ + public UnaryCallSettings.Builder updateBudgetSettings() { + return updateBudgetSettings; + } + + /** Returns the builder for the settings used for calls to getBudget. */ + public UnaryCallSettings.Builder getBudgetSettings() { + return getBudgetSettings; + } + + /** Returns the builder for the settings used for calls to listBudgets. */ + public PagedCallSettings.Builder< + ListBudgetsRequest, ListBudgetsResponse, ListBudgetsPagedResponse> + listBudgetsSettings() { + return listBudgetsSettings; + } + + /** Returns the builder for the settings used for calls to deleteBudget. */ + public UnaryCallSettings.Builder deleteBudgetSettings() { + return deleteBudgetSettings; + } + + @Override + public BudgetServiceStubSettings build() throws IOException { + return new BudgetServiceStubSettings(this); + } + } +} diff --git a/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/GrpcBudgetServiceCallableFactory.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/GrpcBudgetServiceCallableFactory.java new file mode 100644 index 00000000..70b0e7c7 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/GrpcBudgetServiceCallableFactory.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.billing.budgets.v1beta1.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 Cloud Billing Budget 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 GrpcBudgetServiceCallableFactory 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/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/GrpcBudgetServiceStub.java b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/GrpcBudgetServiceStub.java new file mode 100644 index 00000000..91f1c086 --- /dev/null +++ b/google-cloud-billingbudgets/src/main/java/com/google/cloud/billing/budgets/v1beta1/stub/GrpcBudgetServiceStub.java @@ -0,0 +1,282 @@ +/* + * 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.billing.budgets.v1beta1.stub; + +import static com.google.cloud.billing.budgets.v1beta1.BudgetServiceClient.ListBudgetsPagedResponse; + +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.cloud.billing.budgets.v1beta1.Budget; +import com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest; +import com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest; +import com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse; +import com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest; +import com.google.common.collect.ImmutableMap; +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 Cloud Billing Budget 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 GrpcBudgetServiceStub extends BudgetServiceStub { + + private static final MethodDescriptor createBudgetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1beta1.BudgetService/CreateBudget") + .setRequestMarshaller(ProtoUtils.marshaller(CreateBudgetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Budget.getDefaultInstance())) + .build(); + private static final MethodDescriptor updateBudgetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1beta1.BudgetService/UpdateBudget") + .setRequestMarshaller(ProtoUtils.marshaller(UpdateBudgetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Budget.getDefaultInstance())) + .build(); + private static final MethodDescriptor getBudgetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1beta1.BudgetService/GetBudget") + .setRequestMarshaller(ProtoUtils.marshaller(GetBudgetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Budget.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listBudgetsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1beta1.BudgetService/ListBudgets") + .setRequestMarshaller(ProtoUtils.marshaller(ListBudgetsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListBudgetsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor deleteBudgetMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.budgets.v1beta1.BudgetService/DeleteBudget") + .setRequestMarshaller(ProtoUtils.marshaller(DeleteBudgetRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable createBudgetCallable; + private final UnaryCallable updateBudgetCallable; + private final UnaryCallable getBudgetCallable; + private final UnaryCallable listBudgetsCallable; + private final UnaryCallable + listBudgetsPagedCallable; + private final UnaryCallable deleteBudgetCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcBudgetServiceStub create(BudgetServiceStubSettings settings) + throws IOException { + return new GrpcBudgetServiceStub(settings, ClientContext.create(settings)); + } + + public static final GrpcBudgetServiceStub create(ClientContext clientContext) throws IOException { + return new GrpcBudgetServiceStub(BudgetServiceStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcBudgetServiceStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcBudgetServiceStub( + BudgetServiceStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcBudgetServiceStub, 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 GrpcBudgetServiceStub(BudgetServiceStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcBudgetServiceCallableFactory()); + } + + /** + * Constructs an instance of GrpcBudgetServiceStub, 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 GrpcBudgetServiceStub( + BudgetServiceStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings createBudgetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createBudgetMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(CreateBudgetRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings updateBudgetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateBudgetMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateBudgetRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("budget.name", String.valueOf(request.getBudget().getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getBudgetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getBudgetMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetBudgetRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings listBudgetsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listBudgetsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListBudgetsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + GrpcCallSettings deleteBudgetTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(deleteBudgetMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(DeleteBudgetRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + + this.createBudgetCallable = + callableFactory.createUnaryCallable( + createBudgetTransportSettings, settings.createBudgetSettings(), clientContext); + this.updateBudgetCallable = + callableFactory.createUnaryCallable( + updateBudgetTransportSettings, settings.updateBudgetSettings(), clientContext); + this.getBudgetCallable = + callableFactory.createUnaryCallable( + getBudgetTransportSettings, settings.getBudgetSettings(), clientContext); + this.listBudgetsCallable = + callableFactory.createUnaryCallable( + listBudgetsTransportSettings, settings.listBudgetsSettings(), clientContext); + this.listBudgetsPagedCallable = + callableFactory.createPagedCallable( + listBudgetsTransportSettings, settings.listBudgetsSettings(), clientContext); + this.deleteBudgetCallable = + callableFactory.createUnaryCallable( + deleteBudgetTransportSettings, settings.deleteBudgetSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable createBudgetCallable() { + return createBudgetCallable; + } + + public UnaryCallable updateBudgetCallable() { + return updateBudgetCallable; + } + + public UnaryCallable getBudgetCallable() { + return getBudgetCallable; + } + + public UnaryCallable listBudgetsPagedCallable() { + return listBudgetsPagedCallable; + } + + public UnaryCallable listBudgetsCallable() { + return listBudgetsCallable; + } + + public UnaryCallable deleteBudgetCallable() { + return deleteBudgetCallable; + } + + @Override + public final void close() { + shutdown(); + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceClientTest.java b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceClientTest.java new file mode 100644 index 00000000..3b9f1431 --- /dev/null +++ b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceClientTest.java @@ -0,0 +1,65 @@ +/* + * 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.billing.budgets.v1beta1; + +import com.google.api.gax.core.NoCredentialsProvider; +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 java.io.IOException; +import java.util.Arrays; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; + +@javax.annotation.Generated("by GAPIC") +public class BudgetServiceClientTest { + private static MockBudgetService mockBudgetService; + private static MockServiceHelper serviceHelper; + private BudgetServiceClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockBudgetService = new MockBudgetService(); + serviceHelper = + new MockServiceHelper("in-process-1", Arrays.asList(mockBudgetService)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + BudgetServiceSettings settings = + BudgetServiceSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = BudgetServiceClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } +} diff --git a/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/MockBudgetService.java b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/MockBudgetService.java new file mode 100644 index 00000000..61d80794 --- /dev/null +++ b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/MockBudgetService.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.billing.budgets.v1beta1; + +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 MockBudgetService implements MockGrpcService { + private final MockBudgetServiceImpl serviceImpl; + + public MockBudgetService() { + serviceImpl = new MockBudgetServiceImpl(); + } + + @Override + public List getRequests() { + return serviceImpl.getRequests(); + } + + @Override + public void addResponse(AbstractMessage response) { + serviceImpl.addResponse(response); + } + + @Override + public void addException(Exception exception) { + serviceImpl.addException(exception); + } + + @Override + public ServerServiceDefinition getServiceDefinition() { + return serviceImpl.bindService(); + } + + @Override + public void reset() { + serviceImpl.reset(); + } +} diff --git a/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/MockBudgetServiceImpl.java b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/MockBudgetServiceImpl.java new file mode 100644 index 00000000..37843dfd --- /dev/null +++ b/google-cloud-billingbudgets/src/test/java/com/google/cloud/billing/budgets/v1beta1/MockBudgetServiceImpl.java @@ -0,0 +1,130 @@ +/* + * 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.billing.budgets.v1beta1; + +import com.google.api.core.BetaApi; +import com.google.cloud.billing.budgets.v1beta1.BudgetServiceGrpc.BudgetServiceImplBase; +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 MockBudgetServiceImpl extends BudgetServiceImplBase { + private List requests; + private Queue responses; + + public MockBudgetServiceImpl() { + 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 createBudget(CreateBudgetRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Budget) { + requests.add(request); + responseObserver.onNext((Budget) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateBudget(UpdateBudgetRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Budget) { + requests.add(request); + responseObserver.onNext((Budget) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getBudget(GetBudgetRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Budget) { + requests.add(request); + responseObserver.onNext((Budget) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listBudgets( + ListBudgetsRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListBudgetsResponse) { + requests.add(request); + responseObserver.onNext((ListBudgetsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void deleteBudget(DeleteBudgetRequest 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/grpc-google-cloud-billingbudgets-v1beta1/pom.xml b/grpc-google-cloud-billingbudgets-v1beta1/pom.xml new file mode 100644 index 00000000..d9f8427a --- /dev/null +++ b/grpc-google-cloud-billingbudgets-v1beta1/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-billingbudgets-v1beta1 + 0.0.1-SNAPSHOT + grpc-google-cloud-billingbudgets-v1beta1 + GRPC library for grpc-google-cloud-billingbudgets-v1beta1 + + com.google.cloud + google-cloud-billingbudgets-parent + 0.0.1-SNAPSHOT + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-cloud-billingbudgets-v1beta1 + + + com.google.api.grpc + proto-google-common-protos + + + com.google.guava + guava + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/grpc-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceGrpc.java b/grpc-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceGrpc.java new file mode 100644 index 00000000..72863eee --- /dev/null +++ b/grpc-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceGrpc.java @@ -0,0 +1,885 @@ +/* + * 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.billing.budgets.v1beta1; + +import static io.grpc.MethodDescriptor.generateFullMethodName; +import static io.grpc.stub.ClientCalls.asyncUnaryCall; +import static io.grpc.stub.ClientCalls.blockingUnaryCall; +import static io.grpc.stub.ClientCalls.futureUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnaryCall; +import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall; + +/** + * + * + *
+ * BudgetService stores Cloud Billing budgets, which define a
+ * budget plan and rules to execute as we track spend against that plan.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler (version 1.10.0)", + comments = "Source: google/cloud/billing/budgets/v1beta1/budget_service.proto") +public final class BudgetServiceGrpc { + + private BudgetServiceGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.billing.budgets.v1beta1.BudgetService"; + + // Static method descriptors that strictly reflect the proto. + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getCreateBudgetMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + METHOD_CREATE_BUDGET = getCreateBudgetMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getCreateBudgetMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getCreateBudgetMethod() { + return getCreateBudgetMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getCreateBudgetMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getCreateBudgetMethod; + if ((getCreateBudgetMethod = BudgetServiceGrpc.getCreateBudgetMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getCreateBudgetMethod = BudgetServiceGrpc.getCreateBudgetMethod) == null) { + BudgetServiceGrpc.getCreateBudgetMethod = + getCreateBudgetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.billing.budgets.v1beta1.BudgetService", "CreateBudget")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance())) + .setSchemaDescriptor( + new BudgetServiceMethodDescriptorSupplier("CreateBudget")) + .build(); + } + } + } + return getCreateBudgetMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getUpdateBudgetMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + METHOD_UPDATE_BUDGET = getUpdateBudgetMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getUpdateBudgetMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getUpdateBudgetMethod() { + return getUpdateBudgetMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getUpdateBudgetMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getUpdateBudgetMethod; + if ((getUpdateBudgetMethod = BudgetServiceGrpc.getUpdateBudgetMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getUpdateBudgetMethod = BudgetServiceGrpc.getUpdateBudgetMethod) == null) { + BudgetServiceGrpc.getUpdateBudgetMethod = + getUpdateBudgetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.billing.budgets.v1beta1.BudgetService", "UpdateBudget")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance())) + .setSchemaDescriptor( + new BudgetServiceMethodDescriptorSupplier("UpdateBudget")) + .build(); + } + } + } + return getUpdateBudgetMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getGetBudgetMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + METHOD_GET_BUDGET = getGetBudgetMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getGetBudgetMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getGetBudgetMethod() { + return getGetBudgetMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getGetBudgetMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget> + getGetBudgetMethod; + if ((getGetBudgetMethod = BudgetServiceGrpc.getGetBudgetMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getGetBudgetMethod = BudgetServiceGrpc.getGetBudgetMethod) == null) { + BudgetServiceGrpc.getGetBudgetMethod = + getGetBudgetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.billing.budgets.v1beta1.BudgetService", "GetBudget")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance())) + .setSchemaDescriptor(new BudgetServiceMethodDescriptorSupplier("GetBudget")) + .build(); + } + } + } + return getGetBudgetMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getListBudgetsMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse> + METHOD_LIST_BUDGETS = getListBudgetsMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse> + getListBudgetsMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse> + getListBudgetsMethod() { + return getListBudgetsMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse> + getListBudgetsMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse> + getListBudgetsMethod; + if ((getListBudgetsMethod = BudgetServiceGrpc.getListBudgetsMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getListBudgetsMethod = BudgetServiceGrpc.getListBudgetsMethod) == null) { + BudgetServiceGrpc.getListBudgetsMethod = + getListBudgetsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.billing.budgets.v1beta1.BudgetService", "ListBudgets")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse + .getDefaultInstance())) + .setSchemaDescriptor(new BudgetServiceMethodDescriptorSupplier("ListBudgets")) + .build(); + } + } + } + return getListBudgetsMethod; + } + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + @java.lang.Deprecated // Use {@link #getDeleteBudgetMethod()} instead. + public static final io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest, com.google.protobuf.Empty> + METHOD_DELETE_BUDGET = getDeleteBudgetMethodHelper(); + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest, com.google.protobuf.Empty> + getDeleteBudgetMethod; + + @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901") + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest, com.google.protobuf.Empty> + getDeleteBudgetMethod() { + return getDeleteBudgetMethodHelper(); + } + + private static io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest, com.google.protobuf.Empty> + getDeleteBudgetMethodHelper() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest, com.google.protobuf.Empty> + getDeleteBudgetMethod; + if ((getDeleteBudgetMethod = BudgetServiceGrpc.getDeleteBudgetMethod) == null) { + synchronized (BudgetServiceGrpc.class) { + if ((getDeleteBudgetMethod = BudgetServiceGrpc.getDeleteBudgetMethod) == null) { + BudgetServiceGrpc.getDeleteBudgetMethod = + getDeleteBudgetMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName( + "google.cloud.billing.budgets.v1beta1.BudgetService", "DeleteBudget")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.protobuf.Empty.getDefaultInstance())) + .setSchemaDescriptor( + new BudgetServiceMethodDescriptorSupplier("DeleteBudget")) + .build(); + } + } + } + return getDeleteBudgetMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static BudgetServiceStub newStub(io.grpc.Channel channel) { + return new BudgetServiceStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static BudgetServiceBlockingStub newBlockingStub(io.grpc.Channel channel) { + return new BudgetServiceBlockingStub(channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static BudgetServiceFutureStub newFutureStub(io.grpc.Channel channel) { + return new BudgetServiceFutureStub(channel); + } + + /** + * + * + *
+   * BudgetService stores Cloud Billing budgets, which define a
+   * budget plan and rules to execute as we track spend against that plan.
+   * 
+ */ + public abstract static class BudgetServiceImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Creates a new budget if none exists. There is a limit of 1,000 budgets
+     * per billing account.
+     * 
+ */ + public void createBudget( + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getCreateBudgetMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Updates a budget and returns the updated budget.
+     * 
+ */ + public void updateBudget( + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getUpdateBudgetMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Returns a budget.
+     * 
+ */ + public void getBudget( + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getGetBudgetMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Returns the budgets for a billing account.
+     * 
+ */ + public void listBudgets( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getListBudgetsMethodHelper(), responseObserver); + } + + /** + * + * + *
+     * Deletes a budget. Returns successfully if already deleted.
+     * 
+ */ + public void deleteBudget( + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getDeleteBudgetMethodHelper(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getCreateBudgetMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget>( + this, METHODID_CREATE_BUDGET))) + .addMethod( + getUpdateBudgetMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget>( + this, METHODID_UPDATE_BUDGET))) + .addMethod( + getGetBudgetMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest, + com.google.cloud.billing.budgets.v1beta1.Budget>(this, METHODID_GET_BUDGET))) + .addMethod( + getListBudgetsMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse>( + this, METHODID_LIST_BUDGETS))) + .addMethod( + getDeleteBudgetMethodHelper(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest, + com.google.protobuf.Empty>(this, METHODID_DELETE_BUDGET))) + .build(); + } + } + + /** + * + * + *
+   * BudgetService stores Cloud Billing budgets, which define a
+   * budget plan and rules to execute as we track spend against that plan.
+   * 
+ */ + public static final class BudgetServiceStub extends io.grpc.stub.AbstractStub { + private BudgetServiceStub(io.grpc.Channel channel) { + super(channel); + } + + private BudgetServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected BudgetServiceStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new budget if none exists. There is a limit of 1,000 budgets
+     * per billing account.
+     * 
+ */ + public void createBudget( + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateBudgetMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates a budget and returns the updated budget.
+     * 
+ */ + public void updateBudget( + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateBudgetMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns a budget.
+     * 
+ */ + public void getBudget( + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetBudgetMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Returns the budgets for a billing account.
+     * 
+ */ + public void listBudgets( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListBudgetsMethodHelper(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Deletes a budget. Returns successfully if already deleted.
+     * 
+ */ + public void deleteBudget( + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getDeleteBudgetMethodHelper(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * BudgetService stores Cloud Billing budgets, which define a
+   * budget plan and rules to execute as we track spend against that plan.
+   * 
+ */ + public static final class BudgetServiceBlockingStub + extends io.grpc.stub.AbstractStub { + private BudgetServiceBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private BudgetServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected BudgetServiceBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new budget if none exists. There is a limit of 1,000 budgets
+     * per billing account.
+     * 
+ */ + public com.google.cloud.billing.budgets.v1beta1.Budget createBudget( + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest request) { + return blockingUnaryCall( + getChannel(), getCreateBudgetMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates a budget and returns the updated budget.
+     * 
+ */ + public com.google.cloud.billing.budgets.v1beta1.Budget updateBudget( + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest request) { + return blockingUnaryCall( + getChannel(), getUpdateBudgetMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns a budget.
+     * 
+ */ + public com.google.cloud.billing.budgets.v1beta1.Budget getBudget( + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest request) { + return blockingUnaryCall(getChannel(), getGetBudgetMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Returns the budgets for a billing account.
+     * 
+ */ + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse listBudgets( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest request) { + return blockingUnaryCall( + getChannel(), getListBudgetsMethodHelper(), getCallOptions(), request); + } + + /** + * + * + *
+     * Deletes a budget. Returns successfully if already deleted.
+     * 
+ */ + public com.google.protobuf.Empty deleteBudget( + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest request) { + return blockingUnaryCall( + getChannel(), getDeleteBudgetMethodHelper(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * BudgetService stores Cloud Billing budgets, which define a
+   * budget plan and rules to execute as we track spend against that plan.
+   * 
+ */ + public static final class BudgetServiceFutureStub + extends io.grpc.stub.AbstractStub { + private BudgetServiceFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private BudgetServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected BudgetServiceFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new BudgetServiceFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Creates a new budget if none exists. There is a limit of 1,000 budgets
+     * per billing account.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.budgets.v1beta1.Budget> + createBudget(com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateBudgetMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates a budget and returns the updated budget.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.budgets.v1beta1.Budget> + updateBudget(com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateBudgetMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns a budget.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.budgets.v1beta1.Budget> + getBudget(com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetBudgetMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Returns the budgets for a billing account.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse> + listBudgets(com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest request) { + return futureUnaryCall( + getChannel().newCall(getListBudgetsMethodHelper(), getCallOptions()), request); + } + + /** + * + * + *
+     * Deletes a budget. Returns successfully if already deleted.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteBudget(com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest request) { + return futureUnaryCall( + getChannel().newCall(getDeleteBudgetMethodHelper(), getCallOptions()), request); + } + } + + private static final int METHODID_CREATE_BUDGET = 0; + private static final int METHODID_UPDATE_BUDGET = 1; + private static final int METHODID_GET_BUDGET = 2; + private static final int METHODID_LIST_BUDGETS = 3; + private static final int METHODID_DELETE_BUDGET = 4; + + private static final class MethodHandlers + implements io.grpc.stub.ServerCalls.UnaryMethod, + io.grpc.stub.ServerCalls.ServerStreamingMethod, + io.grpc.stub.ServerCalls.ClientStreamingMethod, + io.grpc.stub.ServerCalls.BidiStreamingMethod { + private final BudgetServiceImplBase serviceImpl; + private final int methodId; + + MethodHandlers(BudgetServiceImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_CREATE_BUDGET: + serviceImpl.createBudget( + (com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_BUDGET: + serviceImpl.updateBudget( + (com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_BUDGET: + serviceImpl.getBudget( + (com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_BUDGETS: + serviceImpl.listBudgets( + (com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse>) + responseObserver); + break; + case METHODID_DELETE_BUDGET: + serviceImpl.deleteBudget( + (com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + default: + throw new AssertionError(); + } + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public io.grpc.stub.StreamObserver invoke( + io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + default: + throw new AssertionError(); + } + } + } + + private abstract static class BudgetServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + BudgetServiceBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("BudgetService"); + } + } + + private static final class BudgetServiceFileDescriptorSupplier + extends BudgetServiceBaseDescriptorSupplier { + BudgetServiceFileDescriptorSupplier() {} + } + + private static final class BudgetServiceMethodDescriptorSupplier + extends BudgetServiceBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + BudgetServiceMethodDescriptorSupplier(String methodName) { + this.methodName = methodName; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() { + return getServiceDescriptor().findMethodByName(methodName); + } + } + + private static volatile io.grpc.ServiceDescriptor serviceDescriptor; + + public static io.grpc.ServiceDescriptor getServiceDescriptor() { + io.grpc.ServiceDescriptor result = serviceDescriptor; + if (result == null) { + synchronized (BudgetServiceGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new BudgetServiceFileDescriptorSupplier()) + .addMethod(getCreateBudgetMethodHelper()) + .addMethod(getUpdateBudgetMethodHelper()) + .addMethod(getGetBudgetMethodHelper()) + .addMethod(getListBudgetsMethodHelper()) + .addMethod(getDeleteBudgetMethodHelper()) + .build(); + } + } + } + return result; + } +} diff --git a/java.header b/java.header new file mode 100644 index 00000000..3a9b503a --- /dev/null +++ b/java.header @@ -0,0 +1,15 @@ +^/\*$ +^ \* Copyright \d\d\d\d,? Google (Inc\.|LLC)( All [rR]ights [rR]eserved\.)?$ +^ \*$ +^ \* Licensed under the Apache License, Version 2\.0 \(the "License"\);$ +^ \* you may not use this file except in compliance with the License\.$ +^ \* You may obtain a copy of the License at$ +^ \*$ +^ \*[ ]+https?://www.apache.org/licenses/LICENSE-2\.0$ +^ \*$ +^ \* Unless required by applicable law or agreed to in writing, software$ +^ \* distributed under the License is distributed on an "AS IS" BASIS,$ +^ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.$ +^ \* See the License for the specific language governing permissions and$ +^ \* limitations under the License\.$ +^ \*/$ diff --git a/license-checks.xml b/license-checks.xml new file mode 100644 index 00000000..6597fced --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..7238f5fc --- /dev/null +++ b/pom.xml @@ -0,0 +1,293 @@ + + + 4.0.0 + com.google.cloud + google-cloud-billingbudgets-parent + pom + 0.0.1-SNAPSHOT + Google Cloud Billing Budgets Parent + https://github.com/googleapis/java-billingbudgets + + 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-billingbudgets.git + scm:git:git@github.com:googleapis/java-billingbudgets.git + https://github.com/googleapis/java-billingbudgets + HEAD + + + https://github.com/googleapis/java-billingbudgets/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-billingbudgets-parent + 1.91.3 + 1.8.1 + 1.17.0 + 0.18.0 + 1.32.1 + 1.49.1 + 1.24.1 + 3.10.0 + 4.12 + 3.6 + 28.1-android + 1.4.0 + 1.3.2 + 1.18 + + + + + + com.google.api.grpc + proto-google-cloud-billingbudgets-v1beta1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-billingbudgets-v1beta1 + 0.0.1-SNAPSHOT + + + com.google.cloud + google-cloud-billingbudgets + 0.0.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.cloud + google-cloud-core-bom + ${google.core.version} + pom + import + + + com.google.auth + google-auth-library-bom + ${google.auth.version} + pom + import + + + com.google.http-client + google-http-client-bom + ${google.http-client.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 + + + org.easymock + easymock + ${easymock.version} + test + + + com.google.api + gax-grpc + ${gax.version} + testlib + test + + + com.google.cloud + google-cloud-core + test-jar + ${google.core.version} + test + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + org.objenesis:objenesis + + + + + + + + proto-google-cloud-billingbudgets-v1beta1 + grpc-google-cloud-billingbudgets-v1beta1 + google-cloud-billingbudgets + google-cloud-billingbudgets-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-billingbudgets-v1beta1/pom.xml b/proto-google-cloud-billingbudgets-v1beta1/pom.xml new file mode 100644 index 00000000..e1578241 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/pom.xml @@ -0,0 +1,33 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-billingbudgets-v1beta1 + 0.0.1-SNAPSHOT + proto-google-cloud-billingbudgets-v1beta1 + PROTO library for proto-google-cloud-billingbudgets-v1beta1 + + com.google.cloud + google-cloud-billingbudgets-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api + api-common + + + com.google.guava + guava + + + \ No newline at end of file diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/AllUpdatesRule.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/AllUpdatesRule.java new file mode 100644 index 00000000..5b3d5059 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/AllUpdatesRule.java @@ -0,0 +1,856 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * AllUpdatesRule defines notifications that are sent on every update to the
+ * billing account's spend, regardless of the thresholds defined using
+ * threshold rules.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.AllUpdatesRule} + */ +public final class AllUpdatesRule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.AllUpdatesRule) + AllUpdatesRuleOrBuilder { + private static final long serialVersionUID = 0L; + // Use AllUpdatesRule.newBuilder() to construct. + private AllUpdatesRule(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AllUpdatesRule() { + pubsubTopic_ = ""; + schemaVersion_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AllUpdatesRule( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + pubsubTopic_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + schemaVersion_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.class, + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.Builder.class); + } + + public static final int PUBSUB_TOPIC_FIELD_NUMBER = 1; + private volatile java.lang.Object pubsubTopic_; + /** + * + * + *
+   * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+   * published, in the form `projects/{project_id}/topics/{topic_id}`.
+   * Updates are sent at regular intervals to the topic.
+   * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+   * permission must be granted on the topic (or the parent project of the
+   * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+   * If this permission is not present when a topic is provided at the time of
+   * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+   * See https://cloud.google.com/pubsub/docs/access-control for more details on
+   * Pub/Sub roles and permissions.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getPubsubTopic() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pubsubTopic_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+   * published, in the form `projects/{project_id}/topics/{topic_id}`.
+   * Updates are sent at regular intervals to the topic.
+   * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+   * permission must be granted on the topic (or the parent project of the
+   * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+   * If this permission is not present when a topic is provided at the time of
+   * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+   * See https://cloud.google.com/pubsub/docs/access-control for more details on
+   * Pub/Sub roles and permissions.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getPubsubTopicBytes() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pubsubTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SCHEMA_VERSION_FIELD_NUMBER = 2; + private volatile java.lang.Object schemaVersion_; + /** + * + * + *
+   * Required. The schema version of the notification.
+   * Only "1.0" is accepted. It represents the JSON schema as defined in
+   * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+   * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getSchemaVersion() { + java.lang.Object ref = schemaVersion_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + schemaVersion_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The schema version of the notification.
+   * Only "1.0" is accepted. It represents the JSON schema as defined in
+   * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+   * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getSchemaVersionBytes() { + java.lang.Object ref = schemaVersion_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + schemaVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getPubsubTopicBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pubsubTopic_); + } + if (!getSchemaVersionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, schemaVersion_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getPubsubTopicBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pubsubTopic_); + } + if (!getSchemaVersionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, schemaVersion_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule other = + (com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule) obj; + + if (!getPubsubTopic().equals(other.getPubsubTopic())) return false; + if (!getSchemaVersion().equals(other.getSchemaVersion())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PUBSUB_TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getPubsubTopic().hashCode(); + hash = (37 * hash) + SCHEMA_VERSION_FIELD_NUMBER; + hash = (53 * hash) + getSchemaVersion().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * AllUpdatesRule defines notifications that are sent on every update to the
+   * billing account's spend, regardless of the thresholds defined using
+   * threshold rules.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.AllUpdatesRule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.AllUpdatesRule) + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.class, + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + pubsubTopic_ = ""; + + schemaVersion_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule build() { + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule buildPartial() { + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule result = + new com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule(this); + result.pubsubTopic_ = pubsubTopic_; + result.schemaVersion_ = schemaVersion_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule other) { + if (other == com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.getDefaultInstance()) + return this; + if (!other.getPubsubTopic().isEmpty()) { + pubsubTopic_ = other.pubsubTopic_; + onChanged(); + } + if (!other.getSchemaVersion().isEmpty()) { + schemaVersion_ = other.schemaVersion_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object pubsubTopic_ = ""; + /** + * + * + *
+     * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+     * published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic.
+     * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+     * permission must be granted on the topic (or the parent project of the
+     * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+     * If this permission is not present when a topic is provided at the time of
+     * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+     * See https://cloud.google.com/pubsub/docs/access-control for more details on
+     * Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getPubsubTopic() { + java.lang.Object ref = pubsubTopic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pubsubTopic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+     * published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic.
+     * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+     * permission must be granted on the topic (or the parent project of the
+     * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+     * If this permission is not present when a topic is provided at the time of
+     * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+     * See https://cloud.google.com/pubsub/docs/access-control for more details on
+     * Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getPubsubTopicBytes() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pubsubTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+     * published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic.
+     * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+     * permission must be granted on the topic (or the parent project of the
+     * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+     * If this permission is not present when a topic is provided at the time of
+     * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+     * See https://cloud.google.com/pubsub/docs/access-control for more details on
+     * Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPubsubTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pubsubTopic_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+     * published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic.
+     * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+     * permission must be granted on the topic (or the parent project of the
+     * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+     * If this permission is not present when a topic is provided at the time of
+     * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+     * See https://cloud.google.com/pubsub/docs/access-control for more details on
+     * Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearPubsubTopic() { + + pubsubTopic_ = getDefaultInstance().getPubsubTopic(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+     * published, in the form `projects/{project_id}/topics/{topic_id}`.
+     * Updates are sent at regular intervals to the topic.
+     * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+     * permission must be granted on the topic (or the parent project of the
+     * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+     * If this permission is not present when a topic is provided at the time of
+     * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+     * See https://cloud.google.com/pubsub/docs/access-control for more details on
+     * Pub/Sub roles and permissions.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setPubsubTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pubsubTopic_ = value; + onChanged(); + return this; + } + + private java.lang.Object schemaVersion_ = ""; + /** + * + * + *
+     * Required. The schema version of the notification.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public java.lang.String getSchemaVersion() { + java.lang.Object ref = schemaVersion_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + schemaVersion_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The schema version of the notification.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public com.google.protobuf.ByteString getSchemaVersionBytes() { + java.lang.Object ref = schemaVersion_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + schemaVersion_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The schema version of the notification.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setSchemaVersion(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + schemaVersion_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The schema version of the notification.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearSchemaVersion() { + + schemaVersion_ = getDefaultInstance().getSchemaVersion(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The schema version of the notification.
+     * Only "1.0" is accepted. It represents the JSON schema as defined in
+     * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+     * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setSchemaVersionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + schemaVersion_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.AllUpdatesRule) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.AllUpdatesRule) + private static final com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule(); + } + + public static com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AllUpdatesRule parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AllUpdatesRule(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/AllUpdatesRuleOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/AllUpdatesRuleOrBuilder.java new file mode 100644 index 00000000..bd2dd5a5 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/AllUpdatesRuleOrBuilder.java @@ -0,0 +1,89 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface AllUpdatesRuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.AllUpdatesRule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+   * published, in the form `projects/{project_id}/topics/{topic_id}`.
+   * Updates are sent at regular intervals to the topic.
+   * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+   * permission must be granted on the topic (or the parent project of the
+   * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+   * If this permission is not present when a topic is provided at the time of
+   * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+   * See https://cloud.google.com/pubsub/docs/access-control for more details on
+   * Pub/Sub roles and permissions.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + java.lang.String getPubsubTopic(); + /** + * + * + *
+   * Required. The name of the Cloud Pub/Sub topic where budget related messages will be
+   * published, in the form `projects/{project_id}/topics/{topic_id}`.
+   * Updates are sent at regular intervals to the topic.
+   * When a topic is set for a budget, the `pubsub.topics.publish` IAM
+   * permission must be granted on the topic (or the parent project of the
+   * topic) to `billing-budget-alert@system.gserviceaccount.com`.
+   * If this permission is not present when a topic is provided at the time of
+   * budget creation or updating, the API call will fail with PERMISSION_DENIED.
+   * See https://cloud.google.com/pubsub/docs/access-control for more details on
+   * Pub/Sub roles and permissions.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.protobuf.ByteString getPubsubTopicBytes(); + + /** + * + * + *
+   * Required. The schema version of the notification.
+   * Only "1.0" is accepted. It represents the JSON schema as defined in
+   * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+   * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + java.lang.String getSchemaVersion(); + /** + * + * + *
+   * Required. The schema version of the notification.
+   * Only "1.0" is accepted. It represents the JSON schema as defined in
+   * https://cloud.google.com/billing/docs/how-to/budgets#notification_format
+   * 
+ * + * string schema_version = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + com.google.protobuf.ByteString getSchemaVersionBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BillingAccountName.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BillingAccountName.java new file mode 100644 index 00000000..5ab10956 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BillingAccountName.java @@ -0,0 +1,162 @@ +/* + * 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.billing.budgets.v1beta1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class BillingAccountName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("billingAccounts/{billing_account}"); + + private volatile Map fieldValuesMap; + + private final String billingAccount; + + public String getBillingAccount() { + return billingAccount; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private BillingAccountName(Builder builder) { + billingAccount = Preconditions.checkNotNull(builder.getBillingAccount()); + } + + public static BillingAccountName of(String billingAccount) { + return newBuilder().setBillingAccount(billingAccount).build(); + } + + public static String format(String billingAccount) { + return newBuilder().setBillingAccount(billingAccount).build().toString(); + } + + public static BillingAccountName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "BillingAccountName.parse: formattedString not in valid format"); + return of(matchMap.get("billing_account")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (BillingAccountName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("billingAccount", billingAccount); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("billing_account", billingAccount); + } + + /** Builder for BillingAccountName. */ + public static class Builder { + + private String billingAccount; + + public String getBillingAccount() { + return billingAccount; + } + + public Builder setBillingAccount(String billingAccount) { + this.billingAccount = billingAccount; + return this; + } + + private Builder() {} + + private Builder(BillingAccountName billingAccountName) { + billingAccount = billingAccountName.billingAccount; + } + + public BillingAccountName build() { + return new BillingAccountName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BillingAccountName) { + BillingAccountName that = (BillingAccountName) o; + return (this.billingAccount.equals(that.billingAccount)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= billingAccount.hashCode(); + return h; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/Budget.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/Budget.java new file mode 100644 index 00000000..fc351b74 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/Budget.java @@ -0,0 +1,2459 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * A budget is a plan that describes what the user expects to spend on Cloud
+ * projects, plus rules to execute as spend is tracked against that plan,
+ * e.g. alert at 90% of $100 target.
+ * Currently all plans are monthly budgets so the usage period(s) tracked are
+ * implied (calendar months of usage back-to-back).
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.Budget} + */ +public final class Budget extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.Budget) + BudgetOrBuilder { + private static final long serialVersionUID = 0L; + // Use Budget.newBuilder() to construct. + private Budget(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Budget() { + name_ = ""; + displayName_ = ""; + thresholdRules_ = java.util.Collections.emptyList(); + etag_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Budget( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 26: + { + com.google.cloud.billing.budgets.v1beta1.Filter.Builder subBuilder = null; + if (budgetFilter_ != null) { + subBuilder = budgetFilter_.toBuilder(); + } + budgetFilter_ = + input.readMessage( + com.google.cloud.billing.budgets.v1beta1.Filter.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(budgetFilter_); + budgetFilter_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.Builder subBuilder = null; + if (amount_ != null) { + subBuilder = amount_.toBuilder(); + } + amount_ = + input.readMessage( + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(amount_); + amount_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + if (!((mutable_bitField0_ & 0x00000010) != 0)) { + thresholdRules_ = + new java.util.ArrayList< + com.google.cloud.billing.budgets.v1beta1.ThresholdRule>(); + mutable_bitField0_ |= 0x00000010; + } + thresholdRules_.add( + input.readMessage( + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.parser(), + extensionRegistry)); + break; + } + case 50: + { + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.Builder subBuilder = null; + if (allUpdatesRule_ != null) { + subBuilder = allUpdatesRule_.toBuilder(); + } + allUpdatesRule_ = + input.readMessage( + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(allUpdatesRule_); + allUpdatesRule_ = subBuilder.buildPartial(); + } + + break; + } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + + etag_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000010) != 0)) { + thresholdRules_ = java.util.Collections.unmodifiableList(thresholdRules_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Budget_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Budget_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.Budget.class, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder.class); + } + + private int bitField0_; + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Output only. Resource name of the budget.
+   * The resource name implies the scope of a budget. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. Resource name of the budget.
+   * The resource name implies the scope of a budget. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 2; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * User data for display name in UI.
+   * Validation: <= 60 chars.
+   * 
+ * + * string display_name = 2; + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } + } + /** + * + * + *
+   * User data for display name in UI.
+   * Validation: <= 60 chars.
+   * 
+ * + * string display_name = 2; + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BUDGET_FILTER_FIELD_NUMBER = 3; + private com.google.cloud.billing.budgets.v1beta1.Filter budgetFilter_; + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean hasBudgetFilter() { + return budgetFilter_ != null; + } + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Filter getBudgetFilter() { + return budgetFilter_ == null + ? com.google.cloud.billing.budgets.v1beta1.Filter.getDefaultInstance() + : budgetFilter_; + } + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.FilterOrBuilder getBudgetFilterOrBuilder() { + return getBudgetFilter(); + } + + public static final int AMOUNT_FIELD_NUMBER = 4; + private com.google.cloud.billing.budgets.v1beta1.BudgetAmount amount_; + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasAmount() { + return amount_ != null; + } + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetAmount getAmount() { + return amount_ == null + ? com.google.cloud.billing.budgets.v1beta1.BudgetAmount.getDefaultInstance() + : amount_; + } + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetAmountOrBuilder getAmountOrBuilder() { + return getAmount(); + } + + public static final int THRESHOLD_RULES_FIELD_NUMBER = 5; + private java.util.List thresholdRules_; + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getThresholdRulesList() { + return thresholdRules_; + } + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getThresholdRulesOrBuilderList() { + return thresholdRules_; + } + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getThresholdRulesCount() { + return thresholdRules_.size(); + } + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule getThresholdRules(int index) { + return thresholdRules_.get(index); + } + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRuleOrBuilder getThresholdRulesOrBuilder( + int index) { + return thresholdRules_.get(index); + } + + public static final int ALL_UPDATES_RULE_FIELD_NUMBER = 6; + private com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule allUpdatesRule_; + /** + * + * + *
+   * Optional. Rules to apply to all updates to the actual spend, regardless
+   * of the thresholds set in `threshold_rules`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean hasAllUpdatesRule() { + return allUpdatesRule_ != null; + } + /** + * + * + *
+   * Optional. Rules to apply to all updates to the actual spend, regardless
+   * of the thresholds set in `threshold_rules`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule getAllUpdatesRule() { + return allUpdatesRule_ == null + ? com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.getDefaultInstance() + : allUpdatesRule_; + } + /** + * + * + *
+   * Optional. Rules to apply to all updates to the actual spend, regardless
+   * of the thresholds set in `threshold_rules`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRuleOrBuilder + getAllUpdatesRuleOrBuilder() { + return getAllUpdatesRule(); + } + + public static final int ETAG_FIELD_NUMBER = 7; + private volatile java.lang.Object etag_; + /** + * + * + *
+   * Optional. Etag to validate that the object is unchanged for a
+   * read-modify-write operation.
+   * An empty etag will cause an update to overwrite other changes.
+   * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Etag to validate that the object is unchanged for a
+   * read-modify-write operation.
+   * An empty etag will cause an update to overwrite other changes.
+   * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!getDisplayNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, displayName_); + } + if (budgetFilter_ != null) { + output.writeMessage(3, getBudgetFilter()); + } + if (amount_ != null) { + output.writeMessage(4, getAmount()); + } + for (int i = 0; i < thresholdRules_.size(); i++) { + output.writeMessage(5, thresholdRules_.get(i)); + } + if (allUpdatesRule_ != null) { + output.writeMessage(6, getAllUpdatesRule()); + } + if (!getEtagBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, etag_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!getDisplayNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, displayName_); + } + if (budgetFilter_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getBudgetFilter()); + } + if (amount_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getAmount()); + } + for (int i = 0; i < thresholdRules_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, thresholdRules_.get(i)); + } + if (allUpdatesRule_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, getAllUpdatesRule()); + } + if (!getEtagBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, etag_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.Budget)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.Budget other = + (com.google.cloud.billing.budgets.v1beta1.Budget) obj; + + if (!getName().equals(other.getName())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (hasBudgetFilter() != other.hasBudgetFilter()) return false; + if (hasBudgetFilter()) { + if (!getBudgetFilter().equals(other.getBudgetFilter())) return false; + } + if (hasAmount() != other.hasAmount()) return false; + if (hasAmount()) { + if (!getAmount().equals(other.getAmount())) return false; + } + if (!getThresholdRulesList().equals(other.getThresholdRulesList())) return false; + if (hasAllUpdatesRule() != other.hasAllUpdatesRule()) return false; + if (hasAllUpdatesRule()) { + if (!getAllUpdatesRule().equals(other.getAllUpdatesRule())) return false; + } + if (!getEtag().equals(other.getEtag())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + if (hasBudgetFilter()) { + hash = (37 * hash) + BUDGET_FILTER_FIELD_NUMBER; + hash = (53 * hash) + getBudgetFilter().hashCode(); + } + if (hasAmount()) { + hash = (37 * hash) + AMOUNT_FIELD_NUMBER; + hash = (53 * hash) + getAmount().hashCode(); + } + if (getThresholdRulesCount() > 0) { + hash = (37 * hash) + THRESHOLD_RULES_FIELD_NUMBER; + hash = (53 * hash) + getThresholdRulesList().hashCode(); + } + if (hasAllUpdatesRule()) { + hash = (37 * hash) + ALL_UPDATES_RULE_FIELD_NUMBER; + hash = (53 * hash) + getAllUpdatesRule().hashCode(); + } + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.billing.budgets.v1beta1.Budget prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A budget is a plan that describes what the user expects to spend on Cloud
+   * projects, plus rules to execute as spend is tracked against that plan,
+   * e.g. alert at 90% of $100 target.
+   * Currently all plans are monthly budgets so the usage period(s) tracked are
+   * implied (calendar months of usage back-to-back).
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.Budget} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.Budget) + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Budget_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Budget_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.Budget.class, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.Budget.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getThresholdRulesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + displayName_ = ""; + + if (budgetFilterBuilder_ == null) { + budgetFilter_ = null; + } else { + budgetFilter_ = null; + budgetFilterBuilder_ = null; + } + if (amountBuilder_ == null) { + amount_ = null; + } else { + amount_ = null; + amountBuilder_ = null; + } + if (thresholdRulesBuilder_ == null) { + thresholdRules_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + } else { + thresholdRulesBuilder_.clear(); + } + if (allUpdatesRuleBuilder_ == null) { + allUpdatesRule_ = null; + } else { + allUpdatesRule_ = null; + allUpdatesRuleBuilder_ = null; + } + etag_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Budget_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.Budget getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.Budget build() { + com.google.cloud.billing.budgets.v1beta1.Budget result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.Budget buildPartial() { + com.google.cloud.billing.budgets.v1beta1.Budget result = + new com.google.cloud.billing.budgets.v1beta1.Budget(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + result.name_ = name_; + result.displayName_ = displayName_; + if (budgetFilterBuilder_ == null) { + result.budgetFilter_ = budgetFilter_; + } else { + result.budgetFilter_ = budgetFilterBuilder_.build(); + } + if (amountBuilder_ == null) { + result.amount_ = amount_; + } else { + result.amount_ = amountBuilder_.build(); + } + if (thresholdRulesBuilder_ == null) { + if (((bitField0_ & 0x00000010) != 0)) { + thresholdRules_ = java.util.Collections.unmodifiableList(thresholdRules_); + bitField0_ = (bitField0_ & ~0x00000010); + } + result.thresholdRules_ = thresholdRules_; + } else { + result.thresholdRules_ = thresholdRulesBuilder_.build(); + } + if (allUpdatesRuleBuilder_ == null) { + result.allUpdatesRule_ = allUpdatesRule_; + } else { + result.allUpdatesRule_ = allUpdatesRuleBuilder_.build(); + } + result.etag_ = etag_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.Budget) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.Budget) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.Budget other) { + if (other == com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (other.hasBudgetFilter()) { + mergeBudgetFilter(other.getBudgetFilter()); + } + if (other.hasAmount()) { + mergeAmount(other.getAmount()); + } + if (thresholdRulesBuilder_ == null) { + if (!other.thresholdRules_.isEmpty()) { + if (thresholdRules_.isEmpty()) { + thresholdRules_ = other.thresholdRules_; + bitField0_ = (bitField0_ & ~0x00000010); + } else { + ensureThresholdRulesIsMutable(); + thresholdRules_.addAll(other.thresholdRules_); + } + onChanged(); + } + } else { + if (!other.thresholdRules_.isEmpty()) { + if (thresholdRulesBuilder_.isEmpty()) { + thresholdRulesBuilder_.dispose(); + thresholdRulesBuilder_ = null; + thresholdRules_ = other.thresholdRules_; + bitField0_ = (bitField0_ & ~0x00000010); + thresholdRulesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getThresholdRulesFieldBuilder() + : null; + } else { + thresholdRulesBuilder_.addAllMessages(other.thresholdRules_); + } + } + } + if (other.hasAllUpdatesRule()) { + mergeAllUpdatesRule(other.getAllUpdatesRule()); + } + if (!other.getEtag().isEmpty()) { + etag_ = other.etag_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.Budget parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.budgets.v1beta1.Budget) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Resource name of the budget.
+     * The resource name implies the scope of a budget. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * User data for display name in UI.
+     * Validation: <= 60 chars.
+     * 
+ * + * string display_name = 2; + */ + public java.lang.String getDisplayName() { + java.lang.Object ref = displayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + displayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * User data for display name in UI.
+     * Validation: <= 60 chars.
+     * 
+ * + * string display_name = 2; + */ + public com.google.protobuf.ByteString getDisplayNameBytes() { + java.lang.Object ref = displayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + displayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * User data for display name in UI.
+     * Validation: <= 60 chars.
+     * 
+ * + * string display_name = 2; + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * User data for display name in UI.
+     * Validation: <= 60 chars.
+     * 
+ * + * string display_name = 2; + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * User data for display name in UI.
+     * Validation: <= 60 chars.
+     * 
+ * + * string display_name = 2; + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private com.google.cloud.billing.budgets.v1beta1.Filter budgetFilter_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Filter, + com.google.cloud.billing.budgets.v1beta1.Filter.Builder, + com.google.cloud.billing.budgets.v1beta1.FilterOrBuilder> + budgetFilterBuilder_; + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean hasBudgetFilter() { + return budgetFilterBuilder_ != null || budgetFilter_ != null; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Filter getBudgetFilter() { + if (budgetFilterBuilder_ == null) { + return budgetFilter_ == null + ? com.google.cloud.billing.budgets.v1beta1.Filter.getDefaultInstance() + : budgetFilter_; + } else { + return budgetFilterBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setBudgetFilter(com.google.cloud.billing.budgets.v1beta1.Filter value) { + if (budgetFilterBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budgetFilter_ = value; + onChanged(); + } else { + budgetFilterBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setBudgetFilter( + com.google.cloud.billing.budgets.v1beta1.Filter.Builder builderForValue) { + if (budgetFilterBuilder_ == null) { + budgetFilter_ = builderForValue.build(); + onChanged(); + } else { + budgetFilterBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeBudgetFilter(com.google.cloud.billing.budgets.v1beta1.Filter value) { + if (budgetFilterBuilder_ == null) { + if (budgetFilter_ != null) { + budgetFilter_ = + com.google.cloud.billing.budgets.v1beta1.Filter.newBuilder(budgetFilter_) + .mergeFrom(value) + .buildPartial(); + } else { + budgetFilter_ = value; + } + onChanged(); + } else { + budgetFilterBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearBudgetFilter() { + if (budgetFilterBuilder_ == null) { + budgetFilter_ = null; + onChanged(); + } else { + budgetFilter_ = null; + budgetFilterBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Filter.Builder getBudgetFilterBuilder() { + + onChanged(); + return getBudgetFilterFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.FilterOrBuilder getBudgetFilterOrBuilder() { + if (budgetFilterBuilder_ != null) { + return budgetFilterBuilder_.getMessageOrBuilder(); + } else { + return budgetFilter_ == null + ? com.google.cloud.billing.budgets.v1beta1.Filter.getDefaultInstance() + : budgetFilter_; + } + } + /** + * + * + *
+     * Optional. Filters that define which resources are used to compute
+     * the actual spend against the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Filter, + com.google.cloud.billing.budgets.v1beta1.Filter.Builder, + com.google.cloud.billing.budgets.v1beta1.FilterOrBuilder> + getBudgetFilterFieldBuilder() { + if (budgetFilterBuilder_ == null) { + budgetFilterBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Filter, + com.google.cloud.billing.budgets.v1beta1.Filter.Builder, + com.google.cloud.billing.budgets.v1beta1.FilterOrBuilder>( + getBudgetFilter(), getParentForChildren(), isClean()); + budgetFilter_ = null; + } + return budgetFilterBuilder_; + } + + private com.google.cloud.billing.budgets.v1beta1.BudgetAmount amount_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.BudgetAmount, + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetAmountOrBuilder> + amountBuilder_; + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasAmount() { + return amountBuilder_ != null || amount_ != null; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetAmount getAmount() { + if (amountBuilder_ == null) { + return amount_ == null + ? com.google.cloud.billing.budgets.v1beta1.BudgetAmount.getDefaultInstance() + : amount_; + } else { + return amountBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAmount(com.google.cloud.billing.budgets.v1beta1.BudgetAmount value) { + if (amountBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + amount_ = value; + onChanged(); + } else { + amountBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAmount( + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.Builder builderForValue) { + if (amountBuilder_ == null) { + amount_ = builderForValue.build(); + onChanged(); + } else { + amountBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeAmount(com.google.cloud.billing.budgets.v1beta1.BudgetAmount value) { + if (amountBuilder_ == null) { + if (amount_ != null) { + amount_ = + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.newBuilder(amount_) + .mergeFrom(value) + .buildPartial(); + } else { + amount_ = value; + } + onChanged(); + } else { + amountBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearAmount() { + if (amountBuilder_ == null) { + amount_ = null; + onChanged(); + } else { + amount_ = null; + amountBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetAmount.Builder getAmountBuilder() { + + onChanged(); + return getAmountFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetAmountOrBuilder getAmountOrBuilder() { + if (amountBuilder_ != null) { + return amountBuilder_.getMessageOrBuilder(); + } else { + return amount_ == null + ? com.google.cloud.billing.budgets.v1beta1.BudgetAmount.getDefaultInstance() + : amount_; + } + } + /** + * + * + *
+     * Required. Budgeted amount.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.BudgetAmount, + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetAmountOrBuilder> + getAmountFieldBuilder() { + if (amountBuilder_ == null) { + amountBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.BudgetAmount, + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetAmountOrBuilder>( + getAmount(), getParentForChildren(), isClean()); + amount_ = null; + } + return amountBuilder_; + } + + private java.util.List thresholdRules_ = + java.util.Collections.emptyList(); + + private void ensureThresholdRulesIsMutable() { + if (!((bitField0_ & 0x00000010) != 0)) { + thresholdRules_ = + new java.util.ArrayList( + thresholdRules_); + bitField0_ |= 0x00000010; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.ThresholdRule, + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder, + com.google.cloud.billing.budgets.v1beta1.ThresholdRuleOrBuilder> + thresholdRulesBuilder_; + + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getThresholdRulesList() { + if (thresholdRulesBuilder_ == null) { + return java.util.Collections.unmodifiableList(thresholdRules_); + } else { + return thresholdRulesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public int getThresholdRulesCount() { + if (thresholdRulesBuilder_ == null) { + return thresholdRules_.size(); + } else { + return thresholdRulesBuilder_.getCount(); + } + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule getThresholdRules(int index) { + if (thresholdRulesBuilder_ == null) { + return thresholdRules_.get(index); + } else { + return thresholdRulesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setThresholdRules( + int index, com.google.cloud.billing.budgets.v1beta1.ThresholdRule value) { + if (thresholdRulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThresholdRulesIsMutable(); + thresholdRules_.set(index, value); + onChanged(); + } else { + thresholdRulesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setThresholdRules( + int index, com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder builderForValue) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + thresholdRules_.set(index, builderForValue.build()); + onChanged(); + } else { + thresholdRulesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addThresholdRules(com.google.cloud.billing.budgets.v1beta1.ThresholdRule value) { + if (thresholdRulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThresholdRulesIsMutable(); + thresholdRules_.add(value); + onChanged(); + } else { + thresholdRulesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addThresholdRules( + int index, com.google.cloud.billing.budgets.v1beta1.ThresholdRule value) { + if (thresholdRulesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureThresholdRulesIsMutable(); + thresholdRules_.add(index, value); + onChanged(); + } else { + thresholdRulesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addThresholdRules( + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder builderForValue) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + thresholdRules_.add(builderForValue.build()); + onChanged(); + } else { + thresholdRulesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addThresholdRules( + int index, com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder builderForValue) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + thresholdRules_.add(index, builderForValue.build()); + onChanged(); + } else { + thresholdRulesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder addAllThresholdRules( + java.lang.Iterable + values) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, thresholdRules_); + onChanged(); + } else { + thresholdRulesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearThresholdRules() { + if (thresholdRulesBuilder_ == null) { + thresholdRules_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000010); + onChanged(); + } else { + thresholdRulesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder removeThresholdRules(int index) { + if (thresholdRulesBuilder_ == null) { + ensureThresholdRulesIsMutable(); + thresholdRules_.remove(index); + onChanged(); + } else { + thresholdRulesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder getThresholdRulesBuilder( + int index) { + return getThresholdRulesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRuleOrBuilder + getThresholdRulesOrBuilder(int index) { + if (thresholdRulesBuilder_ == null) { + return thresholdRules_.get(index); + } else { + return thresholdRulesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getThresholdRulesOrBuilderList() { + if (thresholdRulesBuilder_ != null) { + return thresholdRulesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(thresholdRules_); + } + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder + addThresholdRulesBuilder() { + return getThresholdRulesFieldBuilder() + .addBuilder(com.google.cloud.billing.budgets.v1beta1.ThresholdRule.getDefaultInstance()); + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder addThresholdRulesBuilder( + int index) { + return getThresholdRulesFieldBuilder() + .addBuilder( + index, com.google.cloud.billing.budgets.v1beta1.ThresholdRule.getDefaultInstance()); + } + /** + * + * + *
+     * Required. Rules that trigger alerts (notifications of thresholds
+     * being crossed) when spend exceeds the specified percentages of the budget.
+     * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public java.util.List + getThresholdRulesBuilderList() { + return getThresholdRulesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.ThresholdRule, + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder, + com.google.cloud.billing.budgets.v1beta1.ThresholdRuleOrBuilder> + getThresholdRulesFieldBuilder() { + if (thresholdRulesBuilder_ == null) { + thresholdRulesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.ThresholdRule, + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder, + com.google.cloud.billing.budgets.v1beta1.ThresholdRuleOrBuilder>( + thresholdRules_, + ((bitField0_ & 0x00000010) != 0), + getParentForChildren(), + isClean()); + thresholdRules_ = null; + } + return thresholdRulesBuilder_; + } + + private com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule allUpdatesRule_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule, + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.Builder, + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRuleOrBuilder> + allUpdatesRuleBuilder_; + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean hasAllUpdatesRule() { + return allUpdatesRuleBuilder_ != null || allUpdatesRule_ != null; + } + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule getAllUpdatesRule() { + if (allUpdatesRuleBuilder_ == null) { + return allUpdatesRule_ == null + ? com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.getDefaultInstance() + : allUpdatesRule_; + } else { + return allUpdatesRuleBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAllUpdatesRule( + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule value) { + if (allUpdatesRuleBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + allUpdatesRule_ = value; + onChanged(); + } else { + allUpdatesRuleBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setAllUpdatesRule( + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.Builder builderForValue) { + if (allUpdatesRuleBuilder_ == null) { + allUpdatesRule_ = builderForValue.build(); + onChanged(); + } else { + allUpdatesRuleBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeAllUpdatesRule( + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule value) { + if (allUpdatesRuleBuilder_ == null) { + if (allUpdatesRule_ != null) { + allUpdatesRule_ = + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.newBuilder(allUpdatesRule_) + .mergeFrom(value) + .buildPartial(); + } else { + allUpdatesRule_ = value; + } + onChanged(); + } else { + allUpdatesRuleBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearAllUpdatesRule() { + if (allUpdatesRuleBuilder_ == null) { + allUpdatesRule_ = null; + onChanged(); + } else { + allUpdatesRule_ = null; + allUpdatesRuleBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.Builder + getAllUpdatesRuleBuilder() { + + onChanged(); + return getAllUpdatesRuleFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.AllUpdatesRuleOrBuilder + getAllUpdatesRuleOrBuilder() { + if (allUpdatesRuleBuilder_ != null) { + return allUpdatesRuleBuilder_.getMessageOrBuilder(); + } else { + return allUpdatesRule_ == null + ? com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.getDefaultInstance() + : allUpdatesRule_; + } + } + /** + * + * + *
+     * Optional. Rules to apply to all updates to the actual spend, regardless
+     * of the thresholds set in `threshold_rules`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule, + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.Builder, + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRuleOrBuilder> + getAllUpdatesRuleFieldBuilder() { + if (allUpdatesRuleBuilder_ == null) { + allUpdatesRuleBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule, + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule.Builder, + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRuleOrBuilder>( + getAllUpdatesRule(), getParentForChildren(), isClean()); + allUpdatesRule_ = null; + } + return allUpdatesRuleBuilder_; + } + + private java.lang.Object etag_ = ""; + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getEtag() { + java.lang.Object ref = etag_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + etag_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getEtagBytes() { + java.lang.Object ref = etag_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + etag_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setEtag(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Etag to validate that the object is unchanged for a
+     * read-modify-write operation.
+     * An empty etag will cause an update to overwrite other changes.
+     * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setEtagBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + etag_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.Budget) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.Budget) + private static final com.google.cloud.billing.budgets.v1beta1.Budget DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.Budget(); + } + + public static com.google.cloud.billing.budgets.v1beta1.Budget getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Budget parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Budget(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.Budget getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetAmount.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetAmount.java new file mode 100644 index 00000000..60352a4b --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetAmount.java @@ -0,0 +1,1139 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * The budgeted amount for each usage period.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.BudgetAmount} + */ +public final class BudgetAmount extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.BudgetAmount) + BudgetAmountOrBuilder { + private static final long serialVersionUID = 0L; + // Use BudgetAmount.newBuilder() to construct. + private BudgetAmount(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BudgetAmount() {} + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BudgetAmount( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.type.Money.Builder subBuilder = null; + if (budgetAmountCase_ == 1) { + subBuilder = ((com.google.type.Money) budgetAmount_).toBuilder(); + } + budgetAmount_ = input.readMessage(com.google.type.Money.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.type.Money) budgetAmount_); + budgetAmount_ = subBuilder.buildPartial(); + } + budgetAmountCase_ = 1; + break; + } + case 18: + { + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.Builder subBuilder = null; + if (budgetAmountCase_ == 2) { + subBuilder = + ((com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_) + .toBuilder(); + } + budgetAmount_ = + input.readMessage( + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_); + budgetAmount_ = subBuilder.buildPartial(); + } + budgetAmountCase_ = 2; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.class, + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.Builder.class); + } + + private int budgetAmountCase_ = 0; + private java.lang.Object budgetAmount_; + + public enum BudgetAmountCase implements com.google.protobuf.Internal.EnumLite { + SPECIFIED_AMOUNT(1), + LAST_PERIOD_AMOUNT(2), + BUDGETAMOUNT_NOT_SET(0); + private final int value; + + private BudgetAmountCase(int value) { + this.value = value; + } + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static BudgetAmountCase valueOf(int value) { + return forNumber(value); + } + + public static BudgetAmountCase forNumber(int value) { + switch (value) { + case 1: + return SPECIFIED_AMOUNT; + case 2: + return LAST_PERIOD_AMOUNT; + case 0: + return BUDGETAMOUNT_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public BudgetAmountCase getBudgetAmountCase() { + return BudgetAmountCase.forNumber(budgetAmountCase_); + } + + public static final int SPECIFIED_AMOUNT_FIELD_NUMBER = 1; + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + */ + public boolean hasSpecifiedAmount() { + return budgetAmountCase_ == 1; + } + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + */ + public com.google.type.Money getSpecifiedAmount() { + if (budgetAmountCase_ == 1) { + return (com.google.type.Money) budgetAmount_; + } + return com.google.type.Money.getDefaultInstance(); + } + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + */ + public com.google.type.MoneyOrBuilder getSpecifiedAmountOrBuilder() { + if (budgetAmountCase_ == 1) { + return (com.google.type.Money) budgetAmount_; + } + return com.google.type.Money.getDefaultInstance(); + } + + public static final int LAST_PERIOD_AMOUNT_FIELD_NUMBER = 2; + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public boolean hasLastPeriodAmount() { + return budgetAmountCase_ == 2; + } + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount getLastPeriodAmount() { + if (budgetAmountCase_ == 2) { + return (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_; + } + return com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance(); + } + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmountOrBuilder + getLastPeriodAmountOrBuilder() { + if (budgetAmountCase_ == 2) { + return (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_; + } + return com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (budgetAmountCase_ == 1) { + output.writeMessage(1, (com.google.type.Money) budgetAmount_); + } + if (budgetAmountCase_ == 2) { + output.writeMessage( + 2, (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (budgetAmountCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 1, (com.google.type.Money) budgetAmount_); + } + if (budgetAmountCase_ == 2) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 2, (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.BudgetAmount)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.BudgetAmount other = + (com.google.cloud.billing.budgets.v1beta1.BudgetAmount) obj; + + if (!getBudgetAmountCase().equals(other.getBudgetAmountCase())) return false; + switch (budgetAmountCase_) { + case 1: + if (!getSpecifiedAmount().equals(other.getSpecifiedAmount())) return false; + break; + case 2: + if (!getLastPeriodAmount().equals(other.getLastPeriodAmount())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + switch (budgetAmountCase_) { + case 1: + hash = (37 * hash) + SPECIFIED_AMOUNT_FIELD_NUMBER; + hash = (53 * hash) + getSpecifiedAmount().hashCode(); + break; + case 2: + hash = (37 * hash) + LAST_PERIOD_AMOUNT_FIELD_NUMBER; + hash = (53 * hash) + getLastPeriodAmount().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.BudgetAmount prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The budgeted amount for each usage period.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.BudgetAmount} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.BudgetAmount) + com.google.cloud.billing.budgets.v1beta1.BudgetAmountOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.class, + com.google.cloud.billing.budgets.v1beta1.BudgetAmount.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.BudgetAmount.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + budgetAmountCase_ = 0; + budgetAmount_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.BudgetAmount getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetAmount.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.BudgetAmount build() { + com.google.cloud.billing.budgets.v1beta1.BudgetAmount result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.BudgetAmount buildPartial() { + com.google.cloud.billing.budgets.v1beta1.BudgetAmount result = + new com.google.cloud.billing.budgets.v1beta1.BudgetAmount(this); + if (budgetAmountCase_ == 1) { + if (specifiedAmountBuilder_ == null) { + result.budgetAmount_ = budgetAmount_; + } else { + result.budgetAmount_ = specifiedAmountBuilder_.build(); + } + } + if (budgetAmountCase_ == 2) { + if (lastPeriodAmountBuilder_ == null) { + result.budgetAmount_ = budgetAmount_; + } else { + result.budgetAmount_ = lastPeriodAmountBuilder_.build(); + } + } + result.budgetAmountCase_ = budgetAmountCase_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.BudgetAmount) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.BudgetAmount) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.BudgetAmount other) { + if (other == com.google.cloud.billing.budgets.v1beta1.BudgetAmount.getDefaultInstance()) + return this; + switch (other.getBudgetAmountCase()) { + case SPECIFIED_AMOUNT: + { + mergeSpecifiedAmount(other.getSpecifiedAmount()); + break; + } + case LAST_PERIOD_AMOUNT: + { + mergeLastPeriodAmount(other.getLastPeriodAmount()); + break; + } + case BUDGETAMOUNT_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.BudgetAmount parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.BudgetAmount) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int budgetAmountCase_ = 0; + private java.lang.Object budgetAmount_; + + public BudgetAmountCase getBudgetAmountCase() { + return BudgetAmountCase.forNumber(budgetAmountCase_); + } + + public Builder clearBudgetAmount() { + budgetAmountCase_ = 0; + budgetAmount_ = null; + onChanged(); + return this; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder> + specifiedAmountBuilder_; + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public boolean hasSpecifiedAmount() { + return budgetAmountCase_ == 1; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public com.google.type.Money getSpecifiedAmount() { + if (specifiedAmountBuilder_ == null) { + if (budgetAmountCase_ == 1) { + return (com.google.type.Money) budgetAmount_; + } + return com.google.type.Money.getDefaultInstance(); + } else { + if (budgetAmountCase_ == 1) { + return specifiedAmountBuilder_.getMessage(); + } + return com.google.type.Money.getDefaultInstance(); + } + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public Builder setSpecifiedAmount(com.google.type.Money value) { + if (specifiedAmountBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budgetAmount_ = value; + onChanged(); + } else { + specifiedAmountBuilder_.setMessage(value); + } + budgetAmountCase_ = 1; + return this; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public Builder setSpecifiedAmount(com.google.type.Money.Builder builderForValue) { + if (specifiedAmountBuilder_ == null) { + budgetAmount_ = builderForValue.build(); + onChanged(); + } else { + specifiedAmountBuilder_.setMessage(builderForValue.build()); + } + budgetAmountCase_ = 1; + return this; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public Builder mergeSpecifiedAmount(com.google.type.Money value) { + if (specifiedAmountBuilder_ == null) { + if (budgetAmountCase_ == 1 && budgetAmount_ != com.google.type.Money.getDefaultInstance()) { + budgetAmount_ = + com.google.type.Money.newBuilder((com.google.type.Money) budgetAmount_) + .mergeFrom(value) + .buildPartial(); + } else { + budgetAmount_ = value; + } + onChanged(); + } else { + if (budgetAmountCase_ == 1) { + specifiedAmountBuilder_.mergeFrom(value); + } + specifiedAmountBuilder_.setMessage(value); + } + budgetAmountCase_ = 1; + return this; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public Builder clearSpecifiedAmount() { + if (specifiedAmountBuilder_ == null) { + if (budgetAmountCase_ == 1) { + budgetAmountCase_ = 0; + budgetAmount_ = null; + onChanged(); + } + } else { + if (budgetAmountCase_ == 1) { + budgetAmountCase_ = 0; + budgetAmount_ = null; + } + specifiedAmountBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public com.google.type.Money.Builder getSpecifiedAmountBuilder() { + return getSpecifiedAmountFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + public com.google.type.MoneyOrBuilder getSpecifiedAmountOrBuilder() { + if ((budgetAmountCase_ == 1) && (specifiedAmountBuilder_ != null)) { + return specifiedAmountBuilder_.getMessageOrBuilder(); + } else { + if (budgetAmountCase_ == 1) { + return (com.google.type.Money) budgetAmount_; + } + return com.google.type.Money.getDefaultInstance(); + } + } + /** + * + * + *
+     * A specified amount to use as the budget.
+     * `currency_code` is optional. If specified, it must match the
+     * currency of the billing account. The `currency_code` is provided on
+     * output.
+     * 
+ * + * .google.type.Money specified_amount = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder> + getSpecifiedAmountFieldBuilder() { + if (specifiedAmountBuilder_ == null) { + if (!(budgetAmountCase_ == 1)) { + budgetAmount_ = com.google.type.Money.getDefaultInstance(); + } + specifiedAmountBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, + com.google.type.Money.Builder, + com.google.type.MoneyOrBuilder>( + (com.google.type.Money) budgetAmount_, getParentForChildren(), isClean()); + budgetAmount_ = null; + } + budgetAmountCase_ = 1; + onChanged(); + ; + return specifiedAmountBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount, + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.Builder, + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmountOrBuilder> + lastPeriodAmountBuilder_; + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public boolean hasLastPeriodAmount() { + return budgetAmountCase_ == 2; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount getLastPeriodAmount() { + if (lastPeriodAmountBuilder_ == null) { + if (budgetAmountCase_ == 2) { + return (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_; + } + return com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance(); + } else { + if (budgetAmountCase_ == 2) { + return lastPeriodAmountBuilder_.getMessage(); + } + return com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance(); + } + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public Builder setLastPeriodAmount( + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount value) { + if (lastPeriodAmountBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budgetAmount_ = value; + onChanged(); + } else { + lastPeriodAmountBuilder_.setMessage(value); + } + budgetAmountCase_ = 2; + return this; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public Builder setLastPeriodAmount( + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.Builder builderForValue) { + if (lastPeriodAmountBuilder_ == null) { + budgetAmount_ = builderForValue.build(); + onChanged(); + } else { + lastPeriodAmountBuilder_.setMessage(builderForValue.build()); + } + budgetAmountCase_ = 2; + return this; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public Builder mergeLastPeriodAmount( + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount value) { + if (lastPeriodAmountBuilder_ == null) { + if (budgetAmountCase_ == 2 + && budgetAmount_ + != com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance()) { + budgetAmount_ = + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.newBuilder( + (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_) + .mergeFrom(value) + .buildPartial(); + } else { + budgetAmount_ = value; + } + onChanged(); + } else { + if (budgetAmountCase_ == 2) { + lastPeriodAmountBuilder_.mergeFrom(value); + } + lastPeriodAmountBuilder_.setMessage(value); + } + budgetAmountCase_ = 2; + return this; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public Builder clearLastPeriodAmount() { + if (lastPeriodAmountBuilder_ == null) { + if (budgetAmountCase_ == 2) { + budgetAmountCase_ = 0; + budgetAmount_ = null; + onChanged(); + } + } else { + if (budgetAmountCase_ == 2) { + budgetAmountCase_ = 0; + budgetAmount_ = null; + } + lastPeriodAmountBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.Builder + getLastPeriodAmountBuilder() { + return getLastPeriodAmountFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmountOrBuilder + getLastPeriodAmountOrBuilder() { + if ((budgetAmountCase_ == 2) && (lastPeriodAmountBuilder_ != null)) { + return lastPeriodAmountBuilder_.getMessageOrBuilder(); + } else { + if (budgetAmountCase_ == 2) { + return (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_; + } + return com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance(); + } + } + /** + * + * + *
+     * Use the last period's actual spend as the budget for the present period.
+     * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount, + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.Builder, + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmountOrBuilder> + getLastPeriodAmountFieldBuilder() { + if (lastPeriodAmountBuilder_ == null) { + if (!(budgetAmountCase_ == 2)) { + budgetAmount_ = + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance(); + } + lastPeriodAmountBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount, + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.Builder, + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmountOrBuilder>( + (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) budgetAmount_, + getParentForChildren(), + isClean()); + budgetAmount_ = null; + } + budgetAmountCase_ = 2; + onChanged(); + ; + return lastPeriodAmountBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.BudgetAmount) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.BudgetAmount) + private static final com.google.cloud.billing.budgets.v1beta1.BudgetAmount DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.BudgetAmount(); + } + + public static com.google.cloud.billing.budgets.v1beta1.BudgetAmount getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BudgetAmount parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BudgetAmount(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.BudgetAmount getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetAmountOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetAmountOrBuilder.java new file mode 100644 index 00000000..69a49206 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetAmountOrBuilder.java @@ -0,0 +1,99 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface BudgetAmountOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.BudgetAmount) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + */ + boolean hasSpecifiedAmount(); + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + */ + com.google.type.Money getSpecifiedAmount(); + /** + * + * + *
+   * A specified amount to use as the budget.
+   * `currency_code` is optional. If specified, it must match the
+   * currency of the billing account. The `currency_code` is provided on
+   * output.
+   * 
+ * + * .google.type.Money specified_amount = 1; + */ + com.google.type.MoneyOrBuilder getSpecifiedAmountOrBuilder(); + + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + boolean hasLastPeriodAmount(); + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount getLastPeriodAmount(); + /** + * + * + *
+   * Use the last period's actual spend as the budget for the present period.
+   * 
+ * + * .google.cloud.billing.budgets.v1beta1.LastPeriodAmount last_period_amount = 2; + */ + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmountOrBuilder getLastPeriodAmountOrBuilder(); + + public com.google.cloud.billing.budgets.v1beta1.BudgetAmount.BudgetAmountCase + getBudgetAmountCase(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetModel.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetModel.java new file mode 100644 index 00000000..09093f86 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetModel.java @@ -0,0 +1,183 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public final class BudgetModel { + private BudgetModel() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_Budget_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_Budget_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_Filter_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_Filter_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n7google/cloud/billing/budgets/v1beta1/b" + + "udget_model.proto\022$google.cloud.billing." + + "budgets.v1beta1\032\037google/api/field_behavi" + + "or.proto\032\031google/api/resource.proto\032\027goo" + + "gle/type/money.proto\"\336\003\n\006Budget\022\021\n\004name\030" + + "\001 \001(\tB\003\340A\003\022\024\n\014display_name\030\002 \001(\t\022H\n\rbudg" + + "et_filter\030\003 \001(\0132,.google.cloud.billing.b" + + "udgets.v1beta1.FilterB\003\340A\001\022G\n\006amount\030\004 \001" + + "(\01322.google.cloud.billing.budgets.v1beta" + + "1.BudgetAmountB\003\340A\002\022Q\n\017threshold_rules\030\005" + + " \003(\01323.google.cloud.billing.budgets.v1be" + + "ta1.ThresholdRuleB\003\340A\002\022S\n\020all_updates_ru" + + "le\030\006 \001(\01324.google.cloud.billing.budgets." + + "v1beta1.AllUpdatesRuleB\003\340A\001\022\021\n\004etag\030\007 \001(" + + "\tB\003\340A\001:]\352AZ\n$billingbudgets.googleapis.c" + + "om/Budget\0222billingAccounts/{billing_acco" + + "unt}/budgets/{budget}\"\245\001\n\014BudgetAmount\022." + + "\n\020specified_amount\030\001 \001(\0132\022.google.type.M" + + "oneyH\000\022T\n\022last_period_amount\030\002 \001(\01326.goo" + + "gle.cloud.billing.budgets.v1beta1.LastPe" + + "riodAmountH\000B\017\n\rbudget_amount\"\022\n\020LastPer" + + "iodAmount\"\315\001\n\rThresholdRule\022\036\n\021threshold" + + "_percent\030\001 \001(\001B\003\340A\002\022S\n\013spend_basis\030\002 \001(\016" + + "29.google.cloud.billing.budgets.v1beta1." + + "ThresholdRule.BasisB\003\340A\001\"G\n\005Basis\022\025\n\021BAS" + + "IS_UNSPECIFIED\020\000\022\021\n\rCURRENT_SPEND\020\001\022\024\n\020F" + + "ORECASTED_SPEND\020\002\"H\n\016AllUpdatesRule\022\031\n\014p" + + "ubsub_topic\030\001 \001(\tB\003\340A\002\022\033\n\016schema_version" + + "\030\002 \001(\tB\003\340A\002\"\220\002\n\006Filter\022\025\n\010projects\030\001 \003(\t" + + "B\003\340A\001\022f\n\026credit_types_treatment\030\004 \001(\0162A." + + "google.cloud.billing.budgets.v1beta1.Fil" + + "ter.CreditTypesTreatmentB\003\340A\001\022\025\n\010service" + + "s\030\003 \003(\tB\003\340A\001\"p\n\024CreditTypesTreatment\022&\n\"" + + "CREDIT_TYPES_TREATMENT_UNSPECIFIED\020\000\022\027\n\023" + + "INCLUDE_ALL_CREDITS\020\001\022\027\n\023EXCLUDE_ALL_CRE" + + "DITS\020\002By\n(com.google.cloud.billing.budge" + + "ts.v1beta1P\001ZKgoogle.golang.org/genproto" + + "/googleapis/cloud/billing/budgets/v1beta" + + "1;budgetsb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.type.MoneyProto.getDescriptor(), + }, + assigner); + internal_static_google_cloud_billing_budgets_v1beta1_Budget_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_billing_budgets_v1beta1_Budget_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_Budget_descriptor, + new java.lang.String[] { + "Name", + "DisplayName", + "BudgetFilter", + "Amount", + "ThresholdRules", + "AllUpdatesRule", + "Etag", + }); + internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_BudgetAmount_descriptor, + new java.lang.String[] { + "SpecifiedAmount", "LastPeriodAmount", "BudgetAmount", + }); + internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_descriptor, + new java.lang.String[] {}); + internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_descriptor, + new java.lang.String[] { + "ThresholdPercent", "SpendBasis", + }); + internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_AllUpdatesRule_descriptor, + new java.lang.String[] { + "PubsubTopic", "SchemaVersion", + }); + internal_static_google_cloud_billing_budgets_v1beta1_Filter_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_billing_budgets_v1beta1_Filter_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_Filter_descriptor, + new java.lang.String[] { + "Projects", "CreditTypesTreatment", "Services", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.ResourceProto.resource); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.type.MoneyProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetName.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetName.java new file mode 100644 index 00000000..70b89472 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetName.java @@ -0,0 +1,182 @@ +/* + * 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.billing.budgets.v1beta1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +@javax.annotation.Generated("by GAPIC protoc plugin") +public class BudgetName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("billingAccounts/{billing_account}/budgets/{budget}"); + + private volatile Map fieldValuesMap; + + private final String billingAccount; + private final String budget; + + public String getBillingAccount() { + return billingAccount; + } + + public String getBudget() { + return budget; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private BudgetName(Builder builder) { + billingAccount = Preconditions.checkNotNull(builder.getBillingAccount()); + budget = Preconditions.checkNotNull(builder.getBudget()); + } + + public static BudgetName of(String billingAccount, String budget) { + return newBuilder().setBillingAccount(billingAccount).setBudget(budget).build(); + } + + public static String format(String billingAccount, String budget) { + return newBuilder().setBillingAccount(billingAccount).setBudget(budget).build().toString(); + } + + public static BudgetName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "BudgetName.parse: formattedString not in valid format"); + return of(matchMap.get("billing_account"), matchMap.get("budget")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList(values.size()); + for (BudgetName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PATH_TEMPLATE.matches(formattedString); + } + + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + fieldMapBuilder.put("billingAccount", billingAccount); + fieldMapBuilder.put("budget", budget); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("billing_account", billingAccount, "budget", budget); + } + + /** Builder for BudgetName. */ + public static class Builder { + + private String billingAccount; + private String budget; + + public String getBillingAccount() { + return billingAccount; + } + + public String getBudget() { + return budget; + } + + public Builder setBillingAccount(String billingAccount) { + this.billingAccount = billingAccount; + return this; + } + + public Builder setBudget(String budget) { + this.budget = budget; + return this; + } + + private Builder() {} + + private Builder(BudgetName budgetName) { + billingAccount = budgetName.billingAccount; + budget = budgetName.budget; + } + + public BudgetName build() { + return new BudgetName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof BudgetName) { + BudgetName that = (BudgetName) o; + return (this.billingAccount.equals(that.billingAccount)) && (this.budget.equals(that.budget)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= billingAccount.hashCode(); + h *= 1000003; + h ^= budget.hashCode(); + return h; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetOrBuilder.java new file mode 100644 index 00000000..cfa3f4b0 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetOrBuilder.java @@ -0,0 +1,283 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface BudgetOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.Budget) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. Resource name of the budget.
+   * The resource name implies the scope of a budget. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + java.lang.String getName(); + /** + * + * + *
+   * Output only. Resource name of the budget.
+   * The resource name implies the scope of a budget. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * User data for display name in UI.
+   * Validation: <= 60 chars.
+   * 
+ * + * string display_name = 2; + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * User data for display name in UI.
+   * Validation: <= 60 chars.
+   * 
+ * + * string display_name = 2; + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean hasBudgetFilter(); + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1beta1.Filter getBudgetFilter(); + /** + * + * + *
+   * Optional. Filters that define which resources are used to compute
+   * the actual spend against the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter budget_filter = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1beta1.FilterOrBuilder getBudgetFilterOrBuilder(); + + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + boolean hasAmount(); + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1beta1.BudgetAmount getAmount(); + /** + * + * + *
+   * Required. Budgeted amount.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.BudgetAmount amount = 4 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1beta1.BudgetAmountOrBuilder getAmountOrBuilder(); + + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List getThresholdRulesList(); + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1beta1.ThresholdRule getThresholdRules(int index); + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + int getThresholdRulesCount(); + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + java.util.List + getThresholdRulesOrBuilderList(); + /** + * + * + *
+   * Required. Rules that trigger alerts (notifications of thresholds
+   * being crossed) when spend exceeds the specified percentages of the budget.
+   * 
+ * + * + * repeated .google.cloud.billing.budgets.v1beta1.ThresholdRule threshold_rules = 5 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1beta1.ThresholdRuleOrBuilder getThresholdRulesOrBuilder( + int index); + + /** + * + * + *
+   * Optional. Rules to apply to all updates to the actual spend, regardless
+   * of the thresholds set in `threshold_rules`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean hasAllUpdatesRule(); + /** + * + * + *
+   * Optional. Rules to apply to all updates to the actual spend, regardless
+   * of the thresholds set in `threshold_rules`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRule getAllUpdatesRule(); + /** + * + * + *
+   * Optional. Rules to apply to all updates to the actual spend, regardless
+   * of the thresholds set in `threshold_rules`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.AllUpdatesRule all_updates_rule = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1beta1.AllUpdatesRuleOrBuilder getAllUpdatesRuleOrBuilder(); + + /** + * + * + *
+   * Optional. Etag to validate that the object is unchanged for a
+   * read-modify-write operation.
+   * An empty etag will cause an update to overwrite other changes.
+   * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getEtag(); + /** + * + * + *
+   * Optional. Etag to validate that the object is unchanged for a
+   * read-modify-write operation.
+   * An empty etag will cause an update to overwrite other changes.
+   * 
+ * + * string etag = 7 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getEtagBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceOuterClass.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceOuterClass.java new file mode 100644 index 00000000..0a0d769d --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/BudgetServiceOuterClass.java @@ -0,0 +1,205 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public final class BudgetServiceOuterClass { + private BudgetServiceOuterClass() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n9google/cloud/billing/budgets/v1beta1/b" + + "udget_service.proto\022$google.cloud.billin" + + "g.budgets.v1beta1\032\034google/api/annotation" + + "s.proto\032\027google/api/client.proto\032\037google" + + "/api/field_behavior.proto\032\031google/api/re" + + "source.proto\0327google/cloud/billing/budge" + + "ts/v1beta1/budget_model.proto\032\033google/pr" + + "otobuf/empty.proto\032 google/protobuf/fiel" + + "d_mask.proto\"\226\001\n\023CreateBudgetRequest\022<\n\006" + + "parent\030\001 \001(\tB,\340A\002\372A&\022$billingbudgets.goo" + + "gleapis.com/Budget\022A\n\006budget\030\002 \001(\0132,.goo" + + "gle.cloud.billing.budgets.v1beta1.Budget" + + "B\003\340A\002\"\216\001\n\023UpdateBudgetRequest\022A\n\006budget\030" + + "\001 \001(\0132,.google.cloud.billing.budgets.v1b" + + "eta1.BudgetB\003\340A\002\0224\n\013update_mask\030\002 \001(\0132\032." + + "google.protobuf.FieldMaskB\003\340A\001\"N\n\020GetBud" + + "getRequest\022:\n\004name\030\001 \001(\tB,\340A\002\372A&\n$billin" + + "gbudgets.googleapis.com/Budget\"\203\001\n\022ListB" + + "udgetsRequest\022<\n\006parent\030\001 \001(\tB,\340A\002\372A&\022$b" + + "illingbudgets.googleapis.com/Budget\022\026\n\tp" + + "age_size\030\002 \001(\005B\003\340A\001\022\027\n\npage_token\030\003 \001(\tB" + + "\003\340A\001\"m\n\023ListBudgetsResponse\022=\n\007budgets\030\001" + + " \003(\0132,.google.cloud.billing.budgets.v1be" + + "ta1.Budget\022\027\n\017next_page_token\030\002 \001(\t\"Q\n\023D" + + "eleteBudgetRequest\022:\n\004name\030\001 \001(\tB,\340A\002\372A&" + + "\n$billingbudgets.googleapis.com/Budget2\311" + + "\007\n\rBudgetService\022\257\001\n\014CreateBudget\0229.goog" + + "le.cloud.billing.budgets.v1beta1.CreateB" + + "udgetRequest\032,.google.cloud.billing.budg" + + "ets.v1beta1.Budget\"6\202\323\344\223\0020\"+/v1beta1/{pa" + + "rent=billingAccounts/*}/budgets:\001*\022\266\001\n\014U" + + "pdateBudget\0229.google.cloud.billing.budge" + + "ts.v1beta1.UpdateBudgetRequest\032,.google." + + "cloud.billing.budgets.v1beta1.Budget\"=\202\323" + + "\344\223\002722/v1beta1/{budget.name=billingAccou" + + "nts/*/budgets/*}:\001*\022\246\001\n\tGetBudget\0226.goog" + + "le.cloud.billing.budgets.v1beta1.GetBudg" + + "etRequest\032,.google.cloud.billing.budgets" + + ".v1beta1.Budget\"3\202\323\344\223\002-\022+/v1beta1/{name=" + + "billingAccounts/*/budgets/*}\022\267\001\n\013ListBud" + + "gets\0228.google.cloud.billing.budgets.v1be" + + "ta1.ListBudgetsRequest\0329.google.cloud.bi" + + "lling.budgets.v1beta1.ListBudgetsRespons" + + "e\"3\202\323\344\223\002-\022+/v1beta1/{parent=billingAccou" + + "nts/*}/budgets\022\226\001\n\014DeleteBudget\0229.google" + + ".cloud.billing.budgets.v1beta1.DeleteBud" + + "getRequest\032\026.google.protobuf.Empty\"3\202\323\344\223" + + "\002-*+/v1beta1/{name=billingAccounts/*/bud" + + "gets/*}\032Q\312A\035billingbudgets.googleapis.co" + + "m\322A.https://www.googleapis.com/auth/clou" + + "d-platformBy\n(com.google.cloud.billing.b" + + "udgets.v1beta1P\001ZKgoogle.golang.org/genp" + + "roto/googleapis/cloud/billing/budgets/v1" + + "beta1;budgetsb\006proto3" + }; + com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = + new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { + public com.google.protobuf.ExtensionRegistry assignDescriptors( + com.google.protobuf.Descriptors.FileDescriptor root) { + descriptor = root; + return null; + } + }; + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.cloud.billing.budgets.v1beta1.BudgetModel.getDescriptor(), + com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), + }, + assigner); + internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_descriptor, + new java.lang.String[] { + "Parent", "Budget", + }); + internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_descriptor, + new java.lang.String[] { + "Budget", "UpdateMask", + }); + internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", + }); + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_descriptor, + new java.lang.String[] { + "Budgets", "NextPageToken", + }); + internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_descriptor, + new java.lang.String[] { + "Name", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resourceReference); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.cloud.billing.budgets.v1beta1.BudgetModel.getDescriptor(); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/CreateBudgetRequest.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/CreateBudgetRequest.java new file mode 100644 index 00000000..bb7bb3f5 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/CreateBudgetRequest.java @@ -0,0 +1,929 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * Request for CreateBudget
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.CreateBudgetRequest} + */ +public final class CreateBudgetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) + CreateBudgetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateBudgetRequest.newBuilder() to construct. + private CreateBudgetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateBudgetRequest() { + parent_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateBudgetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.cloud.billing.budgets.v1beta1.Budget.Builder subBuilder = null; + if (budget_ != null) { + subBuilder = budget_.toBuilder(); + } + budget_ = + input.readMessage( + com.google.cloud.billing.budgets.v1beta1.Budget.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(budget_); + budget_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest.class, + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. the name of the billing account to create the budget in. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. the name of the billing account to create the budget in. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BUDGET_FIELD_NUMBER = 2; + private com.google.cloud.billing.budgets.v1beta1.Budget budget_; + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasBudget() { + return budget_ != null; + } + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Budget getBudget() { + return budget_ == null + ? com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance() + : budget_; + } + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetOrBuilder() { + return getBudget(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (budget_ != null) { + output.writeMessage(2, getBudget()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (budget_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getBudget()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest other = + (com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasBudget() != other.hasBudget()) return false; + if (hasBudget()) { + if (!getBudget().equals(other.getBudget())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasBudget()) { + hash = (37 * hash) + BUDGET_FIELD_NUMBER; + hash = (53 * hash) + getBudget().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for CreateBudget
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.CreateBudgetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest.class, + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + if (budgetBuilder_ == null) { + budget_ = null; + } else { + budget_ = null; + budgetBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_CreateBudgetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest + getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest build() { + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest buildPartial() { + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest result = + new com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest(this); + result.parent_ = parent_; + if (budgetBuilder_ == null) { + result.budget_ = budget_; + } else { + result.budget_ = budgetBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest other) { + if (other + == com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasBudget()) { + mergeBudget(other.getBudget()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. the name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. the name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. the name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. the name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. the name of the billing account to create the budget in. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.cloud.billing.budgets.v1beta1.Budget budget_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder> + budgetBuilder_; + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasBudget() { + return budgetBuilder_ != null || budget_ != null; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Budget getBudget() { + if (budgetBuilder_ == null) { + return budget_ == null + ? com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance() + : budget_; + } else { + return budgetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBudget(com.google.cloud.billing.budgets.v1beta1.Budget value) { + if (budgetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budget_ = value; + onChanged(); + } else { + budgetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBudget( + com.google.cloud.billing.budgets.v1beta1.Budget.Builder builderForValue) { + if (budgetBuilder_ == null) { + budget_ = builderForValue.build(); + onChanged(); + } else { + budgetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeBudget(com.google.cloud.billing.budgets.v1beta1.Budget value) { + if (budgetBuilder_ == null) { + if (budget_ != null) { + budget_ = + com.google.cloud.billing.budgets.v1beta1.Budget.newBuilder(budget_) + .mergeFrom(value) + .buildPartial(); + } else { + budget_ = value; + } + onChanged(); + } else { + budgetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearBudget() { + if (budgetBuilder_ == null) { + budget_ = null; + onChanged(); + } else { + budget_ = null; + budgetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Budget.Builder getBudgetBuilder() { + + onChanged(); + return getBudgetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetOrBuilder() { + if (budgetBuilder_ != null) { + return budgetBuilder_.getMessageOrBuilder(); + } else { + return budget_ == null + ? com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance() + : budget_; + } + } + /** + * + * + *
+     * Required. Budget to create.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder> + getBudgetFieldBuilder() { + if (budgetBuilder_ == null) { + budgetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder>( + getBudget(), getParentForChildren(), isClean()); + budget_ = null; + } + return budgetBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) + private static final com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest(); + } + + public static com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateBudgetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateBudgetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.CreateBudgetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/CreateBudgetRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/CreateBudgetRequestOrBuilder.java new file mode 100644 index 00000000..e09953ff --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/CreateBudgetRequestOrBuilder.java @@ -0,0 +1,89 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface CreateBudgetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.CreateBudgetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. the name of the billing account to create the budget in. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. the name of the billing account to create the budget in. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + boolean hasBudget(); + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1beta1.Budget getBudget(); + /** + * + * + *
+   * Required. Budget to create.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetOrBuilder(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/DeleteBudgetRequest.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/DeleteBudgetRequest.java new file mode 100644 index 00000000..3809928f --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/DeleteBudgetRequest.java @@ -0,0 +1,638 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * Request for DeleteBudget
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest} + */ +public final class DeleteBudgetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) + DeleteBudgetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteBudgetRequest.newBuilder() to construct. + private DeleteBudgetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteBudgetRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private DeleteBudgetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest.class, + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Name of the budget to delete. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Name of the budget to delete. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest other = + (com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for DeleteBudget
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest.class, + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_DeleteBudgetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest + getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest build() { + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest buildPartial() { + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest result = + new com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest other) { + if (other + == com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of the budget to delete. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) + private static final com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest(); + } + + public static com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteBudgetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new DeleteBudgetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/DeleteBudgetRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/DeleteBudgetRequestOrBuilder.java new file mode 100644 index 00000000..1c61284c --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/DeleteBudgetRequestOrBuilder.java @@ -0,0 +1,52 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface DeleteBudgetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.DeleteBudgetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Name of the budget to delete. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Name of the budget to delete. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/Filter.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/Filter.java new file mode 100644 index 00000000..005f04cb --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/Filter.java @@ -0,0 +1,1351 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * A filter for a budget, limiting the scope of the cost to calculate.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.Filter} + */ +public final class Filter extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.Filter) + FilterOrBuilder { + private static final long serialVersionUID = 0L; + // Use Filter.newBuilder() to construct. + private Filter(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Filter() { + projects_ = com.google.protobuf.LazyStringArrayList.EMPTY; + creditTypesTreatment_ = 0; + services_ = com.google.protobuf.LazyStringArrayList.EMPTY; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Filter( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + projects_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + projects_.add(s); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000004) != 0)) { + services_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000004; + } + services_.add(s); + break; + } + case 32: + { + int rawValue = input.readEnum(); + + creditTypesTreatment_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + projects_ = projects_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000004) != 0)) { + services_ = services_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Filter_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Filter_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.Filter.class, + com.google.cloud.billing.budgets.v1beta1.Filter.Builder.class); + } + + /** + * + * + *
+   * Specifies how credits should be treated when determining spend for
+   * threshold calculations.
+   * 
+ * + * Protobuf enum {@code google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment} + */ + public enum CreditTypesTreatment implements com.google.protobuf.ProtocolMessageEnum { + /** CREDIT_TYPES_TREATMENT_UNSPECIFIED = 0; */ + CREDIT_TYPES_TREATMENT_UNSPECIFIED(0), + /** + * + * + *
+     * All types of credit are subtracted from the gross cost to determine the
+     * spend for threshold calculations.
+     * 
+ * + * INCLUDE_ALL_CREDITS = 1; + */ + INCLUDE_ALL_CREDITS(1), + /** + * + * + *
+     * All types of credit are added to the net cost to determine the spend for
+     * threshold calculations.
+     * 
+ * + * EXCLUDE_ALL_CREDITS = 2; + */ + EXCLUDE_ALL_CREDITS(2), + UNRECOGNIZED(-1), + ; + + /** CREDIT_TYPES_TREATMENT_UNSPECIFIED = 0; */ + public static final int CREDIT_TYPES_TREATMENT_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * All types of credit are subtracted from the gross cost to determine the
+     * spend for threshold calculations.
+     * 
+ * + * INCLUDE_ALL_CREDITS = 1; + */ + public static final int INCLUDE_ALL_CREDITS_VALUE = 1; + /** + * + * + *
+     * All types of credit are added to the net cost to determine the spend for
+     * threshold calculations.
+     * 
+ * + * EXCLUDE_ALL_CREDITS = 2; + */ + public static final int EXCLUDE_ALL_CREDITS_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static CreditTypesTreatment valueOf(int value) { + return forNumber(value); + } + + public static CreditTypesTreatment forNumber(int value) { + switch (value) { + case 0: + return CREDIT_TYPES_TREATMENT_UNSPECIFIED; + case 1: + return INCLUDE_ALL_CREDITS; + case 2: + return EXCLUDE_ALL_CREDITS; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public CreditTypesTreatment findValueByNumber(int number) { + return CreditTypesTreatment.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.Filter.getDescriptor().getEnumTypes().get(0); + } + + private static final CreditTypesTreatment[] VALUES = values(); + + public static CreditTypesTreatment valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private CreditTypesTreatment(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment) + } + + private int bitField0_; + public static final int PROJECTS_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList projects_; + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project_id}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ProtocolStringList getProjectsList() { + return projects_; + } + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project_id}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public int getProjectsCount() { + return projects_.size(); + } + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project_id}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getProjects(int index) { + return projects_.get(index); + } + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project_id}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getProjectsBytes(int index) { + return projects_.getByteString(index); + } + + public static final int CREDIT_TYPES_TREATMENT_FIELD_NUMBER = 4; + private int creditTypesTreatment_; + /** + * + * + *
+   * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getCreditTypesTreatmentValue() { + return creditTypesTreatment_; + } + /** + * + * + *
+   * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment + getCreditTypesTreatment() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment result = + com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment.valueOf( + creditTypesTreatment_); + return result == null + ? com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment.UNRECOGNIZED + : result; + } + + public static final int SERVICES_FIELD_NUMBER = 3; + private com.google.protobuf.LazyStringList services_; + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ProtocolStringList getServicesList() { + return services_; + } + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public int getServicesCount() { + return services_.size(); + } + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getServices(int index) { + return services_.get(index); + } + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getServicesBytes(int index) { + return services_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < projects_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, projects_.getRaw(i)); + } + for (int i = 0; i < services_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, services_.getRaw(i)); + } + if (creditTypesTreatment_ + != com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment + .CREDIT_TYPES_TREATMENT_UNSPECIFIED + .getNumber()) { + output.writeEnum(4, creditTypesTreatment_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < projects_.size(); i++) { + dataSize += computeStringSizeNoTag(projects_.getRaw(i)); + } + size += dataSize; + size += 1 * getProjectsList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < services_.size(); i++) { + dataSize += computeStringSizeNoTag(services_.getRaw(i)); + } + size += dataSize; + size += 1 * getServicesList().size(); + } + if (creditTypesTreatment_ + != com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment + .CREDIT_TYPES_TREATMENT_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(4, creditTypesTreatment_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.Filter)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.Filter other = + (com.google.cloud.billing.budgets.v1beta1.Filter) obj; + + if (!getProjectsList().equals(other.getProjectsList())) return false; + if (creditTypesTreatment_ != other.creditTypesTreatment_) return false; + if (!getServicesList().equals(other.getServicesList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getProjectsCount() > 0) { + hash = (37 * hash) + PROJECTS_FIELD_NUMBER; + hash = (53 * hash) + getProjectsList().hashCode(); + } + hash = (37 * hash) + CREDIT_TYPES_TREATMENT_FIELD_NUMBER; + hash = (53 * hash) + creditTypesTreatment_; + if (getServicesCount() > 0) { + hash = (37 * hash) + SERVICES_FIELD_NUMBER; + hash = (53 * hash) + getServicesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.billing.budgets.v1beta1.Filter prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * A filter for a budget, limiting the scope of the cost to calculate.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.Filter} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.Filter) + com.google.cloud.billing.budgets.v1beta1.FilterOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Filter_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Filter_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.Filter.class, + com.google.cloud.billing.budgets.v1beta1.Filter.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.Filter.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + projects_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + creditTypesTreatment_ = 0; + + services_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_Filter_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.Filter getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.Filter.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.Filter build() { + com.google.cloud.billing.budgets.v1beta1.Filter result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.Filter buildPartial() { + com.google.cloud.billing.budgets.v1beta1.Filter result = + new com.google.cloud.billing.budgets.v1beta1.Filter(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((bitField0_ & 0x00000001) != 0)) { + projects_ = projects_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.projects_ = projects_; + result.creditTypesTreatment_ = creditTypesTreatment_; + if (((bitField0_ & 0x00000004) != 0)) { + services_ = services_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000004); + } + result.services_ = services_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.Filter) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.Filter) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.Filter other) { + if (other == com.google.cloud.billing.budgets.v1beta1.Filter.getDefaultInstance()) + return this; + if (!other.projects_.isEmpty()) { + if (projects_.isEmpty()) { + projects_ = other.projects_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureProjectsIsMutable(); + projects_.addAll(other.projects_); + } + onChanged(); + } + if (other.creditTypesTreatment_ != 0) { + setCreditTypesTreatmentValue(other.getCreditTypesTreatmentValue()); + } + if (!other.services_.isEmpty()) { + if (services_.isEmpty()) { + services_ = other.services_; + bitField0_ = (bitField0_ & ~0x00000004); + } else { + ensureServicesIsMutable(); + services_.addAll(other.services_); + } + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.Filter parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.budgets.v1beta1.Filter) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList projects_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureProjectsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + projects_ = new com.google.protobuf.LazyStringArrayList(projects_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ProtocolStringList getProjectsList() { + return projects_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public int getProjectsCount() { + return projects_.size(); + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getProjects(int index) { + return projects_.get(index); + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getProjectsBytes(int index) { + return projects_.getByteString(index); + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setProjects(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureProjectsIsMutable(); + projects_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder addProjects(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureProjectsIsMutable(); + projects_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder addAllProjects(java.lang.Iterable values) { + ensureProjectsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, projects_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearProjects() { + projects_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of projects of the form `projects/{project_id}`,
+     * specifying that usage from only this set of projects should be
+     * included in the budget. If omitted, the report will include all usage for
+     * the billing account, regardless of which project the usage occurred on.
+     * Only zero or one project can be specified currently.
+     * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder addProjectsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureProjectsIsMutable(); + projects_.add(value); + onChanged(); + return this; + } + + private int creditTypesTreatment_ = 0; + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getCreditTypesTreatmentValue() { + return creditTypesTreatment_; + } + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCreditTypesTreatmentValue(int value) { + creditTypesTreatment_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment + getCreditTypesTreatment() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment result = + com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment.valueOf( + creditTypesTreatment_); + return result == null + ? com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setCreditTypesTreatment( + com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment value) { + if (value == null) { + throw new NullPointerException(); + } + + creditTypesTreatment_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearCreditTypesTreatment() { + + creditTypesTreatment_ = 0; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList services_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureServicesIsMutable() { + if (!((bitField0_ & 0x00000004) != 0)) { + services_ = new com.google.protobuf.LazyStringArrayList(services_); + bitField0_ |= 0x00000004; + } + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ProtocolStringList getServicesList() { + return services_.getUnmodifiableView(); + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public int getServicesCount() { + return services_.size(); + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getServices(int index) { + return services_.get(index); + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getServicesBytes(int index) { + return services_.getByteString(index); + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setServices(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureServicesIsMutable(); + services_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder addServices(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureServicesIsMutable(); + services_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder addAllServices(java.lang.Iterable values) { + ensureServicesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, services_); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearServices() { + services_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. A set of services of the form `services/{service_id}`,
+     * specifying that usage from only this set of services should be
+     * included in the budget. If omitted, the report will include usage for
+     * all the services.
+     * The service names are available through the Catalog API:
+     * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+     * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder addServicesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureServicesIsMutable(); + services_.add(value); + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.Filter) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.Filter) + private static final com.google.cloud.billing.budgets.v1beta1.Filter DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.Filter(); + } + + public static com.google.cloud.billing.budgets.v1beta1.Filter getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Filter parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Filter(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.Filter getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/FilterOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/FilterOrBuilder.java new file mode 100644 index 00000000..3b6501ac --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/FilterOrBuilder.java @@ -0,0 +1,168 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface FilterOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.Filter) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project_id}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.util.List getProjectsList(); + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project_id}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getProjectsCount(); + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project_id}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getProjects(int index); + /** + * + * + *
+   * Optional. A set of projects of the form `projects/{project_id}`,
+   * specifying that usage from only this set of projects should be
+   * included in the budget. If omitted, the report will include all usage for
+   * the billing account, regardless of which project the usage occurred on.
+   * Only zero or one project can be specified currently.
+   * 
+ * + * repeated string projects = 1 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getProjectsBytes(int index); + + /** + * + * + *
+   * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getCreditTypesTreatmentValue(); + /** + * + * + *
+   * Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment credit_types_treatment = 4 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1beta1.Filter.CreditTypesTreatment getCreditTypesTreatment(); + + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.util.List getServicesList(); + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getServicesCount(); + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getServices(int index); + /** + * + * + *
+   * Optional. A set of services of the form `services/{service_id}`,
+   * specifying that usage from only this set of services should be
+   * included in the budget. If omitted, the report will include usage for
+   * all the services.
+   * The service names are available through the Catalog API:
+   * https://cloud.google.com/billing/v1/how-tos/catalog-api.
+   * 
+ * + * repeated string services = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getServicesBytes(int index); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/GetBudgetRequest.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/GetBudgetRequest.java new file mode 100644 index 00000000..c3af4a3c --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/GetBudgetRequest.java @@ -0,0 +1,635 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * Request for GetBudget
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.GetBudgetRequest} + */ +public final class GetBudgetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.GetBudgetRequest) + GetBudgetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetBudgetRequest.newBuilder() to construct. + private GetBudgetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetBudgetRequest() { + name_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetBudgetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest.class, + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. Name of budget to get. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Name of budget to get. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest other = + (com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for GetBudget
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.GetBudgetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.GetBudgetRequest) + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest.class, + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_GetBudgetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest build() { + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest buildPartial() { + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest result = + new com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest(this); + result.name_ = name_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest other) { + if (other == com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of budget to get. Values are of the form
+     * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.GetBudgetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.GetBudgetRequest) + private static final com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest(); + } + + public static com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetBudgetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetBudgetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.GetBudgetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/GetBudgetRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/GetBudgetRequestOrBuilder.java new file mode 100644 index 00000000..8c29a309 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/GetBudgetRequestOrBuilder.java @@ -0,0 +1,52 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface GetBudgetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.GetBudgetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Name of budget to get. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. Name of budget to get. Values are of the form
+   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/LastPeriodAmount.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/LastPeriodAmount.java new file mode 100644 index 00000000..97d10ed0 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/LastPeriodAmount.java @@ -0,0 +1,457 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * Describes a plan to target last period's spend.
+ * There are no options yet. The amount is automatically 100% of last period's
+ * spend.
+ * Future configuration will go here (e.g. configuring the percentage).
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.LastPeriodAmount} + */ +public final class LastPeriodAmount extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.LastPeriodAmount) + LastPeriodAmountOrBuilder { + private static final long serialVersionUID = 0L; + // Use LastPeriodAmount.newBuilder() to construct. + private LastPeriodAmount(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private LastPeriodAmount() {} + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private LastPeriodAmount( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.class, + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount other = + (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Describes a plan to target last period's spend.
+   * There are no options yet. The amount is automatically 100% of last period's
+   * spend.
+   * Future configuration will go here (e.g. configuring the percentage).
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.LastPeriodAmount} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.LastPeriodAmount) + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmountOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.class, + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_LastPeriodAmount_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount build() { + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount buildPartial() { + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount result = + new com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount other) { + if (other == com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.LastPeriodAmount) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.LastPeriodAmount) + private static final com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount(); + } + + public static com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LastPeriodAmount parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new LastPeriodAmount(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.LastPeriodAmount getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/LastPeriodAmountOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/LastPeriodAmountOrBuilder.java new file mode 100644 index 00000000..d6eb0abb --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/LastPeriodAmountOrBuilder.java @@ -0,0 +1,24 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface LastPeriodAmountOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.LastPeriodAmount) + com.google.protobuf.MessageOrBuilder {} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsRequest.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsRequest.java new file mode 100644 index 00000000..45143f16 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsRequest.java @@ -0,0 +1,893 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * Request for ListBudgets
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.ListBudgetsRequest} + */ +public final class ListBudgetsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) + ListBudgetsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListBudgetsRequest.newBuilder() to construct. + private ListBudgetsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListBudgetsRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListBudgetsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 16: + { + pageSize_ = input.readInt32(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest.class, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. Name of billing account to list budgets under. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Name of billing account to list budgets under. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Optional. The maximum number of budgets to return per page.
+   * The default and maximum value are 100.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * Optional. The value returned by the last `ListBudgetsResponse` which
+   * indicates that this is a continuation of a prior `ListBudgets` call,
+   * and that the system should return the next page of data.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. The value returned by the last `ListBudgetsResponse` which
+   * indicates that this is a continuation of a prior `ListBudgets` call,
+   * and that the system should return the next page of data.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getParentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getParentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest other = + (com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for ListBudgets
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.ListBudgetsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest.class, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + parent_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest build() { + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest buildPartial() { + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest result = + new com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest(this); + result.parent_ = parent_; + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest other) { + if (other == com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Name of billing account to list budgets under. Values
+     * are of the form `billingAccounts/{billingAccountId}`.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. The maximum number of budgets to return per page.
+     * The default and maximum value are 100.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. The maximum number of budgets to return per page.
+     * The default and maximum value are 100.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The maximum number of budgets to return per page.
+     * The default and maximum value are 100.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The value returned by the last `ListBudgetsResponse` which
+     * indicates that this is a continuation of a prior `ListBudgets` call,
+     * and that the system should return the next page of data.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) + private static final com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest(); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListBudgetsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListBudgetsRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsRequestOrBuilder.java new file mode 100644 index 00000000..75499d23 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsRequestOrBuilder.java @@ -0,0 +1,89 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface ListBudgetsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.ListBudgetsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Name of billing account to list budgets under. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Name of billing account to list budgets under. Values
+   * are of the form `billingAccounts/{billingAccountId}`.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. The maximum number of budgets to return per page.
+   * The default and maximum value are 100.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. The value returned by the last `ListBudgetsResponse` which
+   * indicates that this is a continuation of a prior `ListBudgets` call,
+   * and that the system should return the next page of data.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. The value returned by the last `ListBudgetsResponse` which
+   * indicates that this is a continuation of a prior `ListBudgets` call,
+   * and that the system should return the next page of data.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsResponse.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsResponse.java new file mode 100644 index 00000000..5b785b19 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsResponse.java @@ -0,0 +1,1116 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * Response for ListBudgets
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.ListBudgetsResponse} + */ +public final class ListBudgetsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) + ListBudgetsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListBudgetsResponse.newBuilder() to construct. + private ListBudgetsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListBudgetsResponse() { + budgets_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListBudgetsResponse( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + budgets_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + budgets_.add( + input.readMessage( + com.google.cloud.billing.budgets.v1beta1.Budget.parser(), extensionRegistry)); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + nextPageToken_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + budgets_ = java.util.Collections.unmodifiableList(budgets_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse.class, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse.Builder.class); + } + + private int bitField0_; + public static final int BUDGETS_FIELD_NUMBER = 1; + private java.util.List budgets_; + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public java.util.List getBudgetsList() { + return budgets_; + } + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public java.util.List + getBudgetsOrBuilderList() { + return budgets_; + } + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public int getBudgetsCount() { + return budgets_.size(); + } + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1beta1.Budget getBudgets(int index) { + return budgets_.get(index); + } + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetsOrBuilder(int index) { + return budgets_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * If not empty, indicates that there may be more budgets that match the
+   * request; this value should be passed in a new `ListBudgetsRequest`.
+   * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * If not empty, indicates that there may be more budgets that match the
+   * request; this value should be passed in a new `ListBudgetsRequest`.
+   * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < budgets_.size(); i++) { + output.writeMessage(1, budgets_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < budgets_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, budgets_.get(i)); + } + if (!getNextPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse other = + (com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) obj; + + if (!getBudgetsList().equals(other.getBudgetsList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getBudgetsCount() > 0) { + hash = (37 * hash) + BUDGETS_FIELD_NUMBER; + hash = (53 * hash) + getBudgetsList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response for ListBudgets
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.ListBudgetsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse.class, + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getBudgetsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (budgetsBuilder_ == null) { + budgets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + budgetsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_ListBudgetsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse + getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse build() { + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse buildPartial() { + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse result = + new com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (budgetsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + budgets_ = java.util.Collections.unmodifiableList(budgets_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.budgets_ = budgets_; + } else { + result.budgets_ = budgetsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse other) { + if (other + == com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse.getDefaultInstance()) + return this; + if (budgetsBuilder_ == null) { + if (!other.budgets_.isEmpty()) { + if (budgets_.isEmpty()) { + budgets_ = other.budgets_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureBudgetsIsMutable(); + budgets_.addAll(other.budgets_); + } + onChanged(); + } + } else { + if (!other.budgets_.isEmpty()) { + if (budgetsBuilder_.isEmpty()) { + budgetsBuilder_.dispose(); + budgetsBuilder_ = null; + budgets_ = other.budgets_; + bitField0_ = (bitField0_ & ~0x00000001); + budgetsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getBudgetsFieldBuilder() + : null; + } else { + budgetsBuilder_.addAllMessages(other.budgets_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + onChanged(); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List budgets_ = + java.util.Collections.emptyList(); + + private void ensureBudgetsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + budgets_ = + new java.util.ArrayList(budgets_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder> + budgetsBuilder_; + + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public java.util.List getBudgetsList() { + if (budgetsBuilder_ == null) { + return java.util.Collections.unmodifiableList(budgets_); + } else { + return budgetsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public int getBudgetsCount() { + if (budgetsBuilder_ == null) { + return budgets_.size(); + } else { + return budgetsBuilder_.getCount(); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1beta1.Budget getBudgets(int index) { + if (budgetsBuilder_ == null) { + return budgets_.get(index); + } else { + return budgetsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder setBudgets(int index, com.google.cloud.billing.budgets.v1beta1.Budget value) { + if (budgetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBudgetsIsMutable(); + budgets_.set(index, value); + onChanged(); + } else { + budgetsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder setBudgets( + int index, com.google.cloud.billing.budgets.v1beta1.Budget.Builder builderForValue) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + budgets_.set(index, builderForValue.build()); + onChanged(); + } else { + budgetsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder addBudgets(com.google.cloud.billing.budgets.v1beta1.Budget value) { + if (budgetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBudgetsIsMutable(); + budgets_.add(value); + onChanged(); + } else { + budgetsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder addBudgets(int index, com.google.cloud.billing.budgets.v1beta1.Budget value) { + if (budgetsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBudgetsIsMutable(); + budgets_.add(index, value); + onChanged(); + } else { + budgetsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder addBudgets( + com.google.cloud.billing.budgets.v1beta1.Budget.Builder builderForValue) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + budgets_.add(builderForValue.build()); + onChanged(); + } else { + budgetsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder addBudgets( + int index, com.google.cloud.billing.budgets.v1beta1.Budget.Builder builderForValue) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + budgets_.add(index, builderForValue.build()); + onChanged(); + } else { + budgetsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder addAllBudgets( + java.lang.Iterable values) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, budgets_); + onChanged(); + } else { + budgetsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder clearBudgets() { + if (budgetsBuilder_ == null) { + budgets_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + budgetsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public Builder removeBudgets(int index) { + if (budgetsBuilder_ == null) { + ensureBudgetsIsMutable(); + budgets_.remove(index); + onChanged(); + } else { + budgetsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1beta1.Budget.Builder getBudgetsBuilder(int index) { + return getBudgetsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetsOrBuilder(int index) { + if (budgetsBuilder_ == null) { + return budgets_.get(index); + } else { + return budgetsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public java.util.List + getBudgetsOrBuilderList() { + if (budgetsBuilder_ != null) { + return budgetsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(budgets_); + } + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1beta1.Budget.Builder addBudgetsBuilder() { + return getBudgetsFieldBuilder() + .addBuilder(com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance()); + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public com.google.cloud.billing.budgets.v1beta1.Budget.Builder addBudgetsBuilder(int index) { + return getBudgetsFieldBuilder() + .addBuilder(index, com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance()); + } + /** + * + * + *
+     * List of the budgets owned by the requested billing account.
+     * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + public java.util.List + getBudgetsBuilderList() { + return getBudgetsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder> + getBudgetsFieldBuilder() { + if (budgetsBuilder_ == null) { + budgetsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder>( + budgets_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + budgets_ = null; + } + return budgetsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * If not empty, indicates that there may be more budgets that match the
+     * request; this value should be passed in a new `ListBudgetsRequest`.
+     * 
+ * + * string next_page_token = 2; + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) + private static final com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse(); + } + + public static com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListBudgetsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListBudgetsResponse(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ListBudgetsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsResponseOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsResponseOrBuilder.java new file mode 100644 index 00000000..f246300c --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ListBudgetsResponseOrBuilder.java @@ -0,0 +1,100 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface ListBudgetsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.ListBudgetsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + java.util.List getBudgetsList(); + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + com.google.cloud.billing.budgets.v1beta1.Budget getBudgets(int index); + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + int getBudgetsCount(); + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + java.util.List + getBudgetsOrBuilderList(); + /** + * + * + *
+   * List of the budgets owned by the requested billing account.
+   * 
+ * + * repeated .google.cloud.billing.budgets.v1beta1.Budget budgets = 1; + */ + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetsOrBuilder(int index); + + /** + * + * + *
+   * If not empty, indicates that there may be more budgets that match the
+   * request; this value should be passed in a new `ListBudgetsRequest`.
+   * 
+ * + * string next_page_token = 2; + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * If not empty, indicates that there may be more budgets that match the
+   * request; this value should be passed in a new `ListBudgetsRequest`.
+   * 
+ * + * string next_page_token = 2; + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ThresholdRule.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ThresholdRule.java new file mode 100644 index 00000000..13865b30 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ThresholdRule.java @@ -0,0 +1,862 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * ThresholdRule contains a definition of a threshold which triggers
+ * an alert (a notification of a threshold being crossed) to be sent when
+ * spend goes above the specified amount.
+ * Alerts are automatically e-mailed to the billing users who have
+ * access to the billing account. The thresholds here have no effect on
+ * notifications sent to anything configured under `Budget.all_updates_rule`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.ThresholdRule} + */ +public final class ThresholdRule extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.ThresholdRule) + ThresholdRuleOrBuilder { + private static final long serialVersionUID = 0L; + // Use ThresholdRule.newBuilder() to construct. + private ThresholdRule(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ThresholdRule() { + spendBasis_ = 0; + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ThresholdRule( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 9: + { + thresholdPercent_ = input.readDouble(); + break; + } + case 16: + { + int rawValue = input.readEnum(); + + spendBasis_ = rawValue; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.class, + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder.class); + } + + /** + * + * + *
+   * The type of basis used to determine if spend has passed the threshold.
+   * 
+ * + * Protobuf enum {@code google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis} + */ + public enum Basis implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+     * Unspecified threshold basis.
+     * 
+ * + * BASIS_UNSPECIFIED = 0; + */ + BASIS_UNSPECIFIED(0), + /** + * + * + *
+     * Use current spend as the basis for comparison against the threshold.
+     * 
+ * + * CURRENT_SPEND = 1; + */ + CURRENT_SPEND(1), + /** + * + * + *
+     * Use forecasted spend for the period as the basis for comparison against
+     * the threshold.
+     * 
+ * + * FORECASTED_SPEND = 2; + */ + FORECASTED_SPEND(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+     * Unspecified threshold basis.
+     * 
+ * + * BASIS_UNSPECIFIED = 0; + */ + public static final int BASIS_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+     * Use current spend as the basis for comparison against the threshold.
+     * 
+ * + * CURRENT_SPEND = 1; + */ + public static final int CURRENT_SPEND_VALUE = 1; + /** + * + * + *
+     * Use forecasted spend for the period as the basis for comparison against
+     * the threshold.
+     * 
+ * + * FORECASTED_SPEND = 2; + */ + public static final int FORECASTED_SPEND_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** @deprecated Use {@link #forNumber(int)} instead. */ + @java.lang.Deprecated + public static Basis valueOf(int value) { + return forNumber(value); + } + + public static Basis forNumber(int value) { + switch (value) { + case 0: + return BASIS_UNSPECIFIED; + case 1: + return CURRENT_SPEND; + case 2: + return FORECASTED_SPEND; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public Basis findValueByNumber(int number) { + return Basis.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.ThresholdRule.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final Basis[] VALUES = values(); + + public static Basis valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private Basis(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis) + } + + public static final int THRESHOLD_PERCENT_FIELD_NUMBER = 1; + private double thresholdPercent_; + /** + * + * + *
+   * Required. Send an alert when this threshold is exceeded.
+   * This is a 1.0-based percentage, so 0.5 = 50%.
+   * Validation: non-negative number.
+   * 
+ * + * double threshold_percent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public double getThresholdPercent() { + return thresholdPercent_; + } + + public static final int SPEND_BASIS_FIELD_NUMBER = 2; + private int spendBasis_; + /** + * + * + *
+   * Optional. The type of basis used to determine if spend has passed the
+   * threshold. Behavior defaults to CURRENT_SPEND if not set.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getSpendBasisValue() { + return spendBasis_; + } + /** + * + * + *
+   * Optional. The type of basis used to determine if spend has passed the
+   * threshold. Behavior defaults to CURRENT_SPEND if not set.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis getSpendBasis() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis result = + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis.valueOf(spendBasis_); + return result == null + ? com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis.UNRECOGNIZED + : result; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (thresholdPercent_ != 0D) { + output.writeDouble(1, thresholdPercent_); + } + if (spendBasis_ + != com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis.BASIS_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, spendBasis_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (thresholdPercent_ != 0D) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(1, thresholdPercent_); + } + if (spendBasis_ + != com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis.BASIS_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, spendBasis_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.ThresholdRule)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.ThresholdRule other = + (com.google.cloud.billing.budgets.v1beta1.ThresholdRule) obj; + + if (java.lang.Double.doubleToLongBits(getThresholdPercent()) + != java.lang.Double.doubleToLongBits(other.getThresholdPercent())) return false; + if (spendBasis_ != other.spendBasis_) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + THRESHOLD_PERCENT_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getThresholdPercent())); + hash = (37 * hash) + SPEND_BASIS_FIELD_NUMBER; + hash = (53 * hash) + spendBasis_; + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.ThresholdRule prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * ThresholdRule contains a definition of a threshold which triggers
+   * an alert (a notification of a threshold being crossed) to be sent when
+   * spend goes above the specified amount.
+   * Alerts are automatically e-mailed to the billing users who have
+   * access to the billing account. The thresholds here have no effect on
+   * notifications sent to anything configured under `Budget.all_updates_rule`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.ThresholdRule} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.ThresholdRule) + com.google.cloud.billing.budgets.v1beta1.ThresholdRuleOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.class, + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.ThresholdRule.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + thresholdPercent_ = 0D; + + spendBasis_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetModel + .internal_static_google_cloud_billing_budgets_v1beta1_ThresholdRule_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.ThresholdRule.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule build() { + com.google.cloud.billing.budgets.v1beta1.ThresholdRule result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule buildPartial() { + com.google.cloud.billing.budgets.v1beta1.ThresholdRule result = + new com.google.cloud.billing.budgets.v1beta1.ThresholdRule(this); + result.thresholdPercent_ = thresholdPercent_; + result.spendBasis_ = spendBasis_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.ThresholdRule) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.ThresholdRule) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.ThresholdRule other) { + if (other == com.google.cloud.billing.budgets.v1beta1.ThresholdRule.getDefaultInstance()) + return this; + if (other.getThresholdPercent() != 0D) { + setThresholdPercent(other.getThresholdPercent()); + } + if (other.spendBasis_ != 0) { + setSpendBasisValue(other.getSpendBasisValue()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.ThresholdRule parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.ThresholdRule) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private double thresholdPercent_; + /** + * + * + *
+     * Required. Send an alert when this threshold is exceeded.
+     * This is a 1.0-based percentage, so 0.5 = 50%.
+     * Validation: non-negative number.
+     * 
+ * + * double threshold_percent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public double getThresholdPercent() { + return thresholdPercent_; + } + /** + * + * + *
+     * Required. Send an alert when this threshold is exceeded.
+     * This is a 1.0-based percentage, so 0.5 = 50%.
+     * Validation: non-negative number.
+     * 
+ * + * double threshold_percent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder setThresholdPercent(double value) { + + thresholdPercent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Send an alert when this threshold is exceeded.
+     * This is a 1.0-based percentage, so 0.5 = 50%.
+     * Validation: non-negative number.
+     * 
+ * + * double threshold_percent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + public Builder clearThresholdPercent() { + + thresholdPercent_ = 0D; + onChanged(); + return this; + } + + private int spendBasis_ = 0; + /** + * + * + *
+     * Optional. The type of basis used to determine if spend has passed the
+     * threshold. Behavior defaults to CURRENT_SPEND if not set.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getSpendBasisValue() { + return spendBasis_; + } + /** + * + * + *
+     * Optional. The type of basis used to determine if spend has passed the
+     * threshold. Behavior defaults to CURRENT_SPEND if not set.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSpendBasisValue(int value) { + spendBasis_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The type of basis used to determine if spend has passed the
+     * threshold. Behavior defaults to CURRENT_SPEND if not set.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis getSpendBasis() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis result = + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis.valueOf(spendBasis_); + return result == null + ? com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Optional. The type of basis used to determine if spend has passed the
+     * threshold. Behavior defaults to CURRENT_SPEND if not set.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setSpendBasis( + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis value) { + if (value == null) { + throw new NullPointerException(); + } + + spendBasis_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. The type of basis used to determine if spend has passed the
+     * threshold. Behavior defaults to CURRENT_SPEND if not set.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearSpendBasis() { + + spendBasis_ = 0; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.ThresholdRule) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.ThresholdRule) + private static final com.google.cloud.billing.budgets.v1beta1.ThresholdRule DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.ThresholdRule(); + } + + public static com.google.cloud.billing.budgets.v1beta1.ThresholdRule getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ThresholdRule parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ThresholdRule(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.ThresholdRule getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ThresholdRuleOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ThresholdRuleOrBuilder.java new file mode 100644 index 00000000..c18654e7 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/ThresholdRuleOrBuilder.java @@ -0,0 +1,65 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_model.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface ThresholdRuleOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.ThresholdRule) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Send an alert when this threshold is exceeded.
+   * This is a 1.0-based percentage, so 0.5 = 50%.
+   * Validation: non-negative number.
+   * 
+ * + * double threshold_percent = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + double getThresholdPercent(); + + /** + * + * + *
+   * Optional. The type of basis used to determine if spend has passed the
+   * threshold. Behavior defaults to CURRENT_SPEND if not set.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getSpendBasisValue(); + /** + * + * + *
+   * Optional. The type of basis used to determine if spend has passed the
+   * threshold. Behavior defaults to CURRENT_SPEND if not set.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis spend_basis = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.billing.budgets.v1beta1.ThresholdRule.Basis getSpendBasis(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/UpdateBudgetRequest.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/UpdateBudgetRequest.java new file mode 100644 index 00000000..be23f2bb --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/UpdateBudgetRequest.java @@ -0,0 +1,1091 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +/** + * + * + *
+ * Request for UpdateBudget
+ * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest} + */ +public final class UpdateBudgetRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) + UpdateBudgetRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateBudgetRequest.newBuilder() to construct. + private UpdateBudgetRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateBudgetRequest() {} + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateBudgetRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.billing.budgets.v1beta1.Budget.Builder subBuilder = null; + if (budget_ != null) { + subBuilder = budget_.toBuilder(); + } + budget_ = + input.readMessage( + com.google.cloud.billing.budgets.v1beta1.Budget.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(budget_); + budget_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest.class, + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest.Builder.class); + } + + public static final int BUDGET_FIELD_NUMBER = 1; + private com.google.cloud.billing.budgets.v1beta1.Budget budget_; + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasBudget() { + return budget_ != null; + } + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Budget getBudget() { + return budget_ == null + ? com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance() + : budget_; + } + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetOrBuilder() { + return getBudget(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return getUpdateMask(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (budget_ != null) { + output.writeMessage(1, getBudget()); + } + if (updateMask_ != null) { + output.writeMessage(2, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (budget_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getBudget()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest other = + (com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) obj; + + if (hasBudget() != other.hasBudget()) return false; + if (hasBudget()) { + if (!getBudget().equals(other.getBudget())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasBudget()) { + hash = (37 * hash) + BUDGET_FIELD_NUMBER; + hash = (53 * hash) + getBudget().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request for UpdateBudget
+   * 
+ * + * Protobuf type {@code google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest.class, + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (budgetBuilder_ == null) { + budget_ = null; + } else { + budget_ = null; + budgetBuilder_ = null; + } + if (updateMaskBuilder_ == null) { + updateMask_ = null; + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.budgets.v1beta1.BudgetServiceOuterClass + .internal_static_google_cloud_billing_budgets_v1beta1_UpdateBudgetRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest + getDefaultInstanceForType() { + return com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest build() { + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest buildPartial() { + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest result = + new com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest(this); + if (budgetBuilder_ == null) { + result.budget_ = budget_; + } else { + result.budget_ = budgetBuilder_.build(); + } + if (updateMaskBuilder_ == null) { + result.updateMask_ = updateMask_; + } else { + result.updateMask_ = updateMaskBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) { + return mergeFrom((com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest other) { + if (other + == com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest.getDefaultInstance()) + return this; + if (other.hasBudget()) { + mergeBudget(other.getBudget()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.billing.budgets.v1beta1.Budget budget_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder> + budgetBuilder_; + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public boolean hasBudget() { + return budgetBuilder_ != null || budget_ != null; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Budget getBudget() { + if (budgetBuilder_ == null) { + return budget_ == null + ? com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance() + : budget_; + } else { + return budgetBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBudget(com.google.cloud.billing.budgets.v1beta1.Budget value) { + if (budgetBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + budget_ = value; + onChanged(); + } else { + budgetBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBudget( + com.google.cloud.billing.budgets.v1beta1.Budget.Builder builderForValue) { + if (budgetBuilder_ == null) { + budget_ = builderForValue.build(); + onChanged(); + } else { + budgetBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeBudget(com.google.cloud.billing.budgets.v1beta1.Budget value) { + if (budgetBuilder_ == null) { + if (budget_ != null) { + budget_ = + com.google.cloud.billing.budgets.v1beta1.Budget.newBuilder(budget_) + .mergeFrom(value) + .buildPartial(); + } else { + budget_ = value; + } + onChanged(); + } else { + budgetBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearBudget() { + if (budgetBuilder_ == null) { + budget_ = null; + onChanged(); + } else { + budget_ = null; + budgetBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.Budget.Builder getBudgetBuilder() { + + onChanged(); + return getBudgetFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetOrBuilder() { + if (budgetBuilder_ != null) { + return budgetBuilder_.getMessageOrBuilder(); + } else { + return budget_ == null + ? com.google.cloud.billing.budgets.v1beta1.Budget.getDefaultInstance() + : budget_; + } + } + /** + * + * + *
+     * Required. The updated budget object.
+     * The budget to update is specified by the budget name in the budget.
+     * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder> + getBudgetFieldBuilder() { + if (budgetBuilder_ == null) { + budgetBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.budgets.v1beta1.Budget, + com.google.cloud.billing.budgets.v1beta1.Budget.Builder, + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder>( + getBudget(), getParentForChildren(), isClean()); + budget_ = null; + } + return budgetBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * Optional. Indicates which fields in the provided budget to update.
+     * Read-only fields (such as `name`) cannot be changed. If this is not
+     * provided, then only fields with non-default values from the request are
+     * updated. See
+     * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+     * details about default values.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) + private static final com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest(); + } + + public static com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateBudgetRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateBudgetRequest(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/UpdateBudgetRequestOrBuilder.java b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/UpdateBudgetRequestOrBuilder.java new file mode 100644 index 00000000..6ea801bd --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/java/com/google/cloud/billing/budgets/v1beta1/UpdateBudgetRequestOrBuilder.java @@ -0,0 +1,114 @@ +/* + * 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/cloud/billing/budgets/v1beta1/budget_service.proto + +package com.google.cloud.billing.budgets.v1beta1; + +public interface UpdateBudgetRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.budgets.v1beta1.UpdateBudgetRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + boolean hasBudget(); + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1beta1.Budget getBudget(); + /** + * + * + *
+   * Required. The updated budget object.
+   * The budget to update is specified by the budget name in the budget.
+   * 
+ * + * + * .google.cloud.billing.budgets.v1beta1.Budget budget = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.budgets.v1beta1.BudgetOrBuilder getBudgetOrBuilder(); + + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * Optional. Indicates which fields in the provided budget to update.
+   * Read-only fields (such as `name`) cannot be changed. If this is not
+   * provided, then only fields with non-default values from the request are
+   * updated. See
+   * https://developers.google.com/protocol-buffers/docs/proto3#default for more
+   * details about default values.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/proto/google/cloud/billing/budgets/v1beta1/budget_model.proto b/proto-google-cloud-billingbudgets-v1beta1/src/main/proto/google/cloud/billing/budgets/v1beta1/budget_model.proto new file mode 100644 index 00000000..0a885331 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/proto/google/cloud/billing/budgets/v1beta1/budget_model.proto @@ -0,0 +1,177 @@ +// 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. +// + +syntax = "proto3"; + +package google.cloud.billing.budgets.v1beta1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/type/money.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1beta1;budgets"; +option java_multiple_files = true; +option java_package = "com.google.cloud.billing.budgets.v1beta1"; + +// A budget is a plan that describes what the user expects to spend on Cloud +// projects, plus rules to execute as spend is tracked against that plan, +// e.g. alert at 90% of $100 target. +// Currently all plans are monthly budgets so the usage period(s) tracked are +// implied (calendar months of usage back-to-back). +message Budget { + option (google.api.resource) = { + type: "billingbudgets.googleapis.com/Budget" + pattern: "billingAccounts/{billing_account}/budgets/{budget}" + }; + + // Output only. Resource name of the budget. + // The resource name implies the scope of a budget. Values are of the form + // `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // User data for display name in UI. + // Validation: <= 60 chars. + string display_name = 2; + + // Optional. Filters that define which resources are used to compute + // the actual spend against the budget. + Filter budget_filter = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Budgeted amount. + BudgetAmount amount = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Rules that trigger alerts (notifications of thresholds + // being crossed) when spend exceeds the specified percentages of the budget. + repeated ThresholdRule threshold_rules = 5 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Rules to apply to all updates to the actual spend, regardless + // of the thresholds set in `threshold_rules`. + AllUpdatesRule all_updates_rule = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Etag to validate that the object is unchanged for a + // read-modify-write operation. + // An empty etag will cause an update to overwrite other changes. + string etag = 7 [(google.api.field_behavior) = OPTIONAL]; +} + +// The budgeted amount for each usage period. +message BudgetAmount { + // Specification for what amount to use as the budget. + oneof budget_amount { + // A specified amount to use as the budget. + // `currency_code` is optional. If specified, it must match the + // currency of the billing account. The `currency_code` is provided on + // output. + google.type.Money specified_amount = 1; + + // Use the last period's actual spend as the budget for the present period. + LastPeriodAmount last_period_amount = 2; + } +} + +// Describes a plan to target last period's spend. +// There are no options yet. The amount is automatically 100% of last period's +// spend. +// Future configuration will go here (e.g. configuring the percentage). +message LastPeriodAmount { + +} + +// ThresholdRule contains a definition of a threshold which triggers +// an alert (a notification of a threshold being crossed) to be sent when +// spend goes above the specified amount. +// Alerts are automatically e-mailed to the billing users who have +// access to the billing account. The thresholds here have no effect on +// notifications sent to anything configured under `Budget.all_updates_rule`. +message ThresholdRule { + // The type of basis used to determine if spend has passed the threshold. + enum Basis { + // Unspecified threshold basis. + BASIS_UNSPECIFIED = 0; + + // Use current spend as the basis for comparison against the threshold. + CURRENT_SPEND = 1; + + // Use forecasted spend for the period as the basis for comparison against + // the threshold. + FORECASTED_SPEND = 2; + } + + // Required. Send an alert when this threshold is exceeded. + // This is a 1.0-based percentage, so 0.5 = 50%. + // Validation: non-negative number. + double threshold_percent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. The type of basis used to determine if spend has passed the + // threshold. Behavior defaults to CURRENT_SPEND if not set. + Basis spend_basis = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// AllUpdatesRule defines notifications that are sent on every update to the +// billing account's spend, regardless of the thresholds defined using +// threshold rules. +message AllUpdatesRule { + // Required. The name of the Cloud Pub/Sub topic where budget related messages will be + // published, in the form `projects/{project_id}/topics/{topic_id}`. + // Updates are sent at regular intervals to the topic. + // When a topic is set for a budget, the `pubsub.topics.publish` IAM + // permission must be granted on the topic (or the parent project of the + // topic) to `billing-budget-alert@system.gserviceaccount.com`. + // If this permission is not present when a topic is provided at the time of + // budget creation or updating, the API call will fail with PERMISSION_DENIED. + // See https://cloud.google.com/pubsub/docs/access-control for more details on + // Pub/Sub roles and permissions. + string pubsub_topic = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The schema version of the notification. + // Only "1.0" is accepted. It represents the JSON schema as defined in + // https://cloud.google.com/billing/docs/how-to/budgets#notification_format + string schema_version = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// A filter for a budget, limiting the scope of the cost to calculate. +message Filter { + // Specifies how credits should be treated when determining spend for + // threshold calculations. + enum CreditTypesTreatment { + CREDIT_TYPES_TREATMENT_UNSPECIFIED = 0; + + // All types of credit are subtracted from the gross cost to determine the + // spend for threshold calculations. + INCLUDE_ALL_CREDITS = 1; + + // All types of credit are added to the net cost to determine the spend for + // threshold calculations. + EXCLUDE_ALL_CREDITS = 2; + } + + // Optional. A set of projects of the form `projects/{project_id}`, + // specifying that usage from only this set of projects should be + // included in the budget. If omitted, the report will include all usage for + // the billing account, regardless of which project the usage occurred on. + // Only zero or one project can be specified currently. + repeated string projects = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If not set, default behavior is `INCLUDE_ALL_CREDITS`. + CreditTypesTreatment credit_types_treatment = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. A set of services of the form `services/{service_id}`, + // specifying that usage from only this set of services should be + // included in the budget. If omitted, the report will include usage for + // all the services. + // The service names are available through the Catalog API: + // https://cloud.google.com/billing/v1/how-tos/catalog-api. + repeated string services = 3 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/proto-google-cloud-billingbudgets-v1beta1/src/main/proto/google/cloud/billing/budgets/v1beta1/budget_service.proto b/proto-google-cloud-billingbudgets-v1beta1/src/main/proto/google/cloud/billing/budgets/v1beta1/budget_service.proto new file mode 100644 index 00000000..6c7f3559 --- /dev/null +++ b/proto-google-cloud-billingbudgets-v1beta1/src/main/proto/google/cloud/billing/budgets/v1beta1/budget_service.proto @@ -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 +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.billing.budgets.v1beta1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/billing/budgets/v1beta1/budget_model.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1beta1;budgets"; +option java_multiple_files = true; +option java_package = "com.google.cloud.billing.budgets.v1beta1"; + +// BudgetService stores Cloud Billing budgets, which define a +// budget plan and rules to execute as we track spend against that plan. +service BudgetService { + option (google.api.default_host) = "billingbudgets.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a new budget if none exists. There is a limit of 1,000 budgets + // per billing account. + rpc CreateBudget(CreateBudgetRequest) returns (Budget) { + option (google.api.http) = { + post: "/v1beta1/{parent=billingAccounts/*}/budgets" + body: "*" + }; + } + + // Updates a budget and returns the updated budget. + rpc UpdateBudget(UpdateBudgetRequest) returns (Budget) { + option (google.api.http) = { + patch: "/v1beta1/{budget.name=billingAccounts/*/budgets/*}" + body: "*" + }; + } + + // Returns a budget. + rpc GetBudget(GetBudgetRequest) returns (Budget) { + option (google.api.http) = { + get: "/v1beta1/{name=billingAccounts/*/budgets/*}" + }; + } + + // Returns the budgets for a billing account. + rpc ListBudgets(ListBudgetsRequest) returns (ListBudgetsResponse) { + option (google.api.http) = { + get: "/v1beta1/{parent=billingAccounts/*}/budgets" + }; + } + + // Deletes a budget. Returns successfully if already deleted. + rpc DeleteBudget(DeleteBudgetRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1beta1/{name=billingAccounts/*/budgets/*}" + }; + } +} + +// Request for CreateBudget +message CreateBudgetRequest { + // Required. the name of the billing account to create the budget in. Values + // are of the form `billingAccounts/{billingAccountId}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "billingbudgets.googleapis.com/Budget" + } + ]; + + // Required. Budget to create. + Budget budget = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for UpdateBudget +message UpdateBudgetRequest { + // Required. The updated budget object. + // The budget to update is specified by the budget name in the budget. + Budget budget = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Indicates which fields in the provided budget to update. + // Read-only fields (such as `name`) cannot be changed. If this is not + // provided, then only fields with non-default values from the request are + // updated. See + // https://developers.google.com/protocol-buffers/docs/proto3#default for more + // details about default values. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for GetBudget +message GetBudgetRequest { + // Required. Name of budget to get. Values are of the form + // `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "billingbudgets.googleapis.com/Budget" + } + ]; +} + +// Request for ListBudgets +message ListBudgetsRequest { + // Required. Name of billing account to list budgets under. Values + // are of the form `billingAccounts/{billingAccountId}`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "billingbudgets.googleapis.com/Budget" + } + ]; + + // Optional. The maximum number of budgets to return per page. + // The default and maximum value are 100. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The value returned by the last `ListBudgetsResponse` which + // indicates that this is a continuation of a prior `ListBudgets` call, + // and that the system should return the next page of data. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response for ListBudgets +message ListBudgetsResponse { + // List of the budgets owned by the requested billing account. + repeated Budget budgets = 1; + + // If not empty, indicates that there may be more budgets that match the + // request; this value should be passed in a new `ListBudgetsRequest`. + string next_page_token = 2; +} + +// Request for DeleteBudget +message DeleteBudgetRequest { + // Required. Name of the budget to delete. Values are of the form + // `billingAccounts/{billingAccountId}/budgets/{budgetId}`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "billingbudgets.googleapis.com/Budget" + } + ]; +} 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/synth.metadata b/synth.metadata new file mode 100644 index 00000000..da60a1f8 --- /dev/null +++ b/synth.metadata @@ -0,0 +1,39 @@ +{ + "updateTime": "2019-10-30T22:42:47.890284Z", + "sources": [ + { + "generator": { + "name": "artman", + "version": "0.41.0", + "dockerImage": "googleapis/artman@sha256:75b38a3b073a7b243545f2332463096624c802bb1e56b8cb6f22ba1ecd325fa9" + } + }, + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "4e952e7e2bb0dd2ef389d552d48f44c8dc4b5f8f", + "internalRef": "277595731" + } + }, + { + "template": { + "name": "java_library", + "origin": "synthtool.gcp", + "version": "2019.10.17" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "billingbudgets", + "apiVersion": "v1beta1", + "language": "java", + "generator": "gapic", + "config": "google/cloud/billing/budgets/artman_billingbudgets_v1beta1.yaml" + } + } + ] +} \ No newline at end of file diff --git a/synth.py b/synth.py new file mode 100644 index 00000000..98710698 --- /dev/null +++ b/synth.py @@ -0,0 +1,40 @@ +# Copyright 2018 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +import synthtool.gcp as gcp +import synthtool.languages.java as java + +gapic = gcp.GAPICGenerator() + +service = 'billingbudgets' +versions = ['v1beta1'] +config_pattern = '/google/cloud/billing/budgets/artman_{service}_{version}.yaml' + +for version in versions: + java.gapic_library( + service=service, + version=version, + config_pattern=config_pattern, + package_pattern='com.google.cloud.billing.budgets.{version}', + gapic=gapic, + ) + +common_templates = gcp.CommonTemplates() +templates = common_templates.java_library() +s.copy(templates, excludes=[ + # 'README.md', +]) \ No newline at end of file