diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..873d4f24 --- /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-billing/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. billing 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..dce2c845 --- /dev/null +++ b/.github/release-please.yml @@ -0,0 +1,2 @@ +releaseType: java-yoshi +bumpMinorPreMajor: true \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..fadd6afc --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +# Maven +target/ + +# Eclipse +.classpath +.project +.settings + +# Intellij +*.iml +.idea/ + +# python utilities +*.pyc +__pycache__ diff --git a/.kokoro/build.bat b/.kokoro/build.bat new file mode 100644 index 00000000..7f39eafb --- /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-billing/.kokoro/build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 00000000..f1ae5840 --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,79 @@ +#!/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 \ + -Denforcer.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 -Denforcer.skip=true + bash ${KOKORO_GFILE_DIR}/codecov.sh + bash .kokoro/coerce_logs.sh + ;; +lint) + mvn \ + -Penable-samples \ + com.coveo:fmt-maven-plugin:check + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + bash .kokoro/coerce_logs.sh + ;; +samples) + mvn -B \ + -Penable-samples \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + bash .kokoro/coerce_logs.sh + ;; +clirr) + mvn -B -Denforcer.skip=true clirr:check + ;; +*) + ;; +esac 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..b9cd8069 --- /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-billing/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billing/.kokoro/build.sh" +} diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 00000000..fe1d90d6 --- /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-billing/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billing/.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..818fe475 --- /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-billing/.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..4c187ae6 --- /dev/null +++ b/.kokoro/continuous/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billing/.kokoro/build.sh" diff --git a/.kokoro/continuous/java8-win.cfg b/.kokoro/continuous/java8-win.cfg new file mode 100644 index 00000000..07e827f2 --- /dev/null +++ b/.kokoro/continuous/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billing/.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..99d66a4e --- /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-billing/.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-billing/.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..bc6e5a1d --- /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-billing \ + --package-name="billing" \ + --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/continuous/samples.cfg b/.kokoro/continuous/samples.cfg new file mode 100644 index 00000000..fa7b493d --- /dev/null +++ b/.kokoro/continuous/samples.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: "samples" +} + +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/dependencies.sh b/.kokoro/dependencies.sh new file mode 100755 index 00000000..e30240cb --- /dev/null +++ b/.kokoro/dependencies.sh @@ -0,0 +1,31 @@ +#!/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-billing/ + +# Print out Java +java -version +echo $JOB_TYPE + +export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=128m" + +# this should run maven enforcer +mvn install -B -V \ + -DskipTests=true \ + -Dclirr.skip=true + +mvn -B dependency:analyze -DfailOnWarning=true diff --git a/.kokoro/linkage-monitor.sh b/.kokoro/linkage-monitor.sh new file mode 100755 index 00000000..1b1fc00f --- /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-billing/ + +# 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..fe1d90d6 --- /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-billing/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billing/.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..818fe475 --- /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-billing/.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..4c187ae6 --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billing/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 00000000..07e827f2 --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billing/.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/nightly/samples.cfg b/.kokoro/nightly/samples.cfg new file mode 100644 index 00000000..9a910249 --- /dev/null +++ b/.kokoro/nightly/samples.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: "samples" +} + +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/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..e25fb973 --- /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-billing/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-billing/.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..818fe475 --- /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-billing/.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..4c187ae6 --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billing/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 00000000..07e827f2 --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-billing/.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..e5b33276 --- /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-billing/.kokoro/linkage-monitor.sh" +} \ No newline at end of file diff --git a/.kokoro/presubmit/lint.cfg b/.kokoro/presubmit/lint.cfg new file mode 100644 index 00000000..6d323c8a --- /dev/null +++ b/.kokoro/presubmit/lint.cfg @@ -0,0 +1,13 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. + +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "JOB_TYPE" + value: "lint" +} \ No newline at end of file diff --git a/.kokoro/presubmit/samples.cfg b/.kokoro/presubmit/samples.cfg new file mode 100644 index 00000000..fa7b493d --- /dev/null +++ b/.kokoro/presubmit/samples.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: "samples" +} + +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/release/bump_snapshot.cfg b/.kokoro/release/bump_snapshot.cfg new file mode 100644 index 00000000..5a743cab --- /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-billing/.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-billing/.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..fe8ef867 --- /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-billing \ + --package-name="billing" \ + --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..64927c62 --- /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-billing/.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..0ed6ca52 --- /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-billing/.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..5ba88f1a --- /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-billing/.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..3b3076ef --- /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-billing/.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..21b7454b --- /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=google-cloud-billing +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..d7c84b35 --- /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-billing/.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..fe538607 --- /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-billing/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-billing/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-billing" + } +} + +# 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..7e8c3656 --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,14 @@ +{ + "name": "billing", + "name_pretty": "Cloud Billing", + "product_documentation": "https://cloud.google.com/billing/docs", + "client_documentation": "https://googleapis.dev/java/google-cloud-billing/latest/", + "api_description": "allows developers to manage their billing accounts or browse the catalog of SKUs and pricing.", + "issue_tracker": "https://issuetracker.google.com/savedsearches/559770", + "release_level": "beta", + "language": "java", + "repo": "googleapis/java-billing", + "repo_short": "java-billing", + "distribution_name": "com.google.cloud:google-cloud-billing", + "api_id": "cloudbilling.googleapis.com" +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..6b2238bb --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,93 @@ +# Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of +experience, education, socio-economic status, nationality, personal appearance, +race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, or to ban temporarily or permanently any +contributor for other behaviors that they deem inappropriate, threatening, +offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +This Code of Conduct also applies outside the project spaces when the Project +Steward has a reasonable belief that an individual's behavior may have a +negative impact on the project or its community. + +## Conflict Resolution + +We do not believe that all conflict is bad; healthy debate and disagreement +often yield positive results. However, it is never okay to be disrespectful or +to engage in behavior that violates the project’s code of conduct. + +If you see someone violating the code of conduct, you are encouraged to address +the behavior directly with those involved. Many issues can be resolved quickly +and easily, and this gives people more control over the outcome of their +dispute. If you are unable to resolve the matter for any reason, or if the +behavior is threatening or harassing, report it. We are dedicated to providing +an environment where participants feel welcome and safe. + +Reports should be directed to *[PROJECT STEWARD NAME(s) AND EMAIL(s)]*, the +Project Steward(s) for *[PROJECT NAME]*. It is the Project Steward’s duty to +receive and address reported violations of the code of conduct. They will then +work with a committee consisting of representatives from the Open Source +Programs Office and the Google Open Source Strategy team. If for any reason you +are uncomfortable reaching out the Project Steward, please email +opensource@google.com. + +We will investigate every complaint, but you may not receive a direct response. +We will use our discretion in determining when and how to follow up on reported +incidents, which may range from not taking action to permanent expulsion from +the project and project-sponsored spaces. We will notify the accused of the +report and provide them an opportunity to discuss it before any action is taken. +The identity of the reporter will be omitted from the details of the report +supplied to the accused. In potentially harmful situations, such as ongoing +harassment or threats to anyone's safety, we may take action without notice. + +## Attribution + +This Code of Conduct is adapted from the Contributor Covenant, version 1.4, +available at +https://www.contributor-covenant.org/version/1/4/code-of-conduct.html \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..085021dd --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,130 @@ +# How to Contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution; +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult +[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more +information on using pull requests. + +## Community Guidelines + +This project follows +[Google's Open Source Community Guidelines](https://opensource.google.com/conduct/). + +## Building the project + +To build, package, and run all unit tests run the command + +``` +mvn clean verify +``` + +### Running Integration tests + +To include integration tests when building the project, you need access to +a GCP Project with a valid service account. + +For instructions on how to generate a service account and corresponding +credentials JSON see: [Creating a Service Account][1]. + +Then run the following to build, package, run all unit tests and run all +integration tests. + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-integration-tests clean verify +``` + +## Code Samples + +Code Samples must be bundled in separate Maven modules, and guarded by a +Maven profile with the name `enable-samples`. + +The samples must be separate from the primary project for a few reasons: +1. Primary projects have a minimum Java version of Java 7 whereas samples have + a minimum Java version of Java 8. Due to this we need the ability to + selectively exclude samples from a build run. +2. Many code samples depend on external GCP services and need + credentials to access the service. +3. Code samples are not released as Maven artifacts and must be excluded from + release builds. + +### Building + +```bash +mvn -Penable-samples clean verify +``` + +Some samples require access to GCP services and require a service account: + +```bash +export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account.json +mvn -Penable-samples clean verify +``` + +### Profile Config + +1. To add samples in a profile to your Maven project, add the following to your +`pom.xml` + + ```xml + + [...] + + + enable-samples + + sample + + + + [...] + + ``` + +2. [Activate](#profile-activation) the profile. +3. Define your samples in a normal Maven project in the `samples/` directory + +### Profile Activation + +To include code samples when building and testing the project, enable the +`enable-samples` Maven profile. + +#### Command line + +To activate the Maven profile on the command line add `-Penable-samples` to your +Maven command. + +#### Maven `settings.xml` + +To activate the Maven profile in your `~/.m2/settings.xml` add an entry of +`enable-samples` following the instructions in [Active Profiles][2]. + +This method has the benefit of applying to all projects you build (and is +respected by IntelliJ IDEA) and is recommended if you are going to be +contributing samples to several projects. + +#### IntelliJ IDEA + +To activate the Maven Profile inside IntelliJ IDEA, follow the instructions in +[Activate Maven profiles][3] to activate `enable-samples`. + +[1]: https://cloud.google.com/docs/authentication/getting-started#creating_a_service_account +[2]: https://maven.apache.org/settings.html#Active_Profiles +[3]: https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..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..73d9805b --- /dev/null +++ b/README.md @@ -0,0 +1,157 @@ +# Google Cloud Billing Client for Java + +Java idiomatic client for [Cloud Billing][product-docs]. + +[![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 + +If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file +```xml + + + + com.google.cloud + libraries-bom + 3.4.0 + pom + import + + + + + + + com.google.cloud + google-cloud-billing + + +``` + +[//]: # ({x-version-update-start:google-cloud-billing:released}) + +If you are using Maven without BOM, add this to your dependencies: + +```xml + + com.google.cloud + google-cloud-billing + 0.0.0 + +``` + +If you are using Gradle, add this to your dependencies +```Groovy +compile 'com.google.cloud:google-cloud-billing:0.0.0' +``` +If you are using SBT, add this to your dependencies +```Scala +libraryDependencies += "com.google.cloud" % "google-cloud-billing" % "0.0.0" +``` +[//]: # ({x-version-update-end}) + +## Authentication + +See the [Authentication][authentication] section in the base directory's README. + +## Getting Started + +### Prerequisites + +You will need a [Google Cloud Platform Console][developer-console] project with the Cloud Billing [API enabled][enable-api]. + +[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-billing` library. See the [Quickstart](#quickstart) section +to add `google-cloud-billing` as a dependency in your code. + +## About Cloud Billing + + +[Cloud Billing][product-docs] allows developers to manage their billing accounts or browse the catalog of SKUs and pricing. + +See the [Cloud Billing client library docs][javadocs] to learn how to +use this Cloud Billing Client Library. + + + + +## Troubleshooting + +To get help, follow the instructions in the [shared Troubleshooting document][troubleshooting]. + +## 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][contributing] for more information 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] + +[product-docs]: https://cloud.google.com/billing/docs +[javadocs]: https://googleapis.dev/java/google-cloud-billing/latest/ +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-billing/java11.html +[stability-image]: https://img.shields.io/badge/stability-beta-yellow +[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-billing.svg +[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-billing&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-billing/blob/master/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/java-billing/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/java-billing/blob/master/LICENSE + +[enable-api]: https://console.cloud.google.com/flows/enableapi?apiid=cloudbilling.googleapis.com +[libraries-bom]: https://github.com/GoogleCloudPlatform/cloud-opensource-java/wiki/The-Google-Cloud-Platform-Libraries-BOM \ 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-billing-bom/pom.xml b/google-cloud-billing-bom/pom.xml new file mode 100644 index 00000000..e67a9aed --- /dev/null +++ b/google-cloud-billing-bom/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + com.google.cloud + google-cloud-billing-bom + 0.0.1-SNAPSHOT + pom + + com.google.cloud + google-cloud-shared-config + 0.4.0 + + + Google Cloud Billing BOM + https://github.com/googleapis/java-billing + + BOM for Google Cloud billing + + + + Google LLC + + + + + chingor13 + Jeff Ching + chingor@google.com + Google LLC + + Developer + + + + + + scm:git:https://github.com/googleapis/java-billing.git + scm:git:git@github.com:googleapis/java-billing.git + https://github.com/googleapis/java-billing + + + + + 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 + proto-google-cloud-billing-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-billing-v1 + 0.0.1-SNAPSHOT + + + com.google.cloud + google-cloud-billing + 0.0.1-SNAPSHOT + + + + + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + true + + + + + \ No newline at end of file diff --git a/google-cloud-billing/pom.xml b/google-cloud-billing/pom.xml new file mode 100644 index 00000000..f6c983f0 --- /dev/null +++ b/google-cloud-billing/pom.xml @@ -0,0 +1,103 @@ + + + 4.0.0 + com.google.cloud + google-cloud-billing + 0.0.1-SNAPSHOT + jar + Google Cloud Billing + https://github.com/googleapis/java-billing + Java idiomatic client for Google Cloud Billing + + com.google.cloud + google-cloud-billing-parent + 0.0.1-SNAPSHOT + + + google-cloud-billing + + + + io.grpc + grpc-api + + + io.grpc + grpc-stub + + + io.grpc + grpc-protobuf + + + com.google.api + api-common + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.api.grpc + proto-google-iam-v1 + + + com.google.api.grpc + proto-google-cloud-billing-v1 + + + com.google.guava + guava + + + com.google.api + gax + + + com.google.api + gax-grpc + + + org.threeten + threetenbp + + + + + junit + junit + test + + + com.google.api.grpc + grpc-google-cloud-billing-v1 + 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-billing/src/main/java/com/google/cloud/billing/v1/CloudBillingClient.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudBillingClient.java new file mode 100644 index 00000000..b0fee884 --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudBillingClient.java @@ -0,0 +1,1492 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.api.resourcenames.ResourceName; +import com.google.cloud.billing.v1.stub.CloudBillingStub; +import com.google.cloud.billing.v1.stub.CloudBillingStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: Retrieves GCP Console billing accounts and associates them with projects. + * + *

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 (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+ *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+ *   BillingAccount response = cloudBillingClient.getBillingAccount(name);
+ * }
+ * 
+ * 
+ * + *

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

To customize credentials: + * + *

+ * 
+ * CloudBillingSettings cloudBillingSettings =
+ *     CloudBillingSettings.newBuilder()
+ *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ *         .build();
+ * CloudBillingClient cloudBillingClient =
+ *     CloudBillingClient.create(cloudBillingSettings);
+ * 
+ * 
+ * + * To customize the endpoint: + * + *
+ * 
+ * CloudBillingSettings cloudBillingSettings =
+ *     CloudBillingSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * CloudBillingClient cloudBillingClient =
+ *     CloudBillingClient.create(cloudBillingSettings);
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class CloudBillingClient implements BackgroundResource { + private final CloudBillingSettings settings; + private final CloudBillingStub stub; + + /** Constructs an instance of CloudBillingClient with default settings. */ + public static final CloudBillingClient create() throws IOException { + return create(CloudBillingSettings.newBuilder().build()); + } + + /** + * Constructs an instance of CloudBillingClient, 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 CloudBillingClient create(CloudBillingSettings settings) throws IOException { + return new CloudBillingClient(settings); + } + + /** + * Constructs an instance of CloudBillingClient, using the given stub for making calls. This is + * for advanced usage - prefer to use CloudBillingSettings}. + */ + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public static final CloudBillingClient create(CloudBillingStub stub) { + return new CloudBillingClient(stub); + } + + /** + * Constructs an instance of CloudBillingClient, 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 CloudBillingClient(CloudBillingSettings settings) throws IOException { + this.settings = settings; + this.stub = ((CloudBillingStubSettings) settings.getStubSettings()).createStub(); + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + protected CloudBillingClient(CloudBillingStub stub) { + this.settings = null; + this.stub = stub; + } + + public final CloudBillingSettings getSettings() { + return settings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public CloudBillingStub getStub() { + return stub; + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets information about a billing account. The current authenticated user must be a [viewer of + * the billing account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   BillingAccount response = cloudBillingClient.getBillingAccount(name);
+   * }
+   * 
+ * + * @param name Required. The resource name of the billing account to retrieve. For example, + * `billingAccounts/012345-567890-ABCDEF`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final BillingAccount getBillingAccount(BillingAccountName name) { + + GetBillingAccountRequest request = + GetBillingAccountRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return getBillingAccount(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets information about a billing account. The current authenticated user must be a [viewer of + * the billing account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   BillingAccount response = cloudBillingClient.getBillingAccount(name.toString());
+   * }
+   * 
+ * + * @param name Required. The resource name of the billing account to retrieve. For example, + * `billingAccounts/012345-567890-ABCDEF`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final BillingAccount getBillingAccount(String name) { + + GetBillingAccountRequest request = GetBillingAccountRequest.newBuilder().setName(name).build(); + return getBillingAccount(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets information about a billing account. The current authenticated user must be a [viewer of + * the billing account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   GetBillingAccountRequest request = GetBillingAccountRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   BillingAccount response = cloudBillingClient.getBillingAccount(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 BillingAccount getBillingAccount(GetBillingAccountRequest request) { + return getBillingAccountCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets information about a billing account. The current authenticated user must be a [viewer of + * the billing account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   GetBillingAccountRequest request = GetBillingAccountRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<BillingAccount> future = cloudBillingClient.getBillingAccountCallable().futureCall(request);
+   *   // Do something
+   *   BillingAccount response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getBillingAccountCallable() { + return stub.getBillingAccountCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the billing accounts that the current authenticated user has permission to + * [view](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *
+   *   for (BillingAccount element : cloudBillingClient.listBillingAccounts().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListBillingAccountsPagedResponse listBillingAccounts() { + ListBillingAccountsRequest request = ListBillingAccountsRequest.newBuilder().build(); + + return listBillingAccounts(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the billing accounts that the current authenticated user has permission to + * [view](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ListBillingAccountsRequest request = ListBillingAccountsRequest.newBuilder().build();
+   *   for (BillingAccount element : cloudBillingClient.listBillingAccounts(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 ListBillingAccountsPagedResponse listBillingAccounts( + ListBillingAccountsRequest request) { + return listBillingAccountsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the billing accounts that the current authenticated user has permission to + * [view](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ListBillingAccountsRequest request = ListBillingAccountsRequest.newBuilder().build();
+   *   ApiFuture<ListBillingAccountsPagedResponse> future = cloudBillingClient.listBillingAccountsPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (BillingAccount element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listBillingAccountsPagedCallable() { + return stub.listBillingAccountsPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the billing accounts that the current authenticated user has permission to + * [view](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ListBillingAccountsRequest request = ListBillingAccountsRequest.newBuilder().build();
+   *   while (true) {
+   *     ListBillingAccountsResponse response = cloudBillingClient.listBillingAccountsCallable().call(request);
+   *     for (BillingAccount element : response.getBillingAccountsList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listBillingAccountsCallable() { + return stub.listBillingAccountsCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a billing account's fields. Currently the only field that can be edited is + * `display_name`. The current authenticated user must have the `billing.accounts.update` IAM + * permission, which is typically given to the + * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing + * account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   BillingAccount account = BillingAccount.newBuilder().build();
+   *   BillingAccount response = cloudBillingClient.updateBillingAccount(name, account);
+   * }
+   * 
+ * + * @param name Required. The name of the billing account resource to be updated. + * @param account Required. The billing account resource to replace the resource on the server. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final BillingAccount updateBillingAccount( + BillingAccountName name, BillingAccount account) { + + UpdateBillingAccountRequest request = + UpdateBillingAccountRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .setAccount(account) + .build(); + return updateBillingAccount(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a billing account's fields. Currently the only field that can be edited is + * `display_name`. The current authenticated user must have the `billing.accounts.update` IAM + * permission, which is typically given to the + * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing + * account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   BillingAccount account = BillingAccount.newBuilder().build();
+   *   BillingAccount response = cloudBillingClient.updateBillingAccount(name.toString(), account);
+   * }
+   * 
+ * + * @param name Required. The name of the billing account resource to be updated. + * @param account Required. The billing account resource to replace the resource on the server. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final BillingAccount updateBillingAccount(String name, BillingAccount account) { + + UpdateBillingAccountRequest request = + UpdateBillingAccountRequest.newBuilder().setName(name).setAccount(account).build(); + return updateBillingAccount(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a billing account's fields. Currently the only field that can be edited is + * `display_name`. The current authenticated user must have the `billing.accounts.update` IAM + * permission, which is typically given to the + * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing + * account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   BillingAccount account = BillingAccount.newBuilder().build();
+   *   UpdateBillingAccountRequest request = UpdateBillingAccountRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setAccount(account)
+   *     .build();
+   *   BillingAccount response = cloudBillingClient.updateBillingAccount(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 BillingAccount updateBillingAccount(UpdateBillingAccountRequest request) { + return updateBillingAccountCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Updates a billing account's fields. Currently the only field that can be edited is + * `display_name`. The current authenticated user must have the `billing.accounts.update` IAM + * permission, which is typically given to the + * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) of the billing + * account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   BillingAccount account = BillingAccount.newBuilder().build();
+   *   UpdateBillingAccountRequest request = UpdateBillingAccountRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .setAccount(account)
+   *     .build();
+   *   ApiFuture<BillingAccount> future = cloudBillingClient.updateBillingAccountCallable().futureCall(request);
+   *   // Do something
+   *   BillingAccount response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + updateBillingAccountCallable() { + return stub.updateBillingAccountCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a billing account. This method can only be used to create [billing + * subaccounts](https://cloud.google.com/billing/docs/concepts) by GCP resellers. When creating a + * subaccount, the current authenticated user must have the `billing.accounts.update` IAM + * permission on the master account, which is typically given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will + * return an error if the master account has not been provisioned as a reseller account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccount billingAccount = BillingAccount.newBuilder().build();
+   *   BillingAccount response = cloudBillingClient.createBillingAccount(billingAccount);
+   * }
+   * 
+ * + * @param billingAccount Required. The billing account resource to create. Currently + * CreateBillingAccount only supports subaccount creation, so any created billing accounts + * must be under a provided master billing account. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final BillingAccount createBillingAccount(BillingAccount billingAccount) { + + CreateBillingAccountRequest request = + CreateBillingAccountRequest.newBuilder().setBillingAccount(billingAccount).build(); + return createBillingAccount(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a billing account. This method can only be used to create [billing + * subaccounts](https://cloud.google.com/billing/docs/concepts) by GCP resellers. When creating a + * subaccount, the current authenticated user must have the `billing.accounts.update` IAM + * permission on the master account, which is typically given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will + * return an error if the master account has not been provisioned as a reseller account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccount billingAccount = BillingAccount.newBuilder().build();
+   *   CreateBillingAccountRequest request = CreateBillingAccountRequest.newBuilder()
+   *     .setBillingAccount(billingAccount)
+   *     .build();
+   *   BillingAccount response = cloudBillingClient.createBillingAccount(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 BillingAccount createBillingAccount(CreateBillingAccountRequest request) { + return createBillingAccountCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Creates a billing account. This method can only be used to create [billing + * subaccounts](https://cloud.google.com/billing/docs/concepts) by GCP resellers. When creating a + * subaccount, the current authenticated user must have the `billing.accounts.update` IAM + * permission on the master account, which is typically given to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). This method will + * return an error if the master account has not been provisioned as a reseller account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccount billingAccount = BillingAccount.newBuilder().build();
+   *   CreateBillingAccountRequest request = CreateBillingAccountRequest.newBuilder()
+   *     .setBillingAccount(billingAccount)
+   *     .build();
+   *   ApiFuture<BillingAccount> future = cloudBillingClient.createBillingAccountCallable().futureCall(request);
+   *   // Do something
+   *   BillingAccount response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + createBillingAccountCallable() { + return stub.createBillingAccountCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the projects associated with a billing account. The current authenticated user must have + * the `billing.resourceAssociations.list` IAM permission, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   for (ProjectBillingInfo element : cloudBillingClient.listProjectBillingInfo(name).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name Required. The resource name of the billing account associated with the projects + * that you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListProjectBillingInfoPagedResponse listProjectBillingInfo(BillingAccountName name) { + ListProjectBillingInfoRequest request = + ListProjectBillingInfoRequest.newBuilder() + .setName(name == null ? null : name.toString()) + .build(); + return listProjectBillingInfo(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the projects associated with a billing account. The current authenticated user must have + * the `billing.resourceAssociations.list` IAM permission, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   for (ProjectBillingInfo element : cloudBillingClient.listProjectBillingInfo(name.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param name Required. The resource name of the billing account associated with the projects + * that you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListProjectBillingInfoPagedResponse listProjectBillingInfo(String name) { + ListProjectBillingInfoRequest request = + ListProjectBillingInfoRequest.newBuilder().setName(name).build(); + return listProjectBillingInfo(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the projects associated with a billing account. The current authenticated user must have + * the `billing.resourceAssociations.list` IAM permission, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListProjectBillingInfoRequest request = ListProjectBillingInfoRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   for (ProjectBillingInfo element : cloudBillingClient.listProjectBillingInfo(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 ListProjectBillingInfoPagedResponse listProjectBillingInfo( + ListProjectBillingInfoRequest request) { + return listProjectBillingInfoPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the projects associated with a billing account. The current authenticated user must have + * the `billing.resourceAssociations.list` IAM permission, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListProjectBillingInfoRequest request = ListProjectBillingInfoRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   ApiFuture<ListProjectBillingInfoPagedResponse> future = cloudBillingClient.listProjectBillingInfoPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (ProjectBillingInfo element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listProjectBillingInfoPagedCallable() { + return stub.listProjectBillingInfoPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists the projects associated with a billing account. The current authenticated user must have + * the `billing.resourceAssociations.list` IAM permission, which is often given to billing account + * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   ListProjectBillingInfoRequest request = ListProjectBillingInfoRequest.newBuilder()
+   *     .setName(name.toString())
+   *     .build();
+   *   while (true) {
+   *     ListProjectBillingInfoResponse response = cloudBillingClient.listProjectBillingInfoCallable().call(request);
+   *     for (ProjectBillingInfo element : response.getProjectBillingInfoList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listProjectBillingInfoCallable() { + return stub.listProjectBillingInfoCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the billing information for a project. The current authenticated user must have + * [permission to view the + * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   String name = "";
+   *   ProjectBillingInfo response = cloudBillingClient.getProjectBillingInfo(name);
+   * }
+   * 
+ * + * @param name Required. The resource name of the project for which billing information is + * retrieved. For example, `projects/tokyo-rain-123`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ProjectBillingInfo getProjectBillingInfo(String name) { + + GetProjectBillingInfoRequest request = + GetProjectBillingInfoRequest.newBuilder().setName(name).build(); + return getProjectBillingInfo(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the billing information for a project. The current authenticated user must have + * [permission to view the + * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   String name = "";
+   *   GetProjectBillingInfoRequest request = GetProjectBillingInfoRequest.newBuilder()
+   *     .setName(name)
+   *     .build();
+   *   ProjectBillingInfo response = cloudBillingClient.getProjectBillingInfo(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 ProjectBillingInfo getProjectBillingInfo(GetProjectBillingInfoRequest request) { + return getProjectBillingInfoCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the billing information for a project. The current authenticated user must have + * [permission to view the + * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   String name = "";
+   *   GetProjectBillingInfoRequest request = GetProjectBillingInfoRequest.newBuilder()
+   *     .setName(name)
+   *     .build();
+   *   ApiFuture<ProjectBillingInfo> future = cloudBillingClient.getProjectBillingInfoCallable().futureCall(request);
+   *   // Do something
+   *   ProjectBillingInfo response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + getProjectBillingInfoCallable() { + return stub.getProjectBillingInfoCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets or updates the billing account associated with a project. You specify the new billing + * account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the + * resource name of a billing account. Associating a project with an open billing account enables + * billing on the project and allows charges for resource usage. If the project already had a + * billing account, this method changes the billing account used for resource usage charges. + * + *

*Note:* Incurred charges that have not yet been reported in the transaction history + * of the GCP Console might be billed to the new billing account, even if the charge occurred + * before the new billing account was assigned to the project. + * + *

The current authenticated user must have ownership privileges for both the + * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

You can disable billing on the project by setting the `billing_account_name` field to empty. + * This action disassociates the current billing account from the project. Any billable activity + * of your in-use services will stop, and your application could stop functioning as expected. Any + * unbilled charges to date will be billed to the previously associated account. The current + * authenticated user must be either an owner of the project or an owner of the billing account + * for the project. + * + *

Note that associating a project with a *closed* billing account will have much the + * same effect as disabling billing on the project: any paid resources used by the project will be + * shut down. Thus, unless you wish to disable billing, you should always call this method with + * the name of an *open* billing account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   String name = "";
+   *   ProjectBillingInfo projectBillingInfo = ProjectBillingInfo.newBuilder().build();
+   *   ProjectBillingInfo response = cloudBillingClient.updateProjectBillingInfo(name, projectBillingInfo);
+   * }
+   * 
+ * + * @param name Required. The resource name of the project associated with the billing information + * that you want to update. For example, `projects/tokyo-rain-123`. + * @param projectBillingInfo The new billing information for the project. Read-only fields are + * ignored; thus, you can leave empty all fields except `billing_account_name`. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ProjectBillingInfo updateProjectBillingInfo( + String name, ProjectBillingInfo projectBillingInfo) { + + UpdateProjectBillingInfoRequest request = + UpdateProjectBillingInfoRequest.newBuilder() + .setName(name) + .setProjectBillingInfo(projectBillingInfo) + .build(); + return updateProjectBillingInfo(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets or updates the billing account associated with a project. You specify the new billing + * account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the + * resource name of a billing account. Associating a project with an open billing account enables + * billing on the project and allows charges for resource usage. If the project already had a + * billing account, this method changes the billing account used for resource usage charges. + * + *

*Note:* Incurred charges that have not yet been reported in the transaction history + * of the GCP Console might be billed to the new billing account, even if the charge occurred + * before the new billing account was assigned to the project. + * + *

The current authenticated user must have ownership privileges for both the + * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

You can disable billing on the project by setting the `billing_account_name` field to empty. + * This action disassociates the current billing account from the project. Any billable activity + * of your in-use services will stop, and your application could stop functioning as expected. Any + * unbilled charges to date will be billed to the previously associated account. The current + * authenticated user must be either an owner of the project or an owner of the billing account + * for the project. + * + *

Note that associating a project with a *closed* billing account will have much the + * same effect as disabling billing on the project: any paid resources used by the project will be + * shut down. Thus, unless you wish to disable billing, you should always call this method with + * the name of an *open* billing account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   String name = "";
+   *   UpdateProjectBillingInfoRequest request = UpdateProjectBillingInfoRequest.newBuilder()
+   *     .setName(name)
+   *     .build();
+   *   ProjectBillingInfo response = cloudBillingClient.updateProjectBillingInfo(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 ProjectBillingInfo updateProjectBillingInfo( + UpdateProjectBillingInfoRequest request) { + return updateProjectBillingInfoCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets or updates the billing account associated with a project. You specify the new billing + * account by setting the `billing_account_name` in the `ProjectBillingInfo` resource to the + * resource name of a billing account. Associating a project with an open billing account enables + * billing on the project and allows charges for resource usage. If the project already had a + * billing account, this method changes the billing account used for resource usage charges. + * + *

*Note:* Incurred charges that have not yet been reported in the transaction history + * of the GCP Console might be billed to the new billing account, even if the charge occurred + * before the new billing account was assigned to the project. + * + *

The current authenticated user must have ownership privileges for both the + * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo ) and the [billing + * account](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

You can disable billing on the project by setting the `billing_account_name` field to empty. + * This action disassociates the current billing account from the project. Any billable activity + * of your in-use services will stop, and your application could stop functioning as expected. Any + * unbilled charges to date will be billed to the previously associated account. The current + * authenticated user must be either an owner of the project or an owner of the billing account + * for the project. + * + *

Note that associating a project with a *closed* billing account will have much the + * same effect as disabling billing on the project: any paid resources used by the project will be + * shut down. Thus, unless you wish to disable billing, you should always call this method with + * the name of an *open* billing account. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   String name = "";
+   *   UpdateProjectBillingInfoRequest request = UpdateProjectBillingInfoRequest.newBuilder()
+   *     .setName(name)
+   *     .build();
+   *   ApiFuture<ProjectBillingInfo> future = cloudBillingClient.updateProjectBillingInfoCallable().futureCall(request);
+   *   // Do something
+   *   ProjectBillingInfo response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + updateProjectBillingInfoCallable() { + return stub.updateProjectBillingInfoCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a billing account. The caller must have the + * `billing.accounts.getIamPolicy` permission on the account, which is often given to billing + * account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Policy response = cloudBillingClient.getIamPolicy(resource);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. See the + * operation documentation for the appropriate value for this field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(ResourceName resource) { + + GetIamPolicyRequest request = + GetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a billing account. The caller must have the + * `billing.accounts.getIamPolicy` permission on the account, which is often given to billing + * account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Policy response = cloudBillingClient.getIamPolicy(resource.toString());
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being requested. See the + * operation documentation for the appropriate value for this field. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(String resource) { + + GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder().setResource(resource).build(); + return getIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a billing account. The caller must have the + * `billing.accounts.getIamPolicy` permission on the account, which is often given to billing + * account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .build();
+   *   Policy response = cloudBillingClient.getIamPolicy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Gets the access control policy for a billing account. The caller must have the + * `billing.accounts.getIamPolicy` permission on the account, which is often given to billing + * account [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .build();
+   *   ApiFuture<Policy> future = cloudBillingClient.getIamPolicyCallable().futureCall(request);
+   *   // Do something
+   *   Policy response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable getIamPolicyCallable() { + return stub.getIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy for a billing account. Replaces any existing policy. The caller + * must have the `billing.accounts.setIamPolicy` permission on the account, which is often given + * to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = cloudBillingClient.setIamPolicy(resource, policy);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being specified. See the + * operation documentation for the appropriate value for this field. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(ResourceName resource, Policy policy) { + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .setPolicy(policy) + .build(); + return setIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy for a billing account. Replaces any existing policy. The caller + * must have the `billing.accounts.setIamPolicy` permission on the account, which is often given + * to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   Policy response = cloudBillingClient.setIamPolicy(resource.toString(), policy);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy is being specified. See the + * operation documentation for the appropriate value for this field. + * @param policy REQUIRED: The complete policy to be applied to the `resource`. The size of the + * policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud + * Platform services (such as Projects) might reject them. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(String resource, Policy policy) { + + SetIamPolicyRequest request = + SetIamPolicyRequest.newBuilder().setResource(resource).setPolicy(policy).build(); + return setIamPolicy(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy for a billing account. Replaces any existing policy. The caller + * must have the `billing.accounts.setIamPolicy` permission on the account, which is often given + * to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setPolicy(policy)
+   *     .build();
+   *   Policy response = cloudBillingClient.setIamPolicy(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Sets the access control policy for a billing account. Replaces any existing policy. The caller + * must have the `billing.accounts.setIamPolicy` permission on the account, which is often given + * to billing account + * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   Policy policy = Policy.newBuilder().build();
+   *   SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .setPolicy(policy)
+   *     .build();
+   *   ApiFuture<Policy> future = cloudBillingClient.setIamPolicyCallable().futureCall(request);
+   *   // Do something
+   *   Policy response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable setIamPolicyCallable() { + return stub.setIamPolicyCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Tests the access control policy for a billing account. This method takes the resource and a set + * of permissions as input and returns the subset of the input permissions that the caller is + * allowed for that resource. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response = cloudBillingClient.testIamPermissions(resource, permissions);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the + * operation documentation for the appropriate value for this field. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions( + ResourceName resource, List permissions) { + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource == null ? null : resource.toString()) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Tests the access control policy for a billing account. This method takes the resource and a set + * of permissions as input and returns the subset of the input permissions that the caller is + * allowed for that resource. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsResponse response = cloudBillingClient.testIamPermissions(resource.toString(), permissions);
+   * }
+   * 
+ * + * @param resource REQUIRED: The resource for which the policy detail is being requested. See the + * operation documentation for the appropriate value for this field. + * @param permissions The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions( + String resource, List permissions) { + + TestIamPermissionsRequest request = + TestIamPermissionsRequest.newBuilder() + .setResource(resource) + .addAllPermissions(permissions) + .build(); + return testIamPermissions(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Tests the access control policy for a billing account. This method takes the resource and a set + * of permissions as input and returns the subset of the input permissions that the caller is + * allowed for that resource. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .addAllPermissions(permissions)
+   *     .build();
+   *   TestIamPermissionsResponse response = cloudBillingClient.testIamPermissions(request);
+   * }
+   * 
+ * + * @param request The request object containing all of the parameters for the API call. + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Tests the access control policy for a billing account. This method takes the resource and a set + * of permissions as input and returns the subset of the input permissions that the caller is + * allowed for that resource. + * + *

Sample code: + * + *


+   * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+   *   ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]");
+   *   List<String> permissions = new ArrayList<>();
+   *   TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder()
+   *     .setResource(resource.toString())
+   *     .addAllPermissions(permissions)
+   *     .build();
+   *   ApiFuture<TestIamPermissionsResponse> future = cloudBillingClient.testIamPermissionsCallable().futureCall(request);
+   *   // Do something
+   *   TestIamPermissionsResponse response = future.get();
+   * }
+   * 
+ */ + public final UnaryCallable + testIamPermissionsCallable() { + return stub.testIamPermissionsCallable(); + } + + @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 ListBillingAccountsPagedResponse + extends AbstractPagedListResponse< + ListBillingAccountsRequest, + ListBillingAccountsResponse, + BillingAccount, + ListBillingAccountsPage, + ListBillingAccountsFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListBillingAccountsPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListBillingAccountsPagedResponse apply(ListBillingAccountsPage input) { + return new ListBillingAccountsPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListBillingAccountsPagedResponse(ListBillingAccountsPage page) { + super(page, ListBillingAccountsFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListBillingAccountsPage + extends AbstractPage< + ListBillingAccountsRequest, + ListBillingAccountsResponse, + BillingAccount, + ListBillingAccountsPage> { + + private ListBillingAccountsPage( + PageContext + context, + ListBillingAccountsResponse response) { + super(context, response); + } + + private static ListBillingAccountsPage createEmptyPage() { + return new ListBillingAccountsPage(null, null); + } + + @Override + protected ListBillingAccountsPage createPage( + PageContext + context, + ListBillingAccountsResponse response) { + return new ListBillingAccountsPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListBillingAccountsFixedSizeCollection + extends AbstractFixedSizeCollection< + ListBillingAccountsRequest, + ListBillingAccountsResponse, + BillingAccount, + ListBillingAccountsPage, + ListBillingAccountsFixedSizeCollection> { + + private ListBillingAccountsFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListBillingAccountsFixedSizeCollection createEmptyCollection() { + return new ListBillingAccountsFixedSizeCollection(null, 0); + } + + @Override + protected ListBillingAccountsFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListBillingAccountsFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListProjectBillingInfoPagedResponse + extends AbstractPagedListResponse< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ProjectBillingInfo, + ListProjectBillingInfoPage, + ListProjectBillingInfoFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext< + ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo> + context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListProjectBillingInfoPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListProjectBillingInfoPagedResponse apply(ListProjectBillingInfoPage input) { + return new ListProjectBillingInfoPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListProjectBillingInfoPagedResponse(ListProjectBillingInfoPage page) { + super(page, ListProjectBillingInfoFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListProjectBillingInfoPage + extends AbstractPage< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ProjectBillingInfo, + ListProjectBillingInfoPage> { + + private ListProjectBillingInfoPage( + PageContext< + ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo> + context, + ListProjectBillingInfoResponse response) { + super(context, response); + } + + private static ListProjectBillingInfoPage createEmptyPage() { + return new ListProjectBillingInfoPage(null, null); + } + + @Override + protected ListProjectBillingInfoPage createPage( + PageContext< + ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo> + context, + ListProjectBillingInfoResponse response) { + return new ListProjectBillingInfoPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext< + ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo> + context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListProjectBillingInfoFixedSizeCollection + extends AbstractFixedSizeCollection< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ProjectBillingInfo, + ListProjectBillingInfoPage, + ListProjectBillingInfoFixedSizeCollection> { + + private ListProjectBillingInfoFixedSizeCollection( + List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListProjectBillingInfoFixedSizeCollection createEmptyCollection() { + return new ListProjectBillingInfoFixedSizeCollection(null, 0); + } + + @Override + protected ListProjectBillingInfoFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListProjectBillingInfoFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudBillingSettings.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudBillingSettings.java new file mode 100644 index 00000000..d92f8825 --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudBillingSettings.java @@ -0,0 +1,299 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1; + +import static com.google.cloud.billing.v1.CloudBillingClient.ListBillingAccountsPagedResponse; +import static com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse; + +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.v1.stub.CloudBillingStubSettings; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import java.io.IOException; +import java.util.List; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Settings class to configure an instance of {@link CloudBillingClient}. + * + *

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

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

+ * 
+ * CloudBillingSettings.Builder cloudBillingSettingsBuilder =
+ *     CloudBillingSettings.newBuilder();
+ * cloudBillingSettingsBuilder.getBillingAccountSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * CloudBillingSettings cloudBillingSettings = cloudBillingSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class CloudBillingSettings extends ClientSettings { + /** Returns the object with the settings used for calls to getBillingAccount. */ + public UnaryCallSettings getBillingAccountSettings() { + return ((CloudBillingStubSettings) getStubSettings()).getBillingAccountSettings(); + } + + /** Returns the object with the settings used for calls to listBillingAccounts. */ + public PagedCallSettings< + ListBillingAccountsRequest, ListBillingAccountsResponse, ListBillingAccountsPagedResponse> + listBillingAccountsSettings() { + return ((CloudBillingStubSettings) getStubSettings()).listBillingAccountsSettings(); + } + + /** Returns the object with the settings used for calls to updateBillingAccount. */ + public UnaryCallSettings + updateBillingAccountSettings() { + return ((CloudBillingStubSettings) getStubSettings()).updateBillingAccountSettings(); + } + + /** Returns the object with the settings used for calls to createBillingAccount. */ + public UnaryCallSettings + createBillingAccountSettings() { + return ((CloudBillingStubSettings) getStubSettings()).createBillingAccountSettings(); + } + + /** Returns the object with the settings used for calls to listProjectBillingInfo. */ + public PagedCallSettings< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ListProjectBillingInfoPagedResponse> + listProjectBillingInfoSettings() { + return ((CloudBillingStubSettings) getStubSettings()).listProjectBillingInfoSettings(); + } + + /** Returns the object with the settings used for calls to getProjectBillingInfo. */ + public UnaryCallSettings + getProjectBillingInfoSettings() { + return ((CloudBillingStubSettings) getStubSettings()).getProjectBillingInfoSettings(); + } + + /** Returns the object with the settings used for calls to updateProjectBillingInfo. */ + public UnaryCallSettings + updateProjectBillingInfoSettings() { + return ((CloudBillingStubSettings) getStubSettings()).updateProjectBillingInfoSettings(); + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return ((CloudBillingStubSettings) getStubSettings()).getIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return ((CloudBillingStubSettings) getStubSettings()).setIamPolicySettings(); + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return ((CloudBillingStubSettings) getStubSettings()).testIamPermissionsSettings(); + } + + public static final CloudBillingSettings create(CloudBillingStubSettings stub) + throws IOException { + return new CloudBillingSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return CloudBillingStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return CloudBillingStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return CloudBillingStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return CloudBillingStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return CloudBillingStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return CloudBillingStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CloudBillingStubSettings.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 CloudBillingSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for CloudBillingSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(CloudBillingStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(CloudBillingStubSettings.newBuilder()); + } + + protected Builder(CloudBillingSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(CloudBillingStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public CloudBillingStubSettings.Builder getStubSettingsBuilder() { + return ((CloudBillingStubSettings.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 getBillingAccount. */ + public UnaryCallSettings.Builder + getBillingAccountSettings() { + return getStubSettingsBuilder().getBillingAccountSettings(); + } + + /** Returns the builder for the settings used for calls to listBillingAccounts. */ + public PagedCallSettings.Builder< + ListBillingAccountsRequest, + ListBillingAccountsResponse, + ListBillingAccountsPagedResponse> + listBillingAccountsSettings() { + return getStubSettingsBuilder().listBillingAccountsSettings(); + } + + /** Returns the builder for the settings used for calls to updateBillingAccount. */ + public UnaryCallSettings.Builder + updateBillingAccountSettings() { + return getStubSettingsBuilder().updateBillingAccountSettings(); + } + + /** Returns the builder for the settings used for calls to createBillingAccount. */ + public UnaryCallSettings.Builder + createBillingAccountSettings() { + return getStubSettingsBuilder().createBillingAccountSettings(); + } + + /** Returns the builder for the settings used for calls to listProjectBillingInfo. */ + public PagedCallSettings.Builder< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ListProjectBillingInfoPagedResponse> + listProjectBillingInfoSettings() { + return getStubSettingsBuilder().listProjectBillingInfoSettings(); + } + + /** Returns the builder for the settings used for calls to getProjectBillingInfo. */ + public UnaryCallSettings.Builder + getProjectBillingInfoSettings() { + return getStubSettingsBuilder().getProjectBillingInfoSettings(); + } + + /** Returns the builder for the settings used for calls to updateProjectBillingInfo. */ + public UnaryCallSettings.Builder + updateProjectBillingInfoSettings() { + return getStubSettingsBuilder().updateProjectBillingInfoSettings(); + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getStubSettingsBuilder().getIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return getStubSettingsBuilder().setIamPolicySettings(); + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return getStubSettingsBuilder().testIamPermissionsSettings(); + } + + @Override + public CloudBillingSettings build() throws IOException { + return new CloudBillingSettings(this); + } + } +} diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudCatalogClient.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudCatalogClient.java new file mode 100644 index 00000000..fdec1e0c --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudCatalogClient.java @@ -0,0 +1,559 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1; + +import com.google.api.core.ApiFunction; +import com.google.api.core.ApiFuture; +import com.google.api.core.ApiFutures; +import com.google.api.core.BetaApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.paging.AbstractFixedSizeCollection; +import com.google.api.gax.paging.AbstractPage; +import com.google.api.gax.paging.AbstractPagedListResponse; +import com.google.api.gax.rpc.PageContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.billing.v1.stub.CloudCatalogStub; +import com.google.cloud.billing.v1.stub.CloudCatalogStubSettings; +import com.google.common.util.concurrent.MoreExecutors; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND SERVICE +/** + * Service Description: A catalog of Google Cloud Platform services and SKUs. Provides pricing + * information and metadata on Google Cloud Platform services and SKUs. + * + *

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 (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+ *
+ *   for (Service element : cloudCatalogClient.listServices().iterateAll()) {
+ *     // doThingsWith(element);
+ *   }
+ * }
+ * 
+ * 
+ * + *

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

To customize credentials: + * + *

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

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *
+   *   for (Service element : cloudCatalogClient.listServices().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListServicesPagedResponse listServices() { + ListServicesRequest request = ListServicesRequest.newBuilder().build(); + + return listServices(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all public cloud services. + * + *

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *   ListServicesRequest request = ListServicesRequest.newBuilder().build();
+   *   for (Service element : cloudCatalogClient.listServices(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 ListServicesPagedResponse listServices(ListServicesRequest request) { + return listServicesPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all public cloud services. + * + *

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *   ListServicesRequest request = ListServicesRequest.newBuilder().build();
+   *   ApiFuture<ListServicesPagedResponse> future = cloudCatalogClient.listServicesPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Service element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable + listServicesPagedCallable() { + return stub.listServicesPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all public cloud services. + * + *

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *   ListServicesRequest request = ListServicesRequest.newBuilder().build();
+   *   while (true) {
+   *     ListServicesResponse response = cloudCatalogClient.listServicesCallable().call(request);
+   *     for (Service element : response.getServicesList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable listServicesCallable() { + return stub.listServicesCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all publicly available SKUs for a given cloud service. + * + *

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *   ServiceName parent = ServiceName.of("[SERVICE]");
+   *   for (Sku element : cloudCatalogClient.listSkus(parent).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The name of the service. Example: "services/DA34-426B-A397" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSkusPagedResponse listSkus(ServiceName parent) { + ListSkusRequest request = + ListSkusRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build(); + return listSkus(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all publicly available SKUs for a given cloud service. + * + *

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *   ServiceName parent = ServiceName.of("[SERVICE]");
+   *   for (Sku element : cloudCatalogClient.listSkus(parent.toString()).iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ * + * @param parent Required. The name of the service. Example: "services/DA34-426B-A397" + * @throws com.google.api.gax.rpc.ApiException if the remote call fails + */ + public final ListSkusPagedResponse listSkus(String parent) { + ListSkusRequest request = ListSkusRequest.newBuilder().setParent(parent).build(); + return listSkus(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all publicly available SKUs for a given cloud service. + * + *

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *   ServiceName parent = ServiceName.of("[SERVICE]");
+   *   ListSkusRequest request = ListSkusRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   for (Sku element : cloudCatalogClient.listSkus(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 ListSkusPagedResponse listSkus(ListSkusRequest request) { + return listSkusPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all publicly available SKUs for a given cloud service. + * + *

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *   ServiceName parent = ServiceName.of("[SERVICE]");
+   *   ListSkusRequest request = ListSkusRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   ApiFuture<ListSkusPagedResponse> future = cloudCatalogClient.listSkusPagedCallable().futureCall(request);
+   *   // Do something
+   *   for (Sku element : future.get().iterateAll()) {
+   *     // doThingsWith(element);
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable listSkusPagedCallable() { + return stub.listSkusPagedCallable(); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD + /** + * Lists all publicly available SKUs for a given cloud service. + * + *

Sample code: + * + *


+   * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+   *   ServiceName parent = ServiceName.of("[SERVICE]");
+   *   ListSkusRequest request = ListSkusRequest.newBuilder()
+   *     .setParent(parent.toString())
+   *     .build();
+   *   while (true) {
+   *     ListSkusResponse response = cloudCatalogClient.listSkusCallable().call(request);
+   *     for (Sku element : response.getSkusList()) {
+   *       // doThingsWith(element);
+   *     }
+   *     String nextPageToken = response.getNextPageToken();
+   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
+   *       request = request.toBuilder().setPageToken(nextPageToken).build();
+   *     } else {
+   *       break;
+   *     }
+   *   }
+   * }
+   * 
+ */ + public final UnaryCallable listSkusCallable() { + return stub.listSkusCallable(); + } + + @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 ListServicesPagedResponse + extends AbstractPagedListResponse< + ListServicesRequest, + ListServicesResponse, + Service, + ListServicesPage, + ListServicesFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListServicesPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListServicesPagedResponse apply(ListServicesPage input) { + return new ListServicesPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListServicesPagedResponse(ListServicesPage page) { + super(page, ListServicesFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListServicesPage + extends AbstractPage { + + private ListServicesPage( + PageContext context, + ListServicesResponse response) { + super(context, response); + } + + private static ListServicesPage createEmptyPage() { + return new ListServicesPage(null, null); + } + + @Override + protected ListServicesPage createPage( + PageContext context, + ListServicesResponse response) { + return new ListServicesPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListServicesFixedSizeCollection + extends AbstractFixedSizeCollection< + ListServicesRequest, + ListServicesResponse, + Service, + ListServicesPage, + ListServicesFixedSizeCollection> { + + private ListServicesFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListServicesFixedSizeCollection createEmptyCollection() { + return new ListServicesFixedSizeCollection(null, 0); + } + + @Override + protected ListServicesFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListServicesFixedSizeCollection(pages, collectionSize); + } + } + + public static class ListSkusPagedResponse + extends AbstractPagedListResponse< + ListSkusRequest, ListSkusResponse, Sku, ListSkusPage, ListSkusFixedSizeCollection> { + + public static ApiFuture createAsync( + PageContext context, + ApiFuture futureResponse) { + ApiFuture futurePage = + ListSkusPage.createEmptyPage().createPageAsync(context, futureResponse); + return ApiFutures.transform( + futurePage, + new ApiFunction() { + @Override + public ListSkusPagedResponse apply(ListSkusPage input) { + return new ListSkusPagedResponse(input); + } + }, + MoreExecutors.directExecutor()); + } + + private ListSkusPagedResponse(ListSkusPage page) { + super(page, ListSkusFixedSizeCollection.createEmptyCollection()); + } + } + + public static class ListSkusPage + extends AbstractPage { + + private ListSkusPage( + PageContext context, ListSkusResponse response) { + super(context, response); + } + + private static ListSkusPage createEmptyPage() { + return new ListSkusPage(null, null); + } + + @Override + protected ListSkusPage createPage( + PageContext context, ListSkusResponse response) { + return new ListSkusPage(context, response); + } + + @Override + public ApiFuture createPageAsync( + PageContext context, + ApiFuture futureResponse) { + return super.createPageAsync(context, futureResponse); + } + } + + public static class ListSkusFixedSizeCollection + extends AbstractFixedSizeCollection< + ListSkusRequest, ListSkusResponse, Sku, ListSkusPage, ListSkusFixedSizeCollection> { + + private ListSkusFixedSizeCollection(List pages, int collectionSize) { + super(pages, collectionSize); + } + + private static ListSkusFixedSizeCollection createEmptyCollection() { + return new ListSkusFixedSizeCollection(null, 0); + } + + @Override + protected ListSkusFixedSizeCollection createCollection( + List pages, int collectionSize) { + return new ListSkusFixedSizeCollection(pages, collectionSize); + } + } +} diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudCatalogSettings.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudCatalogSettings.java new file mode 100644 index 00000000..958e0242 --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudCatalogSettings.java @@ -0,0 +1,194 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1; + +import static com.google.cloud.billing.v1.CloudCatalogClient.ListServicesPagedResponse; +import static com.google.cloud.billing.v1.CloudCatalogClient.ListSkusPagedResponse; + +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.v1.stub.CloudCatalogStubSettings; +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 CloudCatalogClient}. + * + *

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

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

+ * 
+ * CloudCatalogSettings.Builder cloudCatalogSettingsBuilder =
+ *     CloudCatalogSettings.newBuilder();
+ * cloudCatalogSettingsBuilder.listServicesSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * CloudCatalogSettings cloudCatalogSettings = cloudCatalogSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class CloudCatalogSettings extends ClientSettings { + /** Returns the object with the settings used for calls to listServices. */ + public PagedCallSettings + listServicesSettings() { + return ((CloudCatalogStubSettings) getStubSettings()).listServicesSettings(); + } + + /** Returns the object with the settings used for calls to listSkus. */ + public PagedCallSettings + listSkusSettings() { + return ((CloudCatalogStubSettings) getStubSettings()).listSkusSettings(); + } + + public static final CloudCatalogSettings create(CloudCatalogStubSettings stub) + throws IOException { + return new CloudCatalogSettings.Builder(stub.toBuilder()).build(); + } + + /** Returns a builder for the default ExecutorProvider for this service. */ + public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { + return CloudCatalogStubSettings.defaultExecutorProviderBuilder(); + } + + /** Returns the default service endpoint. */ + public static String getDefaultEndpoint() { + return CloudCatalogStubSettings.getDefaultEndpoint(); + } + + /** Returns the default service scopes. */ + public static List getDefaultServiceScopes() { + return CloudCatalogStubSettings.getDefaultServiceScopes(); + } + + /** Returns a builder for the default credentials for this service. */ + public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { + return CloudCatalogStubSettings.defaultCredentialsProviderBuilder(); + } + + /** Returns a builder for the default ChannelProvider for this service. */ + public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { + return CloudCatalogStubSettings.defaultGrpcTransportProviderBuilder(); + } + + public static TransportChannelProvider defaultTransportChannelProvider() { + return CloudCatalogStubSettings.defaultTransportChannelProvider(); + } + + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return CloudCatalogStubSettings.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 CloudCatalogSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + } + + /** Builder for CloudCatalogSettings. */ + public static class Builder extends ClientSettings.Builder { + protected Builder() throws IOException { + this((ClientContext) null); + } + + protected Builder(ClientContext clientContext) { + super(CloudCatalogStubSettings.newBuilder(clientContext)); + } + + private static Builder createDefault() { + return new Builder(CloudCatalogStubSettings.newBuilder()); + } + + protected Builder(CloudCatalogSettings settings) { + super(settings.getStubSettings().toBuilder()); + } + + protected Builder(CloudCatalogStubSettings.Builder stubSettings) { + super(stubSettings); + } + + public CloudCatalogStubSettings.Builder getStubSettingsBuilder() { + return ((CloudCatalogStubSettings.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 listServices. */ + public PagedCallSettings.Builder< + ListServicesRequest, ListServicesResponse, ListServicesPagedResponse> + listServicesSettings() { + return getStubSettingsBuilder().listServicesSettings(); + } + + /** Returns the builder for the settings used for calls to listSkus. */ + public PagedCallSettings.Builder + listSkusSettings() { + return getStubSettingsBuilder().listSkusSettings(); + } + + @Override + public CloudCatalogSettings build() throws IOException { + return new CloudCatalogSettings(this); + } + } +} diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/package-info.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/package-info.java new file mode 100644 index 00000000..eb773ecf --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/package-info.java @@ -0,0 +1,56 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 API. + * + *

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

================== CloudBillingClient ================== + * + *

Service Description: Retrieves GCP Console billing accounts and associates them with projects. + * + *

Sample for CloudBillingClient: + * + *

+ * 
+ * try (CloudBillingClient cloudBillingClient = CloudBillingClient.create()) {
+ *   BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]");
+ *   BillingAccount response = cloudBillingClient.getBillingAccount(name);
+ * }
+ * 
+ * 
+ * + * ================== CloudCatalogClient ================== + * + *

Service Description: A catalog of Google Cloud Platform services and SKUs. Provides pricing + * information and metadata on Google Cloud Platform services and SKUs. + * + *

Sample for CloudCatalogClient: + * + *

+ * 
+ * try (CloudCatalogClient cloudCatalogClient = CloudCatalogClient.create()) {
+ *
+ *   ListServicesPagedResponse response = cloudCatalogClient.listServices();
+ * }
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +package com.google.cloud.billing.v1; + +import javax.annotation.Generated; diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudBillingStub.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudBillingStub.java new file mode 100644 index 00000000..9de2659e --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudBillingStub.java @@ -0,0 +1,110 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.v1.stub; + +import static com.google.cloud.billing.v1.CloudBillingClient.ListBillingAccountsPagedResponse; +import static com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse; + +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.v1.BillingAccount; +import com.google.cloud.billing.v1.CreateBillingAccountRequest; +import com.google.cloud.billing.v1.GetBillingAccountRequest; +import com.google.cloud.billing.v1.GetProjectBillingInfoRequest; +import com.google.cloud.billing.v1.ListBillingAccountsRequest; +import com.google.cloud.billing.v1.ListBillingAccountsResponse; +import com.google.cloud.billing.v1.ListProjectBillingInfoRequest; +import com.google.cloud.billing.v1.ListProjectBillingInfoResponse; +import com.google.cloud.billing.v1.ProjectBillingInfo; +import com.google.cloud.billing.v1.UpdateBillingAccountRequest; +import com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Cloud Billing 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 CloudBillingStub implements BackgroundResource { + + public UnaryCallable getBillingAccountCallable() { + throw new UnsupportedOperationException("Not implemented: getBillingAccountCallable()"); + } + + public UnaryCallable + listBillingAccountsPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listBillingAccountsPagedCallable()"); + } + + public UnaryCallable + listBillingAccountsCallable() { + throw new UnsupportedOperationException("Not implemented: listBillingAccountsCallable()"); + } + + public UnaryCallable updateBillingAccountCallable() { + throw new UnsupportedOperationException("Not implemented: updateBillingAccountCallable()"); + } + + public UnaryCallable createBillingAccountCallable() { + throw new UnsupportedOperationException("Not implemented: createBillingAccountCallable()"); + } + + public UnaryCallable + listProjectBillingInfoPagedCallable() { + throw new UnsupportedOperationException( + "Not implemented: listProjectBillingInfoPagedCallable()"); + } + + public UnaryCallable + listProjectBillingInfoCallable() { + throw new UnsupportedOperationException("Not implemented: listProjectBillingInfoCallable()"); + } + + public UnaryCallable + getProjectBillingInfoCallable() { + throw new UnsupportedOperationException("Not implemented: getProjectBillingInfoCallable()"); + } + + public UnaryCallable + updateProjectBillingInfoCallable() { + throw new UnsupportedOperationException("Not implemented: updateProjectBillingInfoCallable()"); + } + + public UnaryCallable getIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: getIamPolicyCallable()"); + } + + public UnaryCallable setIamPolicyCallable() { + throw new UnsupportedOperationException("Not implemented: setIamPolicyCallable()"); + } + + public UnaryCallable + testIamPermissionsCallable() { + throw new UnsupportedOperationException("Not implemented: testIamPermissionsCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudBillingStubSettings.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudBillingStubSettings.java new file mode 100644 index 00000000..b039de4e --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudBillingStubSettings.java @@ -0,0 +1,683 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1.stub; + +import static com.google.cloud.billing.v1.CloudBillingClient.ListBillingAccountsPagedResponse; +import static com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse; + +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.v1.BillingAccount; +import com.google.cloud.billing.v1.CreateBillingAccountRequest; +import com.google.cloud.billing.v1.GetBillingAccountRequest; +import com.google.cloud.billing.v1.GetProjectBillingInfoRequest; +import com.google.cloud.billing.v1.ListBillingAccountsRequest; +import com.google.cloud.billing.v1.ListBillingAccountsResponse; +import com.google.cloud.billing.v1.ListProjectBillingInfoRequest; +import com.google.cloud.billing.v1.ListProjectBillingInfoResponse; +import com.google.cloud.billing.v1.ProjectBillingInfo; +import com.google.cloud.billing.v1.UpdateBillingAccountRequest; +import com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Lists; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import 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 CloudBillingStub}. + * + *

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

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

+ * 
+ * CloudBillingStubSettings.Builder cloudBillingSettingsBuilder =
+ *     CloudBillingStubSettings.newBuilder();
+ * cloudBillingSettingsBuilder.getBillingAccountSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * CloudBillingStubSettings cloudBillingSettings = cloudBillingSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class CloudBillingStubSettings 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 + getBillingAccountSettings; + private final PagedCallSettings< + ListBillingAccountsRequest, ListBillingAccountsResponse, ListBillingAccountsPagedResponse> + listBillingAccountsSettings; + private final UnaryCallSettings + updateBillingAccountSettings; + private final UnaryCallSettings + createBillingAccountSettings; + private final PagedCallSettings< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ListProjectBillingInfoPagedResponse> + listProjectBillingInfoSettings; + private final UnaryCallSettings + getProjectBillingInfoSettings; + private final UnaryCallSettings + updateProjectBillingInfoSettings; + private final UnaryCallSettings getIamPolicySettings; + private final UnaryCallSettings setIamPolicySettings; + private final UnaryCallSettings + testIamPermissionsSettings; + + /** Returns the object with the settings used for calls to getBillingAccount. */ + public UnaryCallSettings getBillingAccountSettings() { + return getBillingAccountSettings; + } + + /** Returns the object with the settings used for calls to listBillingAccounts. */ + public PagedCallSettings< + ListBillingAccountsRequest, ListBillingAccountsResponse, ListBillingAccountsPagedResponse> + listBillingAccountsSettings() { + return listBillingAccountsSettings; + } + + /** Returns the object with the settings used for calls to updateBillingAccount. */ + public UnaryCallSettings + updateBillingAccountSettings() { + return updateBillingAccountSettings; + } + + /** Returns the object with the settings used for calls to createBillingAccount. */ + public UnaryCallSettings + createBillingAccountSettings() { + return createBillingAccountSettings; + } + + /** Returns the object with the settings used for calls to listProjectBillingInfo. */ + public PagedCallSettings< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ListProjectBillingInfoPagedResponse> + listProjectBillingInfoSettings() { + return listProjectBillingInfoSettings; + } + + /** Returns the object with the settings used for calls to getProjectBillingInfo. */ + public UnaryCallSettings + getProjectBillingInfoSettings() { + return getProjectBillingInfoSettings; + } + + /** Returns the object with the settings used for calls to updateProjectBillingInfo. */ + public UnaryCallSettings + updateProjectBillingInfoSettings() { + return updateProjectBillingInfoSettings; + } + + /** Returns the object with the settings used for calls to getIamPolicy. */ + public UnaryCallSettings getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the object with the settings used for calls to setIamPolicy. */ + public UnaryCallSettings setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the object with the settings used for calls to testIamPermissions. */ + public UnaryCallSettings + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public CloudBillingStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcCloudBillingStub.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 "cloudbilling.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(CloudBillingStubSettings.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 CloudBillingStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + getBillingAccountSettings = settingsBuilder.getBillingAccountSettings().build(); + listBillingAccountsSettings = settingsBuilder.listBillingAccountsSettings().build(); + updateBillingAccountSettings = settingsBuilder.updateBillingAccountSettings().build(); + createBillingAccountSettings = settingsBuilder.createBillingAccountSettings().build(); + listProjectBillingInfoSettings = settingsBuilder.listProjectBillingInfoSettings().build(); + getProjectBillingInfoSettings = settingsBuilder.getProjectBillingInfoSettings().build(); + updateProjectBillingInfoSettings = settingsBuilder.updateProjectBillingInfoSettings().build(); + getIamPolicySettings = settingsBuilder.getIamPolicySettings().build(); + setIamPolicySettings = settingsBuilder.setIamPolicySettings().build(); + testIamPermissionsSettings = settingsBuilder.testIamPermissionsSettings().build(); + } + + private static final PagedListDescriptor< + ListBillingAccountsRequest, ListBillingAccountsResponse, BillingAccount> + LIST_BILLING_ACCOUNTS_PAGE_STR_DESC = + new PagedListDescriptor< + ListBillingAccountsRequest, ListBillingAccountsResponse, BillingAccount>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListBillingAccountsRequest injectToken( + ListBillingAccountsRequest payload, String token) { + return ListBillingAccountsRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListBillingAccountsRequest injectPageSize( + ListBillingAccountsRequest payload, int pageSize) { + return ListBillingAccountsRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListBillingAccountsRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListBillingAccountsResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListBillingAccountsResponse payload) { + return payload.getBillingAccountsList() != null + ? payload.getBillingAccountsList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor< + ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo> + LIST_PROJECT_BILLING_INFO_PAGE_STR_DESC = + new PagedListDescriptor< + ListProjectBillingInfoRequest, ListProjectBillingInfoResponse, ProjectBillingInfo>() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListProjectBillingInfoRequest injectToken( + ListProjectBillingInfoRequest payload, String token) { + return ListProjectBillingInfoRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListProjectBillingInfoRequest injectPageSize( + ListProjectBillingInfoRequest payload, int pageSize) { + return ListProjectBillingInfoRequest.newBuilder(payload) + .setPageSize(pageSize) + .build(); + } + + @Override + public Integer extractPageSize(ListProjectBillingInfoRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListProjectBillingInfoResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources( + ListProjectBillingInfoResponse payload) { + return payload.getProjectBillingInfoList() != null + ? payload.getProjectBillingInfoList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListBillingAccountsRequest, ListBillingAccountsResponse, ListBillingAccountsPagedResponse> + LIST_BILLING_ACCOUNTS_PAGE_STR_FACT = + new PagedListResponseFactory< + ListBillingAccountsRequest, + ListBillingAccountsResponse, + ListBillingAccountsPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListBillingAccountsRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext + pageContext = + PageContext.create( + callable, LIST_BILLING_ACCOUNTS_PAGE_STR_DESC, request, context); + return ListBillingAccountsPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ListProjectBillingInfoPagedResponse> + LIST_PROJECT_BILLING_INFO_PAGE_STR_FACT = + new PagedListResponseFactory< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ListProjectBillingInfoPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable + callable, + ListProjectBillingInfoRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ProjectBillingInfo> + pageContext = + PageContext.create( + callable, LIST_PROJECT_BILLING_INFO_PAGE_STR_DESC, request, context); + return ListProjectBillingInfoPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for CloudBillingStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final UnaryCallSettings.Builder + getBillingAccountSettings; + private final PagedCallSettings.Builder< + ListBillingAccountsRequest, + ListBillingAccountsResponse, + ListBillingAccountsPagedResponse> + listBillingAccountsSettings; + private final UnaryCallSettings.Builder + updateBillingAccountSettings; + private final UnaryCallSettings.Builder + createBillingAccountSettings; + private final PagedCallSettings.Builder< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ListProjectBillingInfoPagedResponse> + listProjectBillingInfoSettings; + private final UnaryCallSettings.Builder + getProjectBillingInfoSettings; + private final UnaryCallSettings.Builder + updateProjectBillingInfoSettings; + private final UnaryCallSettings.Builder getIamPolicySettings; + private final UnaryCallSettings.Builder setIamPolicySettings; + private final UnaryCallSettings.Builder + testIamPermissionsSettings; + + 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); + + getBillingAccountSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listBillingAccountsSettings = + PagedCallSettings.newBuilder(LIST_BILLING_ACCOUNTS_PAGE_STR_FACT); + + updateBillingAccountSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + createBillingAccountSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + listProjectBillingInfoSettings = + PagedCallSettings.newBuilder(LIST_PROJECT_BILLING_INFO_PAGE_STR_FACT); + + getProjectBillingInfoSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + updateProjectBillingInfoSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + getIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + setIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + testIamPermissionsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getBillingAccountSettings, + listBillingAccountsSettings, + updateBillingAccountSettings, + createBillingAccountSettings, + listProjectBillingInfoSettings, + getProjectBillingInfoSettings, + updateProjectBillingInfoSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + + 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 + .getBillingAccountSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listBillingAccountsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateBillingAccountSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .createBillingAccountSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listProjectBillingInfoSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getProjectBillingInfoSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .updateProjectBillingInfoSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .getIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .setIamPolicySettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .testIamPermissionsSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("non_idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(CloudBillingStubSettings settings) { + super(settings); + + getBillingAccountSettings = settings.getBillingAccountSettings.toBuilder(); + listBillingAccountsSettings = settings.listBillingAccountsSettings.toBuilder(); + updateBillingAccountSettings = settings.updateBillingAccountSettings.toBuilder(); + createBillingAccountSettings = settings.createBillingAccountSettings.toBuilder(); + listProjectBillingInfoSettings = settings.listProjectBillingInfoSettings.toBuilder(); + getProjectBillingInfoSettings = settings.getProjectBillingInfoSettings.toBuilder(); + updateProjectBillingInfoSettings = settings.updateProjectBillingInfoSettings.toBuilder(); + getIamPolicySettings = settings.getIamPolicySettings.toBuilder(); + setIamPolicySettings = settings.setIamPolicySettings.toBuilder(); + testIamPermissionsSettings = settings.testIamPermissionsSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of( + getBillingAccountSettings, + listBillingAccountsSettings, + updateBillingAccountSettings, + createBillingAccountSettings, + listProjectBillingInfoSettings, + getProjectBillingInfoSettings, + updateProjectBillingInfoSettings, + getIamPolicySettings, + setIamPolicySettings, + testIamPermissionsSettings); + } + + // 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 getBillingAccount. */ + public UnaryCallSettings.Builder + getBillingAccountSettings() { + return getBillingAccountSettings; + } + + /** Returns the builder for the settings used for calls to listBillingAccounts. */ + public PagedCallSettings.Builder< + ListBillingAccountsRequest, + ListBillingAccountsResponse, + ListBillingAccountsPagedResponse> + listBillingAccountsSettings() { + return listBillingAccountsSettings; + } + + /** Returns the builder for the settings used for calls to updateBillingAccount. */ + public UnaryCallSettings.Builder + updateBillingAccountSettings() { + return updateBillingAccountSettings; + } + + /** Returns the builder for the settings used for calls to createBillingAccount. */ + public UnaryCallSettings.Builder + createBillingAccountSettings() { + return createBillingAccountSettings; + } + + /** Returns the builder for the settings used for calls to listProjectBillingInfo. */ + public PagedCallSettings.Builder< + ListProjectBillingInfoRequest, + ListProjectBillingInfoResponse, + ListProjectBillingInfoPagedResponse> + listProjectBillingInfoSettings() { + return listProjectBillingInfoSettings; + } + + /** Returns the builder for the settings used for calls to getProjectBillingInfo. */ + public UnaryCallSettings.Builder + getProjectBillingInfoSettings() { + return getProjectBillingInfoSettings; + } + + /** Returns the builder for the settings used for calls to updateProjectBillingInfo. */ + public UnaryCallSettings.Builder + updateProjectBillingInfoSettings() { + return updateProjectBillingInfoSettings; + } + + /** Returns the builder for the settings used for calls to getIamPolicy. */ + public UnaryCallSettings.Builder getIamPolicySettings() { + return getIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to setIamPolicy. */ + public UnaryCallSettings.Builder setIamPolicySettings() { + return setIamPolicySettings; + } + + /** Returns the builder for the settings used for calls to testIamPermissions. */ + public UnaryCallSettings.Builder + testIamPermissionsSettings() { + return testIamPermissionsSettings; + } + + @Override + public CloudBillingStubSettings build() throws IOException { + return new CloudBillingStubSettings(this); + } + } +} diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudCatalogStub.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudCatalogStub.java new file mode 100644 index 00000000..07ea5394 --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudCatalogStub.java @@ -0,0 +1,58 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1.stub; + +import static com.google.cloud.billing.v1.CloudCatalogClient.ListServicesPagedResponse; +import static com.google.cloud.billing.v1.CloudCatalogClient.ListSkusPagedResponse; + +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.v1.ListServicesRequest; +import com.google.cloud.billing.v1.ListServicesResponse; +import com.google.cloud.billing.v1.ListSkusRequest; +import com.google.cloud.billing.v1.ListSkusResponse; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS +/** + * Base stub class for Cloud Billing 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 CloudCatalogStub implements BackgroundResource { + + public UnaryCallable listServicesPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listServicesPagedCallable()"); + } + + public UnaryCallable listServicesCallable() { + throw new UnsupportedOperationException("Not implemented: listServicesCallable()"); + } + + public UnaryCallable listSkusPagedCallable() { + throw new UnsupportedOperationException("Not implemented: listSkusPagedCallable()"); + } + + public UnaryCallable listSkusCallable() { + throw new UnsupportedOperationException("Not implemented: listSkusCallable()"); + } + + @Override + public abstract void close(); +} diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudCatalogStubSettings.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudCatalogStubSettings.java new file mode 100644 index 00000000..3e6217cb --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudCatalogStubSettings.java @@ -0,0 +1,418 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1.stub; + +import static com.google.cloud.billing.v1.CloudCatalogClient.ListServicesPagedResponse; +import static com.google.cloud.billing.v1.CloudCatalogClient.ListSkusPagedResponse; + +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.v1.ListServicesRequest; +import com.google.cloud.billing.v1.ListServicesResponse; +import com.google.cloud.billing.v1.ListSkusRequest; +import com.google.cloud.billing.v1.ListSkusResponse; +import com.google.cloud.billing.v1.Service; +import com.google.cloud.billing.v1.Sku; +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 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 CloudCatalogStub}. + * + *

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

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

+ * 
+ * CloudCatalogStubSettings.Builder cloudCatalogSettingsBuilder =
+ *     CloudCatalogStubSettings.newBuilder();
+ * cloudCatalogSettingsBuilder.listServicesSettings().getRetrySettings().toBuilder()
+ *     .setTotalTimeout(Duration.ofSeconds(30));
+ * CloudCatalogStubSettings cloudCatalogSettings = cloudCatalogSettingsBuilder.build();
+ * 
+ * 
+ */ +@Generated("by gapic-generator") +@BetaApi +public class CloudCatalogStubSettings 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 PagedCallSettings< + ListServicesRequest, ListServicesResponse, ListServicesPagedResponse> + listServicesSettings; + private final PagedCallSettings + listSkusSettings; + + /** Returns the object with the settings used for calls to listServices. */ + public PagedCallSettings + listServicesSettings() { + return listServicesSettings; + } + + /** Returns the object with the settings used for calls to listSkus. */ + public PagedCallSettings + listSkusSettings() { + return listSkusSettings; + } + + @BetaApi("A restructuring of stub classes is planned, so this may break in the future") + public CloudCatalogStub createStub() throws IOException { + if (getTransportChannelProvider() + .getTransportName() + .equals(GrpcTransportChannel.getGrpcTransportName())) { + return GrpcCloudCatalogStub.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 "cloudbilling.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(CloudCatalogStubSettings.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 CloudCatalogStubSettings(Builder settingsBuilder) throws IOException { + super(settingsBuilder); + + listServicesSettings = settingsBuilder.listServicesSettings().build(); + listSkusSettings = settingsBuilder.listSkusSettings().build(); + } + + private static final PagedListDescriptor + LIST_SERVICES_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListServicesRequest injectToken(ListServicesRequest payload, String token) { + return ListServicesRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListServicesRequest injectPageSize(ListServicesRequest payload, int pageSize) { + return ListServicesRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListServicesRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListServicesResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListServicesResponse payload) { + return payload.getServicesList() != null + ? payload.getServicesList() + : ImmutableList.of(); + } + }; + + private static final PagedListDescriptor + LIST_SKUS_PAGE_STR_DESC = + new PagedListDescriptor() { + @Override + public String emptyToken() { + return ""; + } + + @Override + public ListSkusRequest injectToken(ListSkusRequest payload, String token) { + return ListSkusRequest.newBuilder(payload).setPageToken(token).build(); + } + + @Override + public ListSkusRequest injectPageSize(ListSkusRequest payload, int pageSize) { + return ListSkusRequest.newBuilder(payload).setPageSize(pageSize).build(); + } + + @Override + public Integer extractPageSize(ListSkusRequest payload) { + return payload.getPageSize(); + } + + @Override + public String extractNextToken(ListSkusResponse payload) { + return payload.getNextPageToken(); + } + + @Override + public Iterable extractResources(ListSkusResponse payload) { + return payload.getSkusList() != null + ? payload.getSkusList() + : ImmutableList.of(); + } + }; + + private static final PagedListResponseFactory< + ListServicesRequest, ListServicesResponse, ListServicesPagedResponse> + LIST_SERVICES_PAGE_STR_FACT = + new PagedListResponseFactory< + ListServicesRequest, ListServicesResponse, ListServicesPagedResponse>() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListServicesRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SERVICES_PAGE_STR_DESC, request, context); + return ListServicesPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + private static final PagedListResponseFactory< + ListSkusRequest, ListSkusResponse, ListSkusPagedResponse> + LIST_SKUS_PAGE_STR_FACT = + new PagedListResponseFactory() { + @Override + public ApiFuture getFuturePagedResponse( + UnaryCallable callable, + ListSkusRequest request, + ApiCallContext context, + ApiFuture futureResponse) { + PageContext pageContext = + PageContext.create(callable, LIST_SKUS_PAGE_STR_DESC, request, context); + return ListSkusPagedResponse.createAsync(pageContext, futureResponse); + } + }; + + /** Builder for CloudCatalogStubSettings. */ + public static class Builder extends StubSettings.Builder { + private final ImmutableList> unaryMethodSettingsBuilders; + + private final PagedCallSettings.Builder< + ListServicesRequest, ListServicesResponse, ListServicesPagedResponse> + listServicesSettings; + private final PagedCallSettings.Builder< + ListSkusRequest, ListSkusResponse, ListSkusPagedResponse> + listSkusSettings; + + 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); + + listServicesSettings = PagedCallSettings.newBuilder(LIST_SERVICES_PAGE_STR_FACT); + + listSkusSettings = PagedCallSettings.newBuilder(LIST_SKUS_PAGE_STR_FACT); + + unaryMethodSettingsBuilders = + ImmutableList.>of(listServicesSettings, listSkusSettings); + + 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 + .listServicesSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + builder + .listSkusSettings() + .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent")) + .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default")); + + return builder; + } + + protected Builder(CloudCatalogStubSettings settings) { + super(settings); + + listServicesSettings = settings.listServicesSettings.toBuilder(); + listSkusSettings = settings.listSkusSettings.toBuilder(); + + unaryMethodSettingsBuilders = + ImmutableList.>of(listServicesSettings, listSkusSettings); + } + + // 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 listServices. */ + public PagedCallSettings.Builder< + ListServicesRequest, ListServicesResponse, ListServicesPagedResponse> + listServicesSettings() { + return listServicesSettings; + } + + /** Returns the builder for the settings used for calls to listSkus. */ + public PagedCallSettings.Builder + listSkusSettings() { + return listSkusSettings; + } + + @Override + public CloudCatalogStubSettings build() throws IOException { + return new CloudCatalogStubSettings(this); + } + } +} diff --git a/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudBillingCallableFactory.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudBillingCallableFactory.java new file mode 100644 index 00000000..75d49939 --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudBillingCallableFactory.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.v1.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 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 GrpcCloudBillingCallableFactory 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-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudBillingStub.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudBillingStub.java new file mode 100644 index 00000000..867bb64a --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudBillingStub.java @@ -0,0 +1,483 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1.stub; + +import static com.google.cloud.billing.v1.CloudBillingClient.ListBillingAccountsPagedResponse; +import static com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse; + +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.v1.BillingAccount; +import com.google.cloud.billing.v1.CreateBillingAccountRequest; +import com.google.cloud.billing.v1.GetBillingAccountRequest; +import com.google.cloud.billing.v1.GetProjectBillingInfoRequest; +import com.google.cloud.billing.v1.ListBillingAccountsRequest; +import com.google.cloud.billing.v1.ListBillingAccountsResponse; +import com.google.cloud.billing.v1.ListProjectBillingInfoRequest; +import com.google.cloud.billing.v1.ListProjectBillingInfoResponse; +import com.google.cloud.billing.v1.ProjectBillingInfo; +import com.google.cloud.billing.v1.UpdateBillingAccountRequest; +import com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest; +import com.google.common.collect.ImmutableMap; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import 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 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 GrpcCloudBillingStub extends CloudBillingStub { + + private static final MethodDescriptor + getBillingAccountMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/GetBillingAccount") + .setRequestMarshaller( + ProtoUtils.marshaller(GetBillingAccountRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(BillingAccount.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listBillingAccountsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/ListBillingAccounts") + .setRequestMarshaller( + ProtoUtils.marshaller(ListBillingAccountsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListBillingAccountsResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateBillingAccountMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/UpdateBillingAccount") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateBillingAccountRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(BillingAccount.getDefaultInstance())) + .build(); + private static final MethodDescriptor + createBillingAccountMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/CreateBillingAccount") + .setRequestMarshaller( + ProtoUtils.marshaller(CreateBillingAccountRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(BillingAccount.getDefaultInstance())) + .build(); + private static final MethodDescriptor< + ListProjectBillingInfoRequest, ListProjectBillingInfoResponse> + listProjectBillingInfoMethodDescriptor = + MethodDescriptor + .newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/ListProjectBillingInfo") + .setRequestMarshaller( + ProtoUtils.marshaller(ListProjectBillingInfoRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListProjectBillingInfoResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + getProjectBillingInfoMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/GetProjectBillingInfo") + .setRequestMarshaller( + ProtoUtils.marshaller(GetProjectBillingInfoRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ProjectBillingInfo.getDefaultInstance())) + .build(); + private static final MethodDescriptor + updateProjectBillingInfoMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/UpdateProjectBillingInfo") + .setRequestMarshaller( + ProtoUtils.marshaller(UpdateProjectBillingInfoRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ProjectBillingInfo.getDefaultInstance())) + .build(); + private static final MethodDescriptor getIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/GetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + private static final MethodDescriptor setIamPolicyMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/SetIamPolicy") + .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) + .build(); + private static final MethodDescriptor + testIamPermissionsMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudBilling/TestIamPermissions") + .setRequestMarshaller( + ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable getBillingAccountCallable; + private final UnaryCallable + listBillingAccountsCallable; + private final UnaryCallable + listBillingAccountsPagedCallable; + private final UnaryCallable + updateBillingAccountCallable; + private final UnaryCallable + createBillingAccountCallable; + private final UnaryCallable + listProjectBillingInfoCallable; + private final UnaryCallable + listProjectBillingInfoPagedCallable; + private final UnaryCallable + getProjectBillingInfoCallable; + private final UnaryCallable + updateProjectBillingInfoCallable; + private final UnaryCallable getIamPolicyCallable; + private final UnaryCallable setIamPolicyCallable; + private final UnaryCallable + testIamPermissionsCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcCloudBillingStub create(CloudBillingStubSettings settings) + throws IOException { + return new GrpcCloudBillingStub(settings, ClientContext.create(settings)); + } + + public static final GrpcCloudBillingStub create(ClientContext clientContext) throws IOException { + return new GrpcCloudBillingStub(CloudBillingStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcCloudBillingStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcCloudBillingStub( + CloudBillingStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcCloudBillingStub, 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 GrpcCloudBillingStub(CloudBillingStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcCloudBillingCallableFactory()); + } + + /** + * Constructs an instance of GrpcCloudBillingStub, 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 GrpcCloudBillingStub( + CloudBillingStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings getBillingAccountTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getBillingAccountMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetBillingAccountRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + listBillingAccountsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listBillingAccountsMethodDescriptor) + .build(); + GrpcCallSettings + updateBillingAccountTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateBillingAccountMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateBillingAccountRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + createBillingAccountTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(createBillingAccountMethodDescriptor) + .build(); + GrpcCallSettings + listProjectBillingInfoTransportSettings = + GrpcCallSettings + .newBuilder() + .setMethodDescriptor(listProjectBillingInfoMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListProjectBillingInfoRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + getProjectBillingInfoTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getProjectBillingInfoMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetProjectBillingInfoRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + updateProjectBillingInfoTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(updateProjectBillingInfoMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(UpdateProjectBillingInfoRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("name", String.valueOf(request.getName())); + return params.build(); + } + }) + .build(); + GrpcCallSettings getIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(getIamPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(GetIamPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + GrpcCallSettings setIamPolicyTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(setIamPolicyMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(SetIamPolicyRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + GrpcCallSettings + testIamPermissionsTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(testIamPermissionsMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(TestIamPermissionsRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("resource", String.valueOf(request.getResource())); + return params.build(); + } + }) + .build(); + + this.getBillingAccountCallable = + callableFactory.createUnaryCallable( + getBillingAccountTransportSettings, + settings.getBillingAccountSettings(), + clientContext); + this.listBillingAccountsCallable = + callableFactory.createUnaryCallable( + listBillingAccountsTransportSettings, + settings.listBillingAccountsSettings(), + clientContext); + this.listBillingAccountsPagedCallable = + callableFactory.createPagedCallable( + listBillingAccountsTransportSettings, + settings.listBillingAccountsSettings(), + clientContext); + this.updateBillingAccountCallable = + callableFactory.createUnaryCallable( + updateBillingAccountTransportSettings, + settings.updateBillingAccountSettings(), + clientContext); + this.createBillingAccountCallable = + callableFactory.createUnaryCallable( + createBillingAccountTransportSettings, + settings.createBillingAccountSettings(), + clientContext); + this.listProjectBillingInfoCallable = + callableFactory.createUnaryCallable( + listProjectBillingInfoTransportSettings, + settings.listProjectBillingInfoSettings(), + clientContext); + this.listProjectBillingInfoPagedCallable = + callableFactory.createPagedCallable( + listProjectBillingInfoTransportSettings, + settings.listProjectBillingInfoSettings(), + clientContext); + this.getProjectBillingInfoCallable = + callableFactory.createUnaryCallable( + getProjectBillingInfoTransportSettings, + settings.getProjectBillingInfoSettings(), + clientContext); + this.updateProjectBillingInfoCallable = + callableFactory.createUnaryCallable( + updateProjectBillingInfoTransportSettings, + settings.updateProjectBillingInfoSettings(), + clientContext); + this.getIamPolicyCallable = + callableFactory.createUnaryCallable( + getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); + this.setIamPolicyCallable = + callableFactory.createUnaryCallable( + setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); + this.testIamPermissionsCallable = + callableFactory.createUnaryCallable( + testIamPermissionsTransportSettings, + settings.testIamPermissionsSettings(), + clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable getBillingAccountCallable() { + return getBillingAccountCallable; + } + + public UnaryCallable + listBillingAccountsPagedCallable() { + return listBillingAccountsPagedCallable; + } + + public UnaryCallable + listBillingAccountsCallable() { + return listBillingAccountsCallable; + } + + public UnaryCallable updateBillingAccountCallable() { + return updateBillingAccountCallable; + } + + public UnaryCallable createBillingAccountCallable() { + return createBillingAccountCallable; + } + + public UnaryCallable + listProjectBillingInfoPagedCallable() { + return listProjectBillingInfoPagedCallable; + } + + public UnaryCallable + listProjectBillingInfoCallable() { + return listProjectBillingInfoCallable; + } + + public UnaryCallable + getProjectBillingInfoCallable() { + return getProjectBillingInfoCallable; + } + + public UnaryCallable + updateProjectBillingInfoCallable() { + return updateProjectBillingInfoCallable; + } + + public UnaryCallable getIamPolicyCallable() { + return getIamPolicyCallable; + } + + public UnaryCallable setIamPolicyCallable() { + return setIamPolicyCallable; + } + + public UnaryCallable + testIamPermissionsCallable() { + return testIamPermissionsCallable; + } + + @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-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudCatalogCallableFactory.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudCatalogCallableFactory.java new file mode 100644 index 00000000..81dae588 --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudCatalogCallableFactory.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.v1.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 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 GrpcCloudCatalogCallableFactory 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-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudCatalogStub.java b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudCatalogStub.java new file mode 100644 index 00000000..5c675159 --- /dev/null +++ b/google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudCatalogStub.java @@ -0,0 +1,195 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.v1.stub; + +import static com.google.cloud.billing.v1.CloudCatalogClient.ListServicesPagedResponse; +import static com.google.cloud.billing.v1.CloudCatalogClient.ListSkusPagedResponse; + +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.v1.ListServicesRequest; +import com.google.cloud.billing.v1.ListServicesResponse; +import com.google.cloud.billing.v1.ListSkusRequest; +import com.google.cloud.billing.v1.ListSkusResponse; +import com.google.common.collect.ImmutableMap; +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 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 GrpcCloudCatalogStub extends CloudCatalogStub { + + private static final MethodDescriptor + listServicesMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudCatalog/ListServices") + .setRequestMarshaller(ProtoUtils.marshaller(ListServicesRequest.getDefaultInstance())) + .setResponseMarshaller( + ProtoUtils.marshaller(ListServicesResponse.getDefaultInstance())) + .build(); + private static final MethodDescriptor + listSkusMethodDescriptor = + MethodDescriptor.newBuilder() + .setType(MethodDescriptor.MethodType.UNARY) + .setFullMethodName("google.cloud.billing.v1.CloudCatalog/ListSkus") + .setRequestMarshaller(ProtoUtils.marshaller(ListSkusRequest.getDefaultInstance())) + .setResponseMarshaller(ProtoUtils.marshaller(ListSkusResponse.getDefaultInstance())) + .build(); + + private final BackgroundResource backgroundResources; + + private final UnaryCallable listServicesCallable; + private final UnaryCallable + listServicesPagedCallable; + private final UnaryCallable listSkusCallable; + private final UnaryCallable listSkusPagedCallable; + + private final GrpcStubCallableFactory callableFactory; + + public static final GrpcCloudCatalogStub create(CloudCatalogStubSettings settings) + throws IOException { + return new GrpcCloudCatalogStub(settings, ClientContext.create(settings)); + } + + public static final GrpcCloudCatalogStub create(ClientContext clientContext) throws IOException { + return new GrpcCloudCatalogStub(CloudCatalogStubSettings.newBuilder().build(), clientContext); + } + + public static final GrpcCloudCatalogStub create( + ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { + return new GrpcCloudCatalogStub( + CloudCatalogStubSettings.newBuilder().build(), clientContext, callableFactory); + } + + /** + * Constructs an instance of GrpcCloudCatalogStub, 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 GrpcCloudCatalogStub(CloudCatalogStubSettings settings, ClientContext clientContext) + throws IOException { + this(settings, clientContext, new GrpcCloudCatalogCallableFactory()); + } + + /** + * Constructs an instance of GrpcCloudCatalogStub, 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 GrpcCloudCatalogStub( + CloudCatalogStubSettings settings, + ClientContext clientContext, + GrpcStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + GrpcCallSettings listServicesTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listServicesMethodDescriptor) + .build(); + GrpcCallSettings listSkusTransportSettings = + GrpcCallSettings.newBuilder() + .setMethodDescriptor(listSkusMethodDescriptor) + .setParamsExtractor( + new RequestParamsExtractor() { + @Override + public Map extract(ListSkusRequest request) { + ImmutableMap.Builder params = ImmutableMap.builder(); + params.put("parent", String.valueOf(request.getParent())); + return params.build(); + } + }) + .build(); + + this.listServicesCallable = + callableFactory.createUnaryCallable( + listServicesTransportSettings, settings.listServicesSettings(), clientContext); + this.listServicesPagedCallable = + callableFactory.createPagedCallable( + listServicesTransportSettings, settings.listServicesSettings(), clientContext); + this.listSkusCallable = + callableFactory.createUnaryCallable( + listSkusTransportSettings, settings.listSkusSettings(), clientContext); + this.listSkusPagedCallable = + callableFactory.createPagedCallable( + listSkusTransportSettings, settings.listSkusSettings(), clientContext); + + backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + public UnaryCallable listServicesPagedCallable() { + return listServicesPagedCallable; + } + + public UnaryCallable listServicesCallable() { + return listServicesCallable; + } + + public UnaryCallable listSkusPagedCallable() { + return listSkusPagedCallable; + } + + public UnaryCallable listSkusCallable() { + return listSkusCallable; + } + + @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-billing/src/test/java/com/google/cloud/billing/v1/CloudBillingClientTest.java b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/CloudBillingClientTest.java new file mode 100644 index 00000000..044b1605 --- /dev/null +++ b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/CloudBillingClientTest.java @@ -0,0 +1,557 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1; + +import static com.google.cloud.billing.v1.CloudBillingClient.ListBillingAccountsPagedResponse; +import static com.google.cloud.billing.v1.CloudBillingClient.ListProjectBillingInfoPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.resourcenames.ResourceName; +import com.google.common.collect.Lists; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.AbstractMessage; +import com.google.protobuf.ByteString; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.UUID; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class CloudBillingClientTest { + private static MockCloudBilling mockCloudBilling; + private static MockCloudCatalog mockCloudCatalog; + private static MockServiceHelper serviceHelper; + private CloudBillingClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockCloudBilling = new MockCloudBilling(); + mockCloudCatalog = new MockCloudCatalog(); + serviceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockCloudBilling, mockCloudCatalog)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + CloudBillingSettings settings = + CloudBillingSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CloudBillingClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void getBillingAccountTest() { + BillingAccountName name2 = BillingAccountName.of("[BILLING_ACCOUNT]"); + boolean open = true; + String displayName = "displayName1615086568"; + String masterBillingAccount = "masterBillingAccount1503143052"; + BillingAccount expectedResponse = + BillingAccount.newBuilder() + .setName(name2.toString()) + .setOpen(open) + .setDisplayName(displayName) + .setMasterBillingAccount(masterBillingAccount) + .build(); + mockCloudBilling.addResponse(expectedResponse); + + BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]"); + + BillingAccount actualResponse = client.getBillingAccount(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetBillingAccountRequest actualRequest = (GetBillingAccountRequest) actualRequests.get(0); + + Assert.assertEquals(name, BillingAccountName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getBillingAccountExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]"); + + client.getBillingAccount(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listBillingAccountsTest() { + String nextPageToken = ""; + BillingAccount billingAccountsElement = BillingAccount.newBuilder().build(); + List billingAccounts = Arrays.asList(billingAccountsElement); + ListBillingAccountsResponse expectedResponse = + ListBillingAccountsResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllBillingAccounts(billingAccounts) + .build(); + mockCloudBilling.addResponse(expectedResponse); + + ListBillingAccountsPagedResponse pagedListResponse = client.listBillingAccounts(); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getBillingAccountsList().get(0), resources.get(0)); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListBillingAccountsRequest actualRequest = (ListBillingAccountsRequest) actualRequests.get(0); + + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listBillingAccountsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + + client.listBillingAccounts(); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateBillingAccountTest() { + BillingAccountName name2 = BillingAccountName.of("[BILLING_ACCOUNT]"); + boolean open = true; + String displayName = "displayName1615086568"; + String masterBillingAccount = "masterBillingAccount1503143052"; + BillingAccount expectedResponse = + BillingAccount.newBuilder() + .setName(name2.toString()) + .setOpen(open) + .setDisplayName(displayName) + .setMasterBillingAccount(masterBillingAccount) + .build(); + mockCloudBilling.addResponse(expectedResponse); + + BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]"); + BillingAccount account = BillingAccount.newBuilder().build(); + + BillingAccount actualResponse = client.updateBillingAccount(name, account); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateBillingAccountRequest actualRequest = (UpdateBillingAccountRequest) actualRequests.get(0); + + Assert.assertEquals(name, BillingAccountName.parse(actualRequest.getName())); + Assert.assertEquals(account, actualRequest.getAccount()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateBillingAccountExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]"); + BillingAccount account = BillingAccount.newBuilder().build(); + + client.updateBillingAccount(name, account); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void createBillingAccountTest() { + BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]"); + boolean open = true; + String displayName = "displayName1615086568"; + String masterBillingAccount = "masterBillingAccount1503143052"; + BillingAccount expectedResponse = + BillingAccount.newBuilder() + .setName(name.toString()) + .setOpen(open) + .setDisplayName(displayName) + .setMasterBillingAccount(masterBillingAccount) + .build(); + mockCloudBilling.addResponse(expectedResponse); + + BillingAccount billingAccount = BillingAccount.newBuilder().build(); + + BillingAccount actualResponse = client.createBillingAccount(billingAccount); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + CreateBillingAccountRequest actualRequest = (CreateBillingAccountRequest) actualRequests.get(0); + + Assert.assertEquals(billingAccount, actualRequest.getBillingAccount()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void createBillingAccountExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + BillingAccount billingAccount = BillingAccount.newBuilder().build(); + + client.createBillingAccount(billingAccount); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listProjectBillingInfoTest() { + String nextPageToken = ""; + ProjectBillingInfo projectBillingInfoElement = ProjectBillingInfo.newBuilder().build(); + List projectBillingInfo = Arrays.asList(projectBillingInfoElement); + ListProjectBillingInfoResponse expectedResponse = + ListProjectBillingInfoResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllProjectBillingInfo(projectBillingInfo) + .build(); + mockCloudBilling.addResponse(expectedResponse); + + BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]"); + + ListProjectBillingInfoPagedResponse pagedListResponse = client.listProjectBillingInfo(name); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getProjectBillingInfoList().get(0), resources.get(0)); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListProjectBillingInfoRequest actualRequest = + (ListProjectBillingInfoRequest) actualRequests.get(0); + + Assert.assertEquals(name, BillingAccountName.parse(actualRequest.getName())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listProjectBillingInfoExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + BillingAccountName name = BillingAccountName.of("[BILLING_ACCOUNT]"); + + client.listProjectBillingInfo(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getProjectBillingInfoTest() { + String name2 = "name2-1052831874"; + String projectId = "projectId-1969970175"; + String billingAccountName = "billingAccountName-1056086879"; + boolean billingEnabled = false; + ProjectBillingInfo expectedResponse = + ProjectBillingInfo.newBuilder() + .setName(name2) + .setProjectId(projectId) + .setBillingAccountName(billingAccountName) + .setBillingEnabled(billingEnabled) + .build(); + mockCloudBilling.addResponse(expectedResponse); + + String name = "name3373707"; + + ProjectBillingInfo actualResponse = client.getProjectBillingInfo(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetProjectBillingInfoRequest actualRequest = + (GetProjectBillingInfoRequest) actualRequests.get(0); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getProjectBillingInfoExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + String name = "name3373707"; + + client.getProjectBillingInfo(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void updateProjectBillingInfoTest() { + String name2 = "name2-1052831874"; + String projectId = "projectId-1969970175"; + String billingAccountName = "billingAccountName-1056086879"; + boolean billingEnabled = false; + ProjectBillingInfo expectedResponse = + ProjectBillingInfo.newBuilder() + .setName(name2) + .setProjectId(projectId) + .setBillingAccountName(billingAccountName) + .setBillingEnabled(billingEnabled) + .build(); + mockCloudBilling.addResponse(expectedResponse); + + String name = "name3373707"; + ProjectBillingInfo projectBillingInfo = ProjectBillingInfo.newBuilder().build(); + + ProjectBillingInfo actualResponse = client.updateProjectBillingInfo(name, projectBillingInfo); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateProjectBillingInfoRequest actualRequest = + (UpdateProjectBillingInfoRequest) actualRequests.get(0); + + Assert.assertEquals(name, actualRequest.getName()); + Assert.assertEquals(projectBillingInfo, actualRequest.getProjectBillingInfo()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void updateProjectBillingInfoExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + String name = "name3373707"; + ProjectBillingInfo projectBillingInfo = ProjectBillingInfo.newBuilder().build(); + + client.updateProjectBillingInfo(name, projectBillingInfo); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void getIamPolicyTest() { + int version = 351608024; + ByteString etag = ByteString.copyFromUtf8("21"); + Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + mockCloudBilling.addResponse(expectedResponse); + + ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]"); + + Policy actualResponse = client.getIamPolicy(resource); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + GetIamPolicyRequest actualRequest = (GetIamPolicyRequest) actualRequests.get(0); + + Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void getIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]"); + + client.getIamPolicy(resource); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void setIamPolicyTest() { + int version = 351608024; + ByteString etag = ByteString.copyFromUtf8("21"); + Policy expectedResponse = Policy.newBuilder().setVersion(version).setEtag(etag).build(); + mockCloudBilling.addResponse(expectedResponse); + + ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]"); + Policy policy = Policy.newBuilder().build(); + + Policy actualResponse = client.setIamPolicy(resource, policy); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + SetIamPolicyRequest actualRequest = (SetIamPolicyRequest) actualRequests.get(0); + + Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(policy, actualRequest.getPolicy()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void setIamPolicyExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]"); + Policy policy = Policy.newBuilder().build(); + + client.setIamPolicy(resource, policy); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsTest() { + TestIamPermissionsResponse expectedResponse = TestIamPermissionsResponse.newBuilder().build(); + mockCloudBilling.addResponse(expectedResponse); + + ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]"); + List permissions = new ArrayList<>(); + + TestIamPermissionsResponse actualResponse = client.testIamPermissions(resource, permissions); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockCloudBilling.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + TestIamPermissionsRequest actualRequest = (TestIamPermissionsRequest) actualRequests.get(0); + + Assert.assertEquals(Objects.toString(resource), Objects.toString(actualRequest.getResource())); + Assert.assertEquals(permissions, actualRequest.getPermissionsList()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void testIamPermissionsExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudBilling.addException(exception); + + try { + ResourceName resource = BillingAccountName.of("[BILLING_ACCOUNT]"); + List permissions = new ArrayList<>(); + + client.testIamPermissions(resource, permissions); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/CloudCatalogClientTest.java b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/CloudCatalogClientTest.java new file mode 100644 index 00000000..373158cd --- /dev/null +++ b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/CloudCatalogClientTest.java @@ -0,0 +1,172 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1; + +import static com.google.cloud.billing.v1.CloudCatalogClient.ListServicesPagedResponse; +import static com.google.cloud.billing.v1.CloudCatalogClient.ListSkusPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.grpc.GaxGrpcProperties; +import com.google.api.gax.grpc.testing.LocalChannelProvider; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.api.gax.grpc.testing.MockServiceHelper; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.common.collect.Lists; +import com.google.protobuf.AbstractMessage; +import io.grpc.Status; +import io.grpc.StatusRuntimeException; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@javax.annotation.Generated("by GAPIC") +public class CloudCatalogClientTest { + private static MockCloudBilling mockCloudBilling; + private static MockCloudCatalog mockCloudCatalog; + private static MockServiceHelper serviceHelper; + private CloudCatalogClient client; + private LocalChannelProvider channelProvider; + + @BeforeClass + public static void startStaticServer() { + mockCloudBilling = new MockCloudBilling(); + mockCloudCatalog = new MockCloudCatalog(); + serviceHelper = + new MockServiceHelper( + UUID.randomUUID().toString(), + Arrays.asList(mockCloudBilling, mockCloudCatalog)); + serviceHelper.start(); + } + + @AfterClass + public static void stopServer() { + serviceHelper.stop(); + } + + @Before + public void setUp() throws IOException { + serviceHelper.reset(); + channelProvider = serviceHelper.createChannelProvider(); + CloudCatalogSettings settings = + CloudCatalogSettings.newBuilder() + .setTransportChannelProvider(channelProvider) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = CloudCatalogClient.create(settings); + } + + @After + public void tearDown() throws Exception { + client.close(); + } + + @Test + @SuppressWarnings("all") + public void listServicesTest() { + String nextPageToken = ""; + Service servicesElement = Service.newBuilder().build(); + List services = Arrays.asList(servicesElement); + ListServicesResponse expectedResponse = + ListServicesResponse.newBuilder() + .setNextPageToken(nextPageToken) + .addAllServices(services) + .build(); + mockCloudCatalog.addResponse(expectedResponse); + + ListServicesPagedResponse pagedListResponse = client.listServices(); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getServicesList().get(0), resources.get(0)); + + List actualRequests = mockCloudCatalog.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListServicesRequest actualRequest = (ListServicesRequest) actualRequests.get(0); + + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listServicesExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudCatalog.addException(exception); + + try { + + client.listServices(); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } + + @Test + @SuppressWarnings("all") + public void listSkusTest() { + String nextPageToken = ""; + Sku skusElement = Sku.newBuilder().build(); + List skus = Arrays.asList(skusElement); + ListSkusResponse expectedResponse = + ListSkusResponse.newBuilder().setNextPageToken(nextPageToken).addAllSkus(skus).build(); + mockCloudCatalog.addResponse(expectedResponse); + + ServiceName parent = ServiceName.of("[SERVICE]"); + + ListSkusPagedResponse pagedListResponse = client.listSkus(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getSkusList().get(0), resources.get(0)); + + List actualRequests = mockCloudCatalog.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + ListSkusRequest actualRequest = (ListSkusRequest) actualRequests.get(0); + + Assert.assertEquals(parent, ServiceName.parse(actualRequest.getParent())); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + @SuppressWarnings("all") + public void listSkusExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(Status.INVALID_ARGUMENT); + mockCloudCatalog.addException(exception); + + try { + ServiceName parent = ServiceName.of("[SERVICE]"); + + client.listSkus(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception + } + } +} diff --git a/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudBilling.java b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudBilling.java new file mode 100644 index 00000000..885ce003 --- /dev/null +++ b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudBilling.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.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockCloudBilling implements MockGrpcService { + private final MockCloudBillingImpl serviceImpl; + + public MockCloudBilling() { + serviceImpl = new MockCloudBillingImpl(); + } + + @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-billing/src/test/java/com/google/cloud/billing/v1/MockCloudBillingImpl.java b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudBillingImpl.java new file mode 100644 index 00000000..3dd56c77 --- /dev/null +++ b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudBillingImpl.java @@ -0,0 +1,215 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.billing.v1.CloudBillingGrpc.CloudBillingImplBase; +import com.google.iam.v1.GetIamPolicyRequest; +import com.google.iam.v1.Policy; +import com.google.iam.v1.SetIamPolicyRequest; +import com.google.iam.v1.TestIamPermissionsRequest; +import com.google.iam.v1.TestIamPermissionsResponse; +import com.google.protobuf.AbstractMessage; +import 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 MockCloudBillingImpl extends CloudBillingImplBase { + private List requests; + private Queue responses; + + public MockCloudBillingImpl() { + 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 getBillingAccount( + GetBillingAccountRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof BillingAccount) { + requests.add(request); + responseObserver.onNext((BillingAccount) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listBillingAccounts( + ListBillingAccountsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListBillingAccountsResponse) { + requests.add(request); + responseObserver.onNext((ListBillingAccountsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateBillingAccount( + UpdateBillingAccountRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof BillingAccount) { + requests.add(request); + responseObserver.onNext((BillingAccount) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void createBillingAccount( + CreateBillingAccountRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof BillingAccount) { + requests.add(request); + responseObserver.onNext((BillingAccount) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listProjectBillingInfo( + ListProjectBillingInfoRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListProjectBillingInfoResponse) { + requests.add(request); + responseObserver.onNext((ListProjectBillingInfoResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getProjectBillingInfo( + GetProjectBillingInfoRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ProjectBillingInfo) { + requests.add(request); + responseObserver.onNext((ProjectBillingInfo) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void updateProjectBillingInfo( + UpdateProjectBillingInfoRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ProjectBillingInfo) { + requests.add(request); + responseObserver.onNext((ProjectBillingInfo) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void getIamPolicy(GetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext((Policy) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void setIamPolicy(SetIamPolicyRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof Policy) { + requests.add(request); + responseObserver.onNext((Policy) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void testIamPermissions( + TestIamPermissionsRequest request, + StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof TestIamPermissionsResponse) { + requests.add(request); + responseObserver.onNext((TestIamPermissionsResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } +} diff --git a/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudCatalog.java b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudCatalog.java new file mode 100644 index 00000000..f3653d64 --- /dev/null +++ b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudCatalog.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.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.grpc.testing.MockGrpcService; +import com.google.protobuf.AbstractMessage; +import io.grpc.ServerServiceDefinition; +import java.util.List; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockCloudCatalog implements MockGrpcService { + private final MockCloudCatalogImpl serviceImpl; + + public MockCloudCatalog() { + serviceImpl = new MockCloudCatalogImpl(); + } + + @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-billing/src/test/java/com/google/cloud/billing/v1/MockCloudCatalogImpl.java b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudCatalogImpl.java new file mode 100644 index 00000000..009d5497 --- /dev/null +++ b/google-cloud-billing/src/test/java/com/google/cloud/billing/v1/MockCloudCatalogImpl.java @@ -0,0 +1,87 @@ +/* + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR 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.v1; + +import com.google.api.core.BetaApi; +import com.google.cloud.billing.v1.CloudCatalogGrpc.CloudCatalogImplBase; +import com.google.protobuf.AbstractMessage; +import io.grpc.stub.StreamObserver; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; + +@javax.annotation.Generated("by GAPIC") +@BetaApi +public class MockCloudCatalogImpl extends CloudCatalogImplBase { + private List requests; + private Queue responses; + + public MockCloudCatalogImpl() { + 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 listServices( + ListServicesRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListServicesResponse) { + requests.add(request); + responseObserver.onNext((ListServicesResponse) response); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError((Exception) response); + } else { + responseObserver.onError(new IllegalArgumentException("Unrecognized response type")); + } + } + + @Override + public void listSkus(ListSkusRequest request, StreamObserver responseObserver) { + Object response = responses.remove(); + if (response instanceof ListSkusResponse) { + requests.add(request); + responseObserver.onNext((ListSkusResponse) 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-billing-v1/pom.xml b/grpc-google-cloud-billing-v1/pom.xml new file mode 100644 index 00000000..8ea2836f --- /dev/null +++ b/grpc-google-cloud-billing-v1/pom.xml @@ -0,0 +1,60 @@ + + 4.0.0 + com.google.api.grpc + grpc-google-cloud-billing-v1 + 0.0.1-SNAPSHOT + grpc-google-cloud-billing-v1 + GRPC library for grpc-google-cloud-billing-v1 + + com.google.cloud + google-cloud-billing-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-billing-v1 + + + com.google.guava + guava + + + com.google.api.grpc + proto-google-iam-v1 + + + + + + java9 + + [9,) + + + + javax.annotation + javax.annotation-api + + + + + \ No newline at end of file diff --git a/grpc-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudBillingGrpc.java b/grpc-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudBillingGrpc.java new file mode 100644 index 00000000..5dc4232c --- /dev/null +++ b/grpc-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudBillingGrpc.java @@ -0,0 +1,1639 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.v1; + +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; + +/** + * + * + *
+ * Retrieves GCP Console billing accounts and associates them with projects.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/billing/v1/cloud_billing.proto") +public final class CloudBillingGrpc { + + private CloudBillingGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.billing.v1.CloudBilling"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.GetBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getGetBillingAccountMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetBillingAccount", + requestType = com.google.cloud.billing.v1.GetBillingAccountRequest.class, + responseType = com.google.cloud.billing.v1.BillingAccount.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.GetBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getGetBillingAccountMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.GetBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getGetBillingAccountMethod; + if ((getGetBillingAccountMethod = CloudBillingGrpc.getGetBillingAccountMethod) == null) { + synchronized (CloudBillingGrpc.class) { + if ((getGetBillingAccountMethod = CloudBillingGrpc.getGetBillingAccountMethod) == null) { + CloudBillingGrpc.getGetBillingAccountMethod = + getGetBillingAccountMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetBillingAccount")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.GetBillingAccountRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.BillingAccount.getDefaultInstance())) + .setSchemaDescriptor( + new CloudBillingMethodDescriptorSupplier("GetBillingAccount")) + .build(); + } + } + } + return getGetBillingAccountMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListBillingAccountsRequest, + com.google.cloud.billing.v1.ListBillingAccountsResponse> + getListBillingAccountsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListBillingAccounts", + requestType = com.google.cloud.billing.v1.ListBillingAccountsRequest.class, + responseType = com.google.cloud.billing.v1.ListBillingAccountsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListBillingAccountsRequest, + com.google.cloud.billing.v1.ListBillingAccountsResponse> + getListBillingAccountsMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListBillingAccountsRequest, + com.google.cloud.billing.v1.ListBillingAccountsResponse> + getListBillingAccountsMethod; + if ((getListBillingAccountsMethod = CloudBillingGrpc.getListBillingAccountsMethod) == null) { + synchronized (CloudBillingGrpc.class) { + if ((getListBillingAccountsMethod = CloudBillingGrpc.getListBillingAccountsMethod) + == null) { + CloudBillingGrpc.getListBillingAccountsMethod = + getListBillingAccountsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ListBillingAccounts")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ListBillingAccountsRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ListBillingAccountsResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new CloudBillingMethodDescriptorSupplier("ListBillingAccounts")) + .build(); + } + } + } + return getListBillingAccountsMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.UpdateBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getUpdateBillingAccountMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateBillingAccount", + requestType = com.google.cloud.billing.v1.UpdateBillingAccountRequest.class, + responseType = com.google.cloud.billing.v1.BillingAccount.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.UpdateBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getUpdateBillingAccountMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.UpdateBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getUpdateBillingAccountMethod; + if ((getUpdateBillingAccountMethod = CloudBillingGrpc.getUpdateBillingAccountMethod) == null) { + synchronized (CloudBillingGrpc.class) { + if ((getUpdateBillingAccountMethod = CloudBillingGrpc.getUpdateBillingAccountMethod) + == null) { + CloudBillingGrpc.getUpdateBillingAccountMethod = + getUpdateBillingAccountMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "UpdateBillingAccount")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.UpdateBillingAccountRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.BillingAccount.getDefaultInstance())) + .setSchemaDescriptor( + new CloudBillingMethodDescriptorSupplier("UpdateBillingAccount")) + .build(); + } + } + } + return getUpdateBillingAccountMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.CreateBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getCreateBillingAccountMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateBillingAccount", + requestType = com.google.cloud.billing.v1.CreateBillingAccountRequest.class, + responseType = com.google.cloud.billing.v1.BillingAccount.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.CreateBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getCreateBillingAccountMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.CreateBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount> + getCreateBillingAccountMethod; + if ((getCreateBillingAccountMethod = CloudBillingGrpc.getCreateBillingAccountMethod) == null) { + synchronized (CloudBillingGrpc.class) { + if ((getCreateBillingAccountMethod = CloudBillingGrpc.getCreateBillingAccountMethod) + == null) { + CloudBillingGrpc.getCreateBillingAccountMethod = + getCreateBillingAccountMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "CreateBillingAccount")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.CreateBillingAccountRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.BillingAccount.getDefaultInstance())) + .setSchemaDescriptor( + new CloudBillingMethodDescriptorSupplier("CreateBillingAccount")) + .build(); + } + } + } + return getCreateBillingAccountMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListProjectBillingInfoRequest, + com.google.cloud.billing.v1.ListProjectBillingInfoResponse> + getListProjectBillingInfoMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListProjectBillingInfo", + requestType = com.google.cloud.billing.v1.ListProjectBillingInfoRequest.class, + responseType = com.google.cloud.billing.v1.ListProjectBillingInfoResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListProjectBillingInfoRequest, + com.google.cloud.billing.v1.ListProjectBillingInfoResponse> + getListProjectBillingInfoMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListProjectBillingInfoRequest, + com.google.cloud.billing.v1.ListProjectBillingInfoResponse> + getListProjectBillingInfoMethod; + if ((getListProjectBillingInfoMethod = CloudBillingGrpc.getListProjectBillingInfoMethod) + == null) { + synchronized (CloudBillingGrpc.class) { + if ((getListProjectBillingInfoMethod = CloudBillingGrpc.getListProjectBillingInfoMethod) + == null) { + CloudBillingGrpc.getListProjectBillingInfoMethod = + getListProjectBillingInfoMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ListProjectBillingInfo")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ListProjectBillingInfoRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ListProjectBillingInfoResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new CloudBillingMethodDescriptorSupplier("ListProjectBillingInfo")) + .build(); + } + } + } + return getListProjectBillingInfoMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.GetProjectBillingInfoRequest, + com.google.cloud.billing.v1.ProjectBillingInfo> + getGetProjectBillingInfoMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetProjectBillingInfo", + requestType = com.google.cloud.billing.v1.GetProjectBillingInfoRequest.class, + responseType = com.google.cloud.billing.v1.ProjectBillingInfo.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.GetProjectBillingInfoRequest, + com.google.cloud.billing.v1.ProjectBillingInfo> + getGetProjectBillingInfoMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.GetProjectBillingInfoRequest, + com.google.cloud.billing.v1.ProjectBillingInfo> + getGetProjectBillingInfoMethod; + if ((getGetProjectBillingInfoMethod = CloudBillingGrpc.getGetProjectBillingInfoMethod) + == null) { + synchronized (CloudBillingGrpc.class) { + if ((getGetProjectBillingInfoMethod = CloudBillingGrpc.getGetProjectBillingInfoMethod) + == null) { + CloudBillingGrpc.getGetProjectBillingInfoMethod = + getGetProjectBillingInfoMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "GetProjectBillingInfo")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.GetProjectBillingInfoRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance())) + .setSchemaDescriptor( + new CloudBillingMethodDescriptorSupplier("GetProjectBillingInfo")) + .build(); + } + } + } + return getGetProjectBillingInfoMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest, + com.google.cloud.billing.v1.ProjectBillingInfo> + getUpdateProjectBillingInfoMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateProjectBillingInfo", + requestType = com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest.class, + responseType = com.google.cloud.billing.v1.ProjectBillingInfo.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest, + com.google.cloud.billing.v1.ProjectBillingInfo> + getUpdateProjectBillingInfoMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest, + com.google.cloud.billing.v1.ProjectBillingInfo> + getUpdateProjectBillingInfoMethod; + if ((getUpdateProjectBillingInfoMethod = CloudBillingGrpc.getUpdateProjectBillingInfoMethod) + == null) { + synchronized (CloudBillingGrpc.class) { + if ((getUpdateProjectBillingInfoMethod = CloudBillingGrpc.getUpdateProjectBillingInfoMethod) + == null) { + CloudBillingGrpc.getUpdateProjectBillingInfoMethod = + getUpdateProjectBillingInfoMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "UpdateProjectBillingInfo")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance())) + .setSchemaDescriptor( + new CloudBillingMethodDescriptorSupplier("UpdateProjectBillingInfo")) + .build(); + } + } + } + return getUpdateProjectBillingInfoMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> + getGetIamPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetIamPolicy", + requestType = com.google.iam.v1.GetIamPolicyRequest.class, + responseType = com.google.iam.v1.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy> + getGetIamPolicyMethod() { + io.grpc.MethodDescriptor + getGetIamPolicyMethod; + if ((getGetIamPolicyMethod = CloudBillingGrpc.getGetIamPolicyMethod) == null) { + synchronized (CloudBillingGrpc.class) { + if ((getGetIamPolicyMethod = CloudBillingGrpc.getGetIamPolicyMethod) == null) { + CloudBillingGrpc.getGetIamPolicyMethod = + getGetIamPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetIamPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.Policy.getDefaultInstance())) + .setSchemaDescriptor(new CloudBillingMethodDescriptorSupplier("GetIamPolicy")) + .build(); + } + } + } + return getGetIamPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> + getSetIamPolicyMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "SetIamPolicy", + requestType = com.google.iam.v1.SetIamPolicyRequest.class, + responseType = com.google.iam.v1.Policy.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy> + getSetIamPolicyMethod() { + io.grpc.MethodDescriptor + getSetIamPolicyMethod; + if ((getSetIamPolicyMethod = CloudBillingGrpc.getSetIamPolicyMethod) == null) { + synchronized (CloudBillingGrpc.class) { + if ((getSetIamPolicyMethod = CloudBillingGrpc.getSetIamPolicyMethod) == null) { + CloudBillingGrpc.getSetIamPolicyMethod = + getSetIamPolicyMethod = + io.grpc.MethodDescriptor + .newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetIamPolicy")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.SetIamPolicyRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.Policy.getDefaultInstance())) + .setSchemaDescriptor(new CloudBillingMethodDescriptorSupplier("SetIamPolicy")) + .build(); + } + } + } + return getSetIamPolicyMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "TestIamPermissions", + requestType = com.google.iam.v1.TestIamPermissionsRequest.class, + responseType = com.google.iam.v1.TestIamPermissionsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod() { + io.grpc.MethodDescriptor< + com.google.iam.v1.TestIamPermissionsRequest, + com.google.iam.v1.TestIamPermissionsResponse> + getTestIamPermissionsMethod; + if ((getTestIamPermissionsMethod = CloudBillingGrpc.getTestIamPermissionsMethod) == null) { + synchronized (CloudBillingGrpc.class) { + if ((getTestIamPermissionsMethod = CloudBillingGrpc.getTestIamPermissionsMethod) == null) { + CloudBillingGrpc.getTestIamPermissionsMethod = + getTestIamPermissionsMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "TestIamPermissions")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.TestIamPermissionsRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.iam.v1.TestIamPermissionsResponse.getDefaultInstance())) + .setSchemaDescriptor( + new CloudBillingMethodDescriptorSupplier("TestIamPermissions")) + .build(); + } + } + } + return getTestIamPermissionsMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static CloudBillingStub newStub(io.grpc.Channel channel) { + return new CloudBillingStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static CloudBillingBlockingStub newBlockingStub(io.grpc.Channel channel) { + return new CloudBillingBlockingStub(channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static CloudBillingFutureStub newFutureStub(io.grpc.Channel channel) { + return new CloudBillingFutureStub(channel); + } + + /** + * + * + *
+   * Retrieves GCP Console billing accounts and associates them with projects.
+   * 
+ */ + public abstract static class CloudBillingImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Gets information about a billing account. The current authenticated user
+     * must be a [viewer of the billing
+     * account](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void getBillingAccount( + com.google.cloud.billing.v1.GetBillingAccountRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetBillingAccountMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists the billing accounts that the current authenticated user has
+     * permission to
+     * [view](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void listBillingAccounts( + com.google.cloud.billing.v1.ListBillingAccountsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getListBillingAccountsMethod(), responseObserver); + } + + /** + * + * + *
+     * Updates a billing account's fields.
+     * Currently the only field that can be edited is `display_name`.
+     * The current authenticated user must have the `billing.accounts.update`
+     * IAM permission, which is typically given to the
+     * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access)
+     * of the billing account.
+     * 
+ */ + public void updateBillingAccount( + com.google.cloud.billing.v1.UpdateBillingAccountRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getUpdateBillingAccountMethod(), responseObserver); + } + + /** + * + * + *
+     * Creates a billing account.
+     * This method can only be used to create
+     * [billing subaccounts](https://cloud.google.com/billing/docs/concepts)
+     * by GCP resellers.
+     * When creating a subaccount, the current authenticated user must have the
+     * `billing.accounts.update` IAM permission on the master account, which is
+     * typically given to billing account
+     * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * This method will return an error if the master account has not been
+     * provisioned as a reseller account.
+     * 
+ */ + public void createBillingAccount( + com.google.cloud.billing.v1.CreateBillingAccountRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getCreateBillingAccountMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists the projects associated with a billing account. The current
+     * authenticated user must have the `billing.resourceAssociations.list` IAM
+     * permission, which is often given to billing account
+     * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void listProjectBillingInfo( + com.google.cloud.billing.v1.ListProjectBillingInfoRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getListProjectBillingInfoMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets the billing information for a project. The current authenticated user
+     * must have [permission to view the
+     * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
+     * ).
+     * 
+ */ + public void getProjectBillingInfo( + com.google.cloud.billing.v1.GetProjectBillingInfoRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getGetProjectBillingInfoMethod(), responseObserver); + } + + /** + * + * + *
+     * Sets or updates the billing account associated with a project. You specify
+     * the new billing account by setting the `billing_account_name` in the
+     * `ProjectBillingInfo` resource to the resource name of a billing account.
+     * Associating a project with an open billing account enables billing on the
+     * project and allows charges for resource usage. If the project already had a
+     * billing account, this method changes the billing account used for resource
+     * usage charges.
+     * *Note:* Incurred charges that have not yet been reported in the transaction
+     * history of the GCP Console might be billed to the new billing
+     * account, even if the charge occurred before the new billing account was
+     * assigned to the project.
+     * The current authenticated user must have ownership privileges for both the
+     * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
+     * ) and the [billing
+     * account](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * You can disable billing on the project by setting the
+     * `billing_account_name` field to empty. This action disassociates the
+     * current billing account from the project. Any billable activity of your
+     * in-use services will stop, and your application could stop functioning as
+     * expected. Any unbilled charges to date will be billed to the previously
+     * associated account. The current authenticated user must be either an owner
+     * of the project or an owner of the billing account for the project.
+     * Note that associating a project with a *closed* billing account will have
+     * much the same effect as disabling billing on the project: any paid
+     * resources used by the project will be shut down. Thus, unless you wish to
+     * disable billing, you should always call this method with the name of an
+     * *open* billing account.
+     * 
+ */ + public void updateProjectBillingInfo( + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getUpdateProjectBillingInfoMethod(), responseObserver); + } + + /** + * + * + *
+     * Gets the access control policy for a billing account.
+     * The caller must have the `billing.accounts.getIamPolicy` permission on the
+     * account, which is often given to billing account
+     * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getGetIamPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Sets the access control policy for a billing account. Replaces any existing
+     * policy.
+     * The caller must have the `billing.accounts.setIamPolicy` permission on the
+     * account, which is often given to billing account
+     * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void setIamPolicy( + com.google.iam.v1.SetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnimplementedUnaryCall(getSetIamPolicyMethod(), responseObserver); + } + + /** + * + * + *
+     * Tests the access control policy for a billing account. This method takes
+     * the resource and a set of permissions as input and returns the subset of
+     * the input permissions that the caller is allowed for that resource.
+     * 
+ */ + public void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getTestIamPermissionsMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getGetBillingAccountMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.GetBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount>( + this, METHODID_GET_BILLING_ACCOUNT))) + .addMethod( + getListBillingAccountsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.ListBillingAccountsRequest, + com.google.cloud.billing.v1.ListBillingAccountsResponse>( + this, METHODID_LIST_BILLING_ACCOUNTS))) + .addMethod( + getUpdateBillingAccountMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.UpdateBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount>( + this, METHODID_UPDATE_BILLING_ACCOUNT))) + .addMethod( + getCreateBillingAccountMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.CreateBillingAccountRequest, + com.google.cloud.billing.v1.BillingAccount>( + this, METHODID_CREATE_BILLING_ACCOUNT))) + .addMethod( + getListProjectBillingInfoMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.ListProjectBillingInfoRequest, + com.google.cloud.billing.v1.ListProjectBillingInfoResponse>( + this, METHODID_LIST_PROJECT_BILLING_INFO))) + .addMethod( + getGetProjectBillingInfoMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.GetProjectBillingInfoRequest, + com.google.cloud.billing.v1.ProjectBillingInfo>( + this, METHODID_GET_PROJECT_BILLING_INFO))) + .addMethod( + getUpdateProjectBillingInfoMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest, + com.google.cloud.billing.v1.ProjectBillingInfo>( + this, METHODID_UPDATE_PROJECT_BILLING_INFO))) + .addMethod( + getGetIamPolicyMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>( + this, METHODID_GET_IAM_POLICY))) + .addMethod( + getSetIamPolicyMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>( + this, METHODID_SET_IAM_POLICY))) + .addMethod( + getTestIamPermissionsMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.iam.v1.TestIamPermissionsRequest, + com.google.iam.v1.TestIamPermissionsResponse>( + this, METHODID_TEST_IAM_PERMISSIONS))) + .build(); + } + } + + /** + * + * + *
+   * Retrieves GCP Console billing accounts and associates them with projects.
+   * 
+ */ + public static final class CloudBillingStub extends io.grpc.stub.AbstractStub { + private CloudBillingStub(io.grpc.Channel channel) { + super(channel); + } + + private CloudBillingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CloudBillingStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CloudBillingStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about a billing account. The current authenticated user
+     * must be a [viewer of the billing
+     * account](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void getBillingAccount( + com.google.cloud.billing.v1.GetBillingAccountRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetBillingAccountMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists the billing accounts that the current authenticated user has
+     * permission to
+     * [view](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void listBillingAccounts( + com.google.cloud.billing.v1.ListBillingAccountsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListBillingAccountsMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Updates a billing account's fields.
+     * Currently the only field that can be edited is `display_name`.
+     * The current authenticated user must have the `billing.accounts.update`
+     * IAM permission, which is typically given to the
+     * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access)
+     * of the billing account.
+     * 
+ */ + public void updateBillingAccount( + com.google.cloud.billing.v1.UpdateBillingAccountRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateBillingAccountMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Creates a billing account.
+     * This method can only be used to create
+     * [billing subaccounts](https://cloud.google.com/billing/docs/concepts)
+     * by GCP resellers.
+     * When creating a subaccount, the current authenticated user must have the
+     * `billing.accounts.update` IAM permission on the master account, which is
+     * typically given to billing account
+     * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * This method will return an error if the master account has not been
+     * provisioned as a reseller account.
+     * 
+ */ + public void createBillingAccount( + com.google.cloud.billing.v1.CreateBillingAccountRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getCreateBillingAccountMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists the projects associated with a billing account. The current
+     * authenticated user must have the `billing.resourceAssociations.list` IAM
+     * permission, which is often given to billing account
+     * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void listProjectBillingInfo( + com.google.cloud.billing.v1.ListProjectBillingInfoRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListProjectBillingInfoMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets the billing information for a project. The current authenticated user
+     * must have [permission to view the
+     * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
+     * ).
+     * 
+ */ + public void getProjectBillingInfo( + com.google.cloud.billing.v1.GetProjectBillingInfoRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetProjectBillingInfoMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Sets or updates the billing account associated with a project. You specify
+     * the new billing account by setting the `billing_account_name` in the
+     * `ProjectBillingInfo` resource to the resource name of a billing account.
+     * Associating a project with an open billing account enables billing on the
+     * project and allows charges for resource usage. If the project already had a
+     * billing account, this method changes the billing account used for resource
+     * usage charges.
+     * *Note:* Incurred charges that have not yet been reported in the transaction
+     * history of the GCP Console might be billed to the new billing
+     * account, even if the charge occurred before the new billing account was
+     * assigned to the project.
+     * The current authenticated user must have ownership privileges for both the
+     * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
+     * ) and the [billing
+     * account](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * You can disable billing on the project by setting the
+     * `billing_account_name` field to empty. This action disassociates the
+     * current billing account from the project. Any billable activity of your
+     * in-use services will stop, and your application could stop functioning as
+     * expected. Any unbilled charges to date will be billed to the previously
+     * associated account. The current authenticated user must be either an owner
+     * of the project or an owner of the billing account for the project.
+     * Note that associating a project with a *closed* billing account will have
+     * much the same effect as disabling billing on the project: any paid
+     * resources used by the project will be shut down. Thus, unless you wish to
+     * disable billing, you should always call this method with the name of an
+     * *open* billing account.
+     * 
+ */ + public void updateProjectBillingInfo( + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getUpdateProjectBillingInfoMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Gets the access control policy for a billing account.
+     * The caller must have the `billing.accounts.getIamPolicy` permission on the
+     * account, which is often given to billing account
+     * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void getIamPolicy( + com.google.iam.v1.GetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Sets the access control policy for a billing account. Replaces any existing
+     * policy.
+     * The caller must have the `billing.accounts.setIamPolicy` permission on the
+     * account, which is often given to billing account
+     * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public void setIamPolicy( + com.google.iam.v1.SetIamPolicyRequest request, + io.grpc.stub.StreamObserver responseObserver) { + asyncUnaryCall( + getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Tests the access control policy for a billing account. This method takes
+     * the resource and a set of permissions as input and returns the subset of
+     * the input permissions that the caller is allowed for that resource.
+     * 
+ */ + public void testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), + request, + responseObserver); + } + } + + /** + * + * + *
+   * Retrieves GCP Console billing accounts and associates them with projects.
+   * 
+ */ + public static final class CloudBillingBlockingStub + extends io.grpc.stub.AbstractStub { + private CloudBillingBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private CloudBillingBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CloudBillingBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CloudBillingBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about a billing account. The current authenticated user
+     * must be a [viewer of the billing
+     * account](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.cloud.billing.v1.BillingAccount getBillingAccount( + com.google.cloud.billing.v1.GetBillingAccountRequest request) { + return blockingUnaryCall( + getChannel(), getGetBillingAccountMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists the billing accounts that the current authenticated user has
+     * permission to
+     * [view](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.cloud.billing.v1.ListBillingAccountsResponse listBillingAccounts( + com.google.cloud.billing.v1.ListBillingAccountsRequest request) { + return blockingUnaryCall( + getChannel(), getListBillingAccountsMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Updates a billing account's fields.
+     * Currently the only field that can be edited is `display_name`.
+     * The current authenticated user must have the `billing.accounts.update`
+     * IAM permission, which is typically given to the
+     * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access)
+     * of the billing account.
+     * 
+ */ + public com.google.cloud.billing.v1.BillingAccount updateBillingAccount( + com.google.cloud.billing.v1.UpdateBillingAccountRequest request) { + return blockingUnaryCall( + getChannel(), getUpdateBillingAccountMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Creates a billing account.
+     * This method can only be used to create
+     * [billing subaccounts](https://cloud.google.com/billing/docs/concepts)
+     * by GCP resellers.
+     * When creating a subaccount, the current authenticated user must have the
+     * `billing.accounts.update` IAM permission on the master account, which is
+     * typically given to billing account
+     * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * This method will return an error if the master account has not been
+     * provisioned as a reseller account.
+     * 
+ */ + public com.google.cloud.billing.v1.BillingAccount createBillingAccount( + com.google.cloud.billing.v1.CreateBillingAccountRequest request) { + return blockingUnaryCall( + getChannel(), getCreateBillingAccountMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists the projects associated with a billing account. The current
+     * authenticated user must have the `billing.resourceAssociations.list` IAM
+     * permission, which is often given to billing account
+     * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.cloud.billing.v1.ListProjectBillingInfoResponse listProjectBillingInfo( + com.google.cloud.billing.v1.ListProjectBillingInfoRequest request) { + return blockingUnaryCall( + getChannel(), getListProjectBillingInfoMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets the billing information for a project. The current authenticated user
+     * must have [permission to view the
+     * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
+     * ).
+     * 
+ */ + public com.google.cloud.billing.v1.ProjectBillingInfo getProjectBillingInfo( + com.google.cloud.billing.v1.GetProjectBillingInfoRequest request) { + return blockingUnaryCall( + getChannel(), getGetProjectBillingInfoMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Sets or updates the billing account associated with a project. You specify
+     * the new billing account by setting the `billing_account_name` in the
+     * `ProjectBillingInfo` resource to the resource name of a billing account.
+     * Associating a project with an open billing account enables billing on the
+     * project and allows charges for resource usage. If the project already had a
+     * billing account, this method changes the billing account used for resource
+     * usage charges.
+     * *Note:* Incurred charges that have not yet been reported in the transaction
+     * history of the GCP Console might be billed to the new billing
+     * account, even if the charge occurred before the new billing account was
+     * assigned to the project.
+     * The current authenticated user must have ownership privileges for both the
+     * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
+     * ) and the [billing
+     * account](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * You can disable billing on the project by setting the
+     * `billing_account_name` field to empty. This action disassociates the
+     * current billing account from the project. Any billable activity of your
+     * in-use services will stop, and your application could stop functioning as
+     * expected. Any unbilled charges to date will be billed to the previously
+     * associated account. The current authenticated user must be either an owner
+     * of the project or an owner of the billing account for the project.
+     * Note that associating a project with a *closed* billing account will have
+     * much the same effect as disabling billing on the project: any paid
+     * resources used by the project will be shut down. Thus, unless you wish to
+     * disable billing, you should always call this method with the name of an
+     * *open* billing account.
+     * 
+ */ + public com.google.cloud.billing.v1.ProjectBillingInfo updateProjectBillingInfo( + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest request) { + return blockingUnaryCall( + getChannel(), getUpdateProjectBillingInfoMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Gets the access control policy for a billing account.
+     * The caller must have the `billing.accounts.getIamPolicy` permission on the
+     * account, which is often given to billing account
+     * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return blockingUnaryCall(getChannel(), getGetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Sets the access control policy for a billing account. Replaces any existing
+     * policy.
+     * The caller must have the `billing.accounts.setIamPolicy` permission on the
+     * account, which is often given to billing account
+     * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return blockingUnaryCall(getChannel(), getSetIamPolicyMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Tests the access control policy for a billing account. This method takes
+     * the resource and a set of permissions as input and returns the subset of
+     * the input permissions that the caller is allowed for that resource.
+     * 
+ */ + public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions( + com.google.iam.v1.TestIamPermissionsRequest request) { + return blockingUnaryCall( + getChannel(), getTestIamPermissionsMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * Retrieves GCP Console billing accounts and associates them with projects.
+   * 
+ */ + public static final class CloudBillingFutureStub + extends io.grpc.stub.AbstractStub { + private CloudBillingFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private CloudBillingFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CloudBillingFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CloudBillingFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Gets information about a billing account. The current authenticated user
+     * must be a [viewer of the billing
+     * account](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.BillingAccount> + getBillingAccount(com.google.cloud.billing.v1.GetBillingAccountRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetBillingAccountMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists the billing accounts that the current authenticated user has
+     * permission to
+     * [view](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.ListBillingAccountsResponse> + listBillingAccounts(com.google.cloud.billing.v1.ListBillingAccountsRequest request) { + return futureUnaryCall( + getChannel().newCall(getListBillingAccountsMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Updates a billing account's fields.
+     * Currently the only field that can be edited is `display_name`.
+     * The current authenticated user must have the `billing.accounts.update`
+     * IAM permission, which is typically given to the
+     * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access)
+     * of the billing account.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.BillingAccount> + updateBillingAccount(com.google.cloud.billing.v1.UpdateBillingAccountRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateBillingAccountMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Creates a billing account.
+     * This method can only be used to create
+     * [billing subaccounts](https://cloud.google.com/billing/docs/concepts)
+     * by GCP resellers.
+     * When creating a subaccount, the current authenticated user must have the
+     * `billing.accounts.update` IAM permission on the master account, which is
+     * typically given to billing account
+     * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * This method will return an error if the master account has not been
+     * provisioned as a reseller account.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.BillingAccount> + createBillingAccount(com.google.cloud.billing.v1.CreateBillingAccountRequest request) { + return futureUnaryCall( + getChannel().newCall(getCreateBillingAccountMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists the projects associated with a billing account. The current
+     * authenticated user must have the `billing.resourceAssociations.list` IAM
+     * permission, which is often given to billing account
+     * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.ListProjectBillingInfoResponse> + listProjectBillingInfo(com.google.cloud.billing.v1.ListProjectBillingInfoRequest request) { + return futureUnaryCall( + getChannel().newCall(getListProjectBillingInfoMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets the billing information for a project. The current authenticated user
+     * must have [permission to view the
+     * project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
+     * ).
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.ProjectBillingInfo> + getProjectBillingInfo(com.google.cloud.billing.v1.GetProjectBillingInfoRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetProjectBillingInfoMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Sets or updates the billing account associated with a project. You specify
+     * the new billing account by setting the `billing_account_name` in the
+     * `ProjectBillingInfo` resource to the resource name of a billing account.
+     * Associating a project with an open billing account enables billing on the
+     * project and allows charges for resource usage. If the project already had a
+     * billing account, this method changes the billing account used for resource
+     * usage charges.
+     * *Note:* Incurred charges that have not yet been reported in the transaction
+     * history of the GCP Console might be billed to the new billing
+     * account, even if the charge occurred before the new billing account was
+     * assigned to the project.
+     * The current authenticated user must have ownership privileges for both the
+     * [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo
+     * ) and the [billing
+     * account](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * You can disable billing on the project by setting the
+     * `billing_account_name` field to empty. This action disassociates the
+     * current billing account from the project. Any billable activity of your
+     * in-use services will stop, and your application could stop functioning as
+     * expected. Any unbilled charges to date will be billed to the previously
+     * associated account. The current authenticated user must be either an owner
+     * of the project or an owner of the billing account for the project.
+     * Note that associating a project with a *closed* billing account will have
+     * much the same effect as disabling billing on the project: any paid
+     * resources used by the project will be shut down. Thus, unless you wish to
+     * disable billing, you should always call this method with the name of an
+     * *open* billing account.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.ProjectBillingInfo> + updateProjectBillingInfo( + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest request) { + return futureUnaryCall( + getChannel().newCall(getUpdateProjectBillingInfoMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Gets the access control policy for a billing account.
+     * The caller must have the `billing.accounts.getIamPolicy` permission on the
+     * account, which is often given to billing account
+     * [viewers](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) { + return futureUnaryCall( + getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Sets the access control policy for a billing account. Replaces any existing
+     * policy.
+     * The caller must have the `billing.accounts.setIamPolicy` permission on the
+     * account, which is often given to billing account
+     * [administrators](https://cloud.google.com/billing/docs/how-to/billing-access).
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) { + return futureUnaryCall( + getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Tests the access control policy for a billing account. This method takes
+     * the resource and a set of permissions as input and returns the subset of
+     * the input permissions that the caller is allowed for that resource.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.iam.v1.TestIamPermissionsResponse> + testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) { + return futureUnaryCall( + getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_GET_BILLING_ACCOUNT = 0; + private static final int METHODID_LIST_BILLING_ACCOUNTS = 1; + private static final int METHODID_UPDATE_BILLING_ACCOUNT = 2; + private static final int METHODID_CREATE_BILLING_ACCOUNT = 3; + private static final int METHODID_LIST_PROJECT_BILLING_INFO = 4; + private static final int METHODID_GET_PROJECT_BILLING_INFO = 5; + private static final int METHODID_UPDATE_PROJECT_BILLING_INFO = 6; + private static final int METHODID_GET_IAM_POLICY = 7; + private static final int METHODID_SET_IAM_POLICY = 8; + private static final int METHODID_TEST_IAM_PERMISSIONS = 9; + + 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 CloudBillingImplBase serviceImpl; + private final int methodId; + + MethodHandlers(CloudBillingImplBase serviceImpl, int methodId) { + this.serviceImpl = serviceImpl; + this.methodId = methodId; + } + + @java.lang.Override + @java.lang.SuppressWarnings("unchecked") + public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) { + switch (methodId) { + case METHODID_GET_BILLING_ACCOUNT: + serviceImpl.getBillingAccount( + (com.google.cloud.billing.v1.GetBillingAccountRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_BILLING_ACCOUNTS: + serviceImpl.listBillingAccounts( + (com.google.cloud.billing.v1.ListBillingAccountsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_BILLING_ACCOUNT: + serviceImpl.updateBillingAccount( + (com.google.cloud.billing.v1.UpdateBillingAccountRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_CREATE_BILLING_ACCOUNT: + serviceImpl.createBillingAccount( + (com.google.cloud.billing.v1.CreateBillingAccountRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_PROJECT_BILLING_INFO: + serviceImpl.listProjectBillingInfo( + (com.google.cloud.billing.v1.ListProjectBillingInfoRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.billing.v1.ListProjectBillingInfoResponse>) + responseObserver); + break; + case METHODID_GET_PROJECT_BILLING_INFO: + serviceImpl.getProjectBillingInfo( + (com.google.cloud.billing.v1.GetProjectBillingInfoRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_UPDATE_PROJECT_BILLING_INFO: + serviceImpl.updateProjectBillingInfo( + (com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_IAM_POLICY: + serviceImpl.getIamPolicy( + (com.google.iam.v1.GetIamPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_SET_IAM_POLICY: + serviceImpl.setIamPolicy( + (com.google.iam.v1.SetIamPolicyRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_TEST_IAM_PERMISSIONS: + serviceImpl.testIamPermissions( + (com.google.iam.v1.TestIamPermissionsRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + 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 CloudBillingBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + CloudBillingBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("CloudBilling"); + } + } + + private static final class CloudBillingFileDescriptorSupplier + extends CloudBillingBaseDescriptorSupplier { + CloudBillingFileDescriptorSupplier() {} + } + + private static final class CloudBillingMethodDescriptorSupplier + extends CloudBillingBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + CloudBillingMethodDescriptorSupplier(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 (CloudBillingGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new CloudBillingFileDescriptorSupplier()) + .addMethod(getGetBillingAccountMethod()) + .addMethod(getListBillingAccountsMethod()) + .addMethod(getUpdateBillingAccountMethod()) + .addMethod(getCreateBillingAccountMethod()) + .addMethod(getListProjectBillingInfoMethod()) + .addMethod(getGetProjectBillingInfoMethod()) + .addMethod(getUpdateProjectBillingInfoMethod()) + .addMethod(getGetIamPolicyMethod()) + .addMethod(getSetIamPolicyMethod()) + .addMethod(getTestIamPermissionsMethod()) + .build(); + } + } + } + return result; + } +} diff --git a/grpc-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudCatalogGrpc.java b/grpc-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudCatalogGrpc.java new file mode 100644 index 00000000..521dad11 --- /dev/null +++ b/grpc-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudCatalogGrpc.java @@ -0,0 +1,470 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.google.cloud.billing.v1; + +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; + +/** + * + * + *
+ * A catalog of Google Cloud Platform services and SKUs.
+ * Provides pricing information and metadata on Google Cloud Platform services
+ * and SKUs.
+ * 
+ */ +@javax.annotation.Generated( + value = "by gRPC proto compiler", + comments = "Source: google/cloud/billing/v1/cloud_catalog.proto") +public final class CloudCatalogGrpc { + + private CloudCatalogGrpc() {} + + public static final String SERVICE_NAME = "google.cloud.billing.v1.CloudCatalog"; + + // Static method descriptors that strictly reflect the proto. + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListServicesRequest, + com.google.cloud.billing.v1.ListServicesResponse> + getListServicesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListServices", + requestType = com.google.cloud.billing.v1.ListServicesRequest.class, + responseType = com.google.cloud.billing.v1.ListServicesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListServicesRequest, + com.google.cloud.billing.v1.ListServicesResponse> + getListServicesMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListServicesRequest, + com.google.cloud.billing.v1.ListServicesResponse> + getListServicesMethod; + if ((getListServicesMethod = CloudCatalogGrpc.getListServicesMethod) == null) { + synchronized (CloudCatalogGrpc.class) { + if ((getListServicesMethod = CloudCatalogGrpc.getListServicesMethod) == null) { + CloudCatalogGrpc.getListServicesMethod = + getListServicesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListServices")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ListServicesRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ListServicesResponse + .getDefaultInstance())) + .setSchemaDescriptor(new CloudCatalogMethodDescriptorSupplier("ListServices")) + .build(); + } + } + } + return getListServicesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListSkusRequest, com.google.cloud.billing.v1.ListSkusResponse> + getListSkusMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListSkus", + requestType = com.google.cloud.billing.v1.ListSkusRequest.class, + responseType = com.google.cloud.billing.v1.ListSkusResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListSkusRequest, com.google.cloud.billing.v1.ListSkusResponse> + getListSkusMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.billing.v1.ListSkusRequest, + com.google.cloud.billing.v1.ListSkusResponse> + getListSkusMethod; + if ((getListSkusMethod = CloudCatalogGrpc.getListSkusMethod) == null) { + synchronized (CloudCatalogGrpc.class) { + if ((getListSkusMethod = CloudCatalogGrpc.getListSkusMethod) == null) { + CloudCatalogGrpc.getListSkusMethod = + getListSkusMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListSkus")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ListSkusRequest.getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.billing.v1.ListSkusResponse.getDefaultInstance())) + .setSchemaDescriptor(new CloudCatalogMethodDescriptorSupplier("ListSkus")) + .build(); + } + } + } + return getListSkusMethod; + } + + /** Creates a new async stub that supports all call types for the service */ + public static CloudCatalogStub newStub(io.grpc.Channel channel) { + return new CloudCatalogStub(channel); + } + + /** + * Creates a new blocking-style stub that supports unary and streaming output calls on the service + */ + public static CloudCatalogBlockingStub newBlockingStub(io.grpc.Channel channel) { + return new CloudCatalogBlockingStub(channel); + } + + /** Creates a new ListenableFuture-style stub that supports unary calls on the service */ + public static CloudCatalogFutureStub newFutureStub(io.grpc.Channel channel) { + return new CloudCatalogFutureStub(channel); + } + + /** + * + * + *
+   * A catalog of Google Cloud Platform services and SKUs.
+   * Provides pricing information and metadata on Google Cloud Platform services
+   * and SKUs.
+   * 
+ */ + public abstract static class CloudCatalogImplBase implements io.grpc.BindableService { + + /** + * + * + *
+     * Lists all public cloud services.
+     * 
+ */ + public void listServices( + com.google.cloud.billing.v1.ListServicesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getListServicesMethod(), responseObserver); + } + + /** + * + * + *
+     * Lists all publicly available SKUs for a given cloud service.
+     * 
+ */ + public void listSkus( + com.google.cloud.billing.v1.ListSkusRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnimplementedUnaryCall(getListSkusMethod(), responseObserver); + } + + @java.lang.Override + public final io.grpc.ServerServiceDefinition bindService() { + return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) + .addMethod( + getListServicesMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.ListServicesRequest, + com.google.cloud.billing.v1.ListServicesResponse>( + this, METHODID_LIST_SERVICES))) + .addMethod( + getListSkusMethod(), + asyncUnaryCall( + new MethodHandlers< + com.google.cloud.billing.v1.ListSkusRequest, + com.google.cloud.billing.v1.ListSkusResponse>(this, METHODID_LIST_SKUS))) + .build(); + } + } + + /** + * + * + *
+   * A catalog of Google Cloud Platform services and SKUs.
+   * Provides pricing information and metadata on Google Cloud Platform services
+   * and SKUs.
+   * 
+ */ + public static final class CloudCatalogStub extends io.grpc.stub.AbstractStub { + private CloudCatalogStub(io.grpc.Channel channel) { + super(channel); + } + + private CloudCatalogStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CloudCatalogStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CloudCatalogStub(channel, callOptions); + } + + /** + * + * + *
+     * Lists all public cloud services.
+     * 
+ */ + public void listServices( + com.google.cloud.billing.v1.ListServicesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListServicesMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Lists all publicly available SKUs for a given cloud service.
+     * 
+ */ + public void listSkus( + com.google.cloud.billing.v1.ListSkusRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + asyncUnaryCall( + getChannel().newCall(getListSkusMethod(), getCallOptions()), request, responseObserver); + } + } + + /** + * + * + *
+   * A catalog of Google Cloud Platform services and SKUs.
+   * Provides pricing information and metadata on Google Cloud Platform services
+   * and SKUs.
+   * 
+ */ + public static final class CloudCatalogBlockingStub + extends io.grpc.stub.AbstractStub { + private CloudCatalogBlockingStub(io.grpc.Channel channel) { + super(channel); + } + + private CloudCatalogBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CloudCatalogBlockingStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CloudCatalogBlockingStub(channel, callOptions); + } + + /** + * + * + *
+     * Lists all public cloud services.
+     * 
+ */ + public com.google.cloud.billing.v1.ListServicesResponse listServices( + com.google.cloud.billing.v1.ListServicesRequest request) { + return blockingUnaryCall(getChannel(), getListServicesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Lists all publicly available SKUs for a given cloud service.
+     * 
+ */ + public com.google.cloud.billing.v1.ListSkusResponse listSkus( + com.google.cloud.billing.v1.ListSkusRequest request) { + return blockingUnaryCall(getChannel(), getListSkusMethod(), getCallOptions(), request); + } + } + + /** + * + * + *
+   * A catalog of Google Cloud Platform services and SKUs.
+   * Provides pricing information and metadata on Google Cloud Platform services
+   * and SKUs.
+   * 
+ */ + public static final class CloudCatalogFutureStub + extends io.grpc.stub.AbstractStub { + private CloudCatalogFutureStub(io.grpc.Channel channel) { + super(channel); + } + + private CloudCatalogFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + super(channel, callOptions); + } + + @java.lang.Override + protected CloudCatalogFutureStub build( + io.grpc.Channel channel, io.grpc.CallOptions callOptions) { + return new CloudCatalogFutureStub(channel, callOptions); + } + + /** + * + * + *
+     * Lists all public cloud services.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.ListServicesResponse> + listServices(com.google.cloud.billing.v1.ListServicesRequest request) { + return futureUnaryCall( + getChannel().newCall(getListServicesMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Lists all publicly available SKUs for a given cloud service.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.billing.v1.ListSkusResponse> + listSkus(com.google.cloud.billing.v1.ListSkusRequest request) { + return futureUnaryCall(getChannel().newCall(getListSkusMethod(), getCallOptions()), request); + } + } + + private static final int METHODID_LIST_SERVICES = 0; + private static final int METHODID_LIST_SKUS = 1; + + 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 CloudCatalogImplBase serviceImpl; + private final int methodId; + + MethodHandlers(CloudCatalogImplBase 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_LIST_SERVICES: + serviceImpl.listServices( + (com.google.cloud.billing.v1.ListServicesRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_LIST_SKUS: + serviceImpl.listSkus( + (com.google.cloud.billing.v1.ListSkusRequest) 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 CloudCatalogBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoFileDescriptorSupplier, + io.grpc.protobuf.ProtoServiceDescriptorSupplier { + CloudCatalogBaseDescriptorSupplier() {} + + @java.lang.Override + public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto.getDescriptor(); + } + + @java.lang.Override + public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() { + return getFileDescriptor().findServiceByName("CloudCatalog"); + } + } + + private static final class CloudCatalogFileDescriptorSupplier + extends CloudCatalogBaseDescriptorSupplier { + CloudCatalogFileDescriptorSupplier() {} + } + + private static final class CloudCatalogMethodDescriptorSupplier + extends CloudCatalogBaseDescriptorSupplier + implements io.grpc.protobuf.ProtoMethodDescriptorSupplier { + private final String methodName; + + CloudCatalogMethodDescriptorSupplier(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 (CloudCatalogGrpc.class) { + result = serviceDescriptor; + if (result == null) { + serviceDescriptor = + result = + io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME) + .setSchemaDescriptor(new CloudCatalogFileDescriptorSupplier()) + .addMethod(getListServicesMethod()) + .addMethod(getListSkusMethod()) + .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..5546a76f --- /dev/null +++ b/pom.xml @@ -0,0 +1,266 @@ + + + 4.0.0 + com.google.cloud + google-cloud-billing-parent + pom + 0.0.1-SNAPSHOT + Google Cloud Billing Parent + https://github.com/googleapis/java-billing + + Java idiomatic client for Google Cloud Platform services. + + + + com.google.cloud + google-cloud-shared-config + 0.4.0 + + + + + chingor + Jeff Ching + chingor@google.com + Google + + Developer + + + + + Google LLC + + + scm:git:git@github.com:googleapis/java-billing.git + scm:git:git@github.com:googleapis/java-billing.git + https://github.com/googleapis/java-billing + HEAD + + + https://github.com/googleapis/java-billing/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-billing-parent + 1.92.0 + 1.8.1 + 1.17.0 + 1.52.0 + 1.26.0 + 3.11.1 + 4.13 + 28.1-android + 1.4.1 + 1.3.2 + 1.18 + + + + + + com.google.api.grpc + proto-google-cloud-billing-v1 + 0.0.1-SNAPSHOT + + + com.google.api.grpc + grpc-google-cloud-billing-v1 + 0.0.1-SNAPSHOT + + + com.google.cloud + google-cloud-billing + 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.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} + + + com.google.cloud + google-cloud-core + ${google.core.version} + + + org.threeten + threetenbp + ${threeten.version} + + + javax.annotation + javax.annotation-api + ${javax.annotations.version} + + + org.codehaus.mojo + animal-sniffer-annotations + ${animal-sniffer.version} + + + com.google.api.grpc + proto-google-iam-v1 + 0.13.0 + + + + junit + junit + ${junit.version} + test + + + com.google.api + gax-grpc + ${gax.version} + testlib + test + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + org.objenesis:objenesis + + + + + + + + proto-google-cloud-billing-v1 + grpc-google-cloud-billing-v1 + google-cloud-billing + google-cloud-billing-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-billing-v1/pom.xml b/proto-google-cloud-billing-v1/pom.xml new file mode 100644 index 00000000..25ea4df9 --- /dev/null +++ b/proto-google-cloud-billing-v1/pom.xml @@ -0,0 +1,37 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-billing-v1 + 0.0.1-SNAPSHOT + proto-google-cloud-billing-v1beta1 + PROTO library for proto-google-cloud-billing-v1 + + com.google.cloud + google-cloud-billing-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + com.google.guava + guava + + + com.google.api + api-common + + + com.google.api.grpc + proto-google-iam-v1 + + + \ No newline at end of file diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/AggregationInfo.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/AggregationInfo.java new file mode 100644 index 00000000..1c986078 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/AggregationInfo.java @@ -0,0 +1,1008 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Represents the aggregation level and interval for pricing of a single SKU.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.AggregationInfo} + */ +public final class AggregationInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.AggregationInfo) + AggregationInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use AggregationInfo.newBuilder() to construct. + private AggregationInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private AggregationInfo() { + aggregationLevel_ = 0; + aggregationInterval_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new AggregationInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private AggregationInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + + aggregationLevel_ = rawValue; + break; + } + case 16: + { + int rawValue = input.readEnum(); + + aggregationInterval_ = rawValue; + break; + } + case 24: + { + aggregationCount_ = input.readInt32(); + 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.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_AggregationInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_AggregationInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.AggregationInfo.class, + com.google.cloud.billing.v1.AggregationInfo.Builder.class); + } + + /** + * + * + *
+   * The level at which usage is aggregated to compute cost.
+   * Example: "ACCOUNT" aggregation level indicates that usage for tiered
+   * pricing is aggregated across all projects in a single account.
+   * 
+ * + * Protobuf enum {@code google.cloud.billing.v1.AggregationInfo.AggregationLevel} + */ + public enum AggregationLevel implements com.google.protobuf.ProtocolMessageEnum { + /** AGGREGATION_LEVEL_UNSPECIFIED = 0; */ + AGGREGATION_LEVEL_UNSPECIFIED(0), + /** ACCOUNT = 1; */ + ACCOUNT(1), + /** PROJECT = 2; */ + PROJECT(2), + UNRECOGNIZED(-1), + ; + + /** AGGREGATION_LEVEL_UNSPECIFIED = 0; */ + public static final int AGGREGATION_LEVEL_UNSPECIFIED_VALUE = 0; + /** ACCOUNT = 1; */ + public static final int ACCOUNT_VALUE = 1; + /** PROJECT = 2; */ + public static final int PROJECT_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AggregationLevel valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static AggregationLevel forNumber(int value) { + switch (value) { + case 0: + return AGGREGATION_LEVEL_UNSPECIFIED; + case 1: + return ACCOUNT; + case 2: + return PROJECT; + 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 AggregationLevel findValueByNumber(int number) { + return AggregationLevel.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.v1.AggregationInfo.getDescriptor().getEnumTypes().get(0); + } + + private static final AggregationLevel[] VALUES = values(); + + public static AggregationLevel 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 AggregationLevel(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.billing.v1.AggregationInfo.AggregationLevel) + } + + /** + * + * + *
+   * The interval at which usage is aggregated to compute cost.
+   * Example: "MONTHLY" aggregation interval indicates that usage for tiered
+   * pricing is aggregated every month.
+   * 
+ * + * Protobuf enum {@code google.cloud.billing.v1.AggregationInfo.AggregationInterval} + */ + public enum AggregationInterval implements com.google.protobuf.ProtocolMessageEnum { + /** AGGREGATION_INTERVAL_UNSPECIFIED = 0; */ + AGGREGATION_INTERVAL_UNSPECIFIED(0), + /** DAILY = 1; */ + DAILY(1), + /** MONTHLY = 2; */ + MONTHLY(2), + UNRECOGNIZED(-1), + ; + + /** AGGREGATION_INTERVAL_UNSPECIFIED = 0; */ + public static final int AGGREGATION_INTERVAL_UNSPECIFIED_VALUE = 0; + /** DAILY = 1; */ + public static final int DAILY_VALUE = 1; + /** MONTHLY = 2; */ + public static final int MONTHLY_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static AggregationInterval valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static AggregationInterval forNumber(int value) { + switch (value) { + case 0: + return AGGREGATION_INTERVAL_UNSPECIFIED; + case 1: + return DAILY; + case 2: + return MONTHLY; + 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 AggregationInterval findValueByNumber(int number) { + return AggregationInterval.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.v1.AggregationInfo.getDescriptor().getEnumTypes().get(1); + } + + private static final AggregationInterval[] VALUES = values(); + + public static AggregationInterval 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 AggregationInterval(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.billing.v1.AggregationInfo.AggregationInterval) + } + + public static final int AGGREGATION_LEVEL_FIELD_NUMBER = 1; + private int aggregationLevel_; + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @return The enum numeric value on the wire for aggregationLevel. + */ + public int getAggregationLevelValue() { + return aggregationLevel_; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @return The aggregationLevel. + */ + public com.google.cloud.billing.v1.AggregationInfo.AggregationLevel getAggregationLevel() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.v1.AggregationInfo.AggregationLevel result = + com.google.cloud.billing.v1.AggregationInfo.AggregationLevel.valueOf(aggregationLevel_); + return result == null + ? com.google.cloud.billing.v1.AggregationInfo.AggregationLevel.UNRECOGNIZED + : result; + } + + public static final int AGGREGATION_INTERVAL_FIELD_NUMBER = 2; + private int aggregationInterval_; + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @return The enum numeric value on the wire for aggregationInterval. + */ + public int getAggregationIntervalValue() { + return aggregationInterval_; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @return The aggregationInterval. + */ + public com.google.cloud.billing.v1.AggregationInfo.AggregationInterval getAggregationInterval() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.v1.AggregationInfo.AggregationInterval result = + com.google.cloud.billing.v1.AggregationInfo.AggregationInterval.valueOf( + aggregationInterval_); + return result == null + ? com.google.cloud.billing.v1.AggregationInfo.AggregationInterval.UNRECOGNIZED + : result; + } + + public static final int AGGREGATION_COUNT_FIELD_NUMBER = 3; + private int aggregationCount_; + /** + * + * + *
+   * The number of intervals to aggregate over.
+   * Example: If aggregation_level is "DAILY" and aggregation_count is 14,
+   * aggregation will be over 14 days.
+   * 
+ * + * int32 aggregation_count = 3; + * + * @return The aggregationCount. + */ + public int getAggregationCount() { + return aggregationCount_; + } + + 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 (aggregationLevel_ + != com.google.cloud.billing.v1.AggregationInfo.AggregationLevel + .AGGREGATION_LEVEL_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, aggregationLevel_); + } + if (aggregationInterval_ + != com.google.cloud.billing.v1.AggregationInfo.AggregationInterval + .AGGREGATION_INTERVAL_UNSPECIFIED + .getNumber()) { + output.writeEnum(2, aggregationInterval_); + } + if (aggregationCount_ != 0) { + output.writeInt32(3, aggregationCount_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (aggregationLevel_ + != com.google.cloud.billing.v1.AggregationInfo.AggregationLevel + .AGGREGATION_LEVEL_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, aggregationLevel_); + } + if (aggregationInterval_ + != com.google.cloud.billing.v1.AggregationInfo.AggregationInterval + .AGGREGATION_INTERVAL_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(2, aggregationInterval_); + } + if (aggregationCount_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, aggregationCount_); + } + 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.v1.AggregationInfo)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.AggregationInfo other = + (com.google.cloud.billing.v1.AggregationInfo) obj; + + if (aggregationLevel_ != other.aggregationLevel_) return false; + if (aggregationInterval_ != other.aggregationInterval_) return false; + if (getAggregationCount() != other.getAggregationCount()) 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) + AGGREGATION_LEVEL_FIELD_NUMBER; + hash = (53 * hash) + aggregationLevel_; + hash = (37 * hash) + AGGREGATION_INTERVAL_FIELD_NUMBER; + hash = (53 * hash) + aggregationInterval_; + hash = (37 * hash) + AGGREGATION_COUNT_FIELD_NUMBER; + hash = (53 * hash) + getAggregationCount(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.AggregationInfo parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.AggregationInfo 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.v1.AggregationInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.AggregationInfo 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.v1.AggregationInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.AggregationInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.AggregationInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.AggregationInfo 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.v1.AggregationInfo parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.AggregationInfo 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.v1.AggregationInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.AggregationInfo 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.v1.AggregationInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents the aggregation level and interval for pricing of a single SKU.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.AggregationInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.AggregationInfo) + com.google.cloud.billing.v1.AggregationInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_AggregationInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_AggregationInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.AggregationInfo.class, + com.google.cloud.billing.v1.AggregationInfo.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.AggregationInfo.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(); + aggregationLevel_ = 0; + + aggregationInterval_ = 0; + + aggregationCount_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_AggregationInfo_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.AggregationInfo getDefaultInstanceForType() { + return com.google.cloud.billing.v1.AggregationInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.AggregationInfo build() { + com.google.cloud.billing.v1.AggregationInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.AggregationInfo buildPartial() { + com.google.cloud.billing.v1.AggregationInfo result = + new com.google.cloud.billing.v1.AggregationInfo(this); + result.aggregationLevel_ = aggregationLevel_; + result.aggregationInterval_ = aggregationInterval_; + result.aggregationCount_ = aggregationCount_; + 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.v1.AggregationInfo) { + return mergeFrom((com.google.cloud.billing.v1.AggregationInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.AggregationInfo other) { + if (other == com.google.cloud.billing.v1.AggregationInfo.getDefaultInstance()) return this; + if (other.aggregationLevel_ != 0) { + setAggregationLevelValue(other.getAggregationLevelValue()); + } + if (other.aggregationInterval_ != 0) { + setAggregationIntervalValue(other.getAggregationIntervalValue()); + } + if (other.getAggregationCount() != 0) { + setAggregationCount(other.getAggregationCount()); + } + 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.v1.AggregationInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.AggregationInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int aggregationLevel_ = 0; + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @return The enum numeric value on the wire for aggregationLevel. + */ + public int getAggregationLevelValue() { + return aggregationLevel_; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @param value The enum numeric value on the wire for aggregationLevel to set. + * @return This builder for chaining. + */ + public Builder setAggregationLevelValue(int value) { + aggregationLevel_ = value; + onChanged(); + return this; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @return The aggregationLevel. + */ + public com.google.cloud.billing.v1.AggregationInfo.AggregationLevel getAggregationLevel() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.v1.AggregationInfo.AggregationLevel result = + com.google.cloud.billing.v1.AggregationInfo.AggregationLevel.valueOf(aggregationLevel_); + return result == null + ? com.google.cloud.billing.v1.AggregationInfo.AggregationLevel.UNRECOGNIZED + : result; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @param value The aggregationLevel to set. + * @return This builder for chaining. + */ + public Builder setAggregationLevel( + com.google.cloud.billing.v1.AggregationInfo.AggregationLevel value) { + if (value == null) { + throw new NullPointerException(); + } + + aggregationLevel_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @return This builder for chaining. + */ + public Builder clearAggregationLevel() { + + aggregationLevel_ = 0; + onChanged(); + return this; + } + + private int aggregationInterval_ = 0; + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @return The enum numeric value on the wire for aggregationInterval. + */ + public int getAggregationIntervalValue() { + return aggregationInterval_; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @param value The enum numeric value on the wire for aggregationInterval to set. + * @return This builder for chaining. + */ + public Builder setAggregationIntervalValue(int value) { + aggregationInterval_ = value; + onChanged(); + return this; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @return The aggregationInterval. + */ + public com.google.cloud.billing.v1.AggregationInfo.AggregationInterval + getAggregationInterval() { + @SuppressWarnings("deprecation") + com.google.cloud.billing.v1.AggregationInfo.AggregationInterval result = + com.google.cloud.billing.v1.AggregationInfo.AggregationInterval.valueOf( + aggregationInterval_); + return result == null + ? com.google.cloud.billing.v1.AggregationInfo.AggregationInterval.UNRECOGNIZED + : result; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @param value The aggregationInterval to set. + * @return This builder for chaining. + */ + public Builder setAggregationInterval( + com.google.cloud.billing.v1.AggregationInfo.AggregationInterval value) { + if (value == null) { + throw new NullPointerException(); + } + + aggregationInterval_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @return This builder for chaining. + */ + public Builder clearAggregationInterval() { + + aggregationInterval_ = 0; + onChanged(); + return this; + } + + private int aggregationCount_; + /** + * + * + *
+     * The number of intervals to aggregate over.
+     * Example: If aggregation_level is "DAILY" and aggregation_count is 14,
+     * aggregation will be over 14 days.
+     * 
+ * + * int32 aggregation_count = 3; + * + * @return The aggregationCount. + */ + public int getAggregationCount() { + return aggregationCount_; + } + /** + * + * + *
+     * The number of intervals to aggregate over.
+     * Example: If aggregation_level is "DAILY" and aggregation_count is 14,
+     * aggregation will be over 14 days.
+     * 
+ * + * int32 aggregation_count = 3; + * + * @param value The aggregationCount to set. + * @return This builder for chaining. + */ + public Builder setAggregationCount(int value) { + + aggregationCount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The number of intervals to aggregate over.
+     * Example: If aggregation_level is "DAILY" and aggregation_count is 14,
+     * aggregation will be over 14 days.
+     * 
+ * + * int32 aggregation_count = 3; + * + * @return This builder for chaining. + */ + public Builder clearAggregationCount() { + + aggregationCount_ = 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.v1.AggregationInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.AggregationInfo) + private static final com.google.cloud.billing.v1.AggregationInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.AggregationInfo(); + } + + public static com.google.cloud.billing.v1.AggregationInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AggregationInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AggregationInfo(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.v1.AggregationInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/AggregationInfoOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/AggregationInfoOrBuilder.java new file mode 100644 index 00000000..e0237fc7 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/AggregationInfoOrBuilder.java @@ -0,0 +1,68 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface AggregationInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.AggregationInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @return The enum numeric value on the wire for aggregationLevel. + */ + int getAggregationLevelValue(); + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationLevel aggregation_level = 1; + * + * @return The aggregationLevel. + */ + com.google.cloud.billing.v1.AggregationInfo.AggregationLevel getAggregationLevel(); + + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @return The enum numeric value on the wire for aggregationInterval. + */ + int getAggregationIntervalValue(); + /** + * .google.cloud.billing.v1.AggregationInfo.AggregationInterval aggregation_interval = 2; + * + * + * @return The aggregationInterval. + */ + com.google.cloud.billing.v1.AggregationInfo.AggregationInterval getAggregationInterval(); + + /** + * + * + *
+   * The number of intervals to aggregate over.
+   * Example: If aggregation_level is "DAILY" and aggregation_count is 14,
+   * aggregation will be over 14 days.
+   * 
+ * + * int32 aggregation_count = 3; + * + * @return The aggregationCount. + */ + int getAggregationCount(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccount.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccount.java new file mode 100644 index 00000000..43088bd9 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccount.java @@ -0,0 +1,1140 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * A billing account in [GCP Console](https://console.cloud.google.com/).
+ * You can assign a billing account to one or more projects.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.BillingAccount} + */ +public final class BillingAccount extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.BillingAccount) + BillingAccountOrBuilder { + private static final long serialVersionUID = 0L; + // Use BillingAccount.newBuilder() to construct. + private BillingAccount(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BillingAccount() { + name_ = ""; + displayName_ = ""; + masterBillingAccount_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BillingAccount(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BillingAccount( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 16: + { + open_ = input.readBool(); + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + masterBillingAccount_ = 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.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_BillingAccount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_BillingAccount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.BillingAccount.class, + com.google.cloud.billing.v1.BillingAccount.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The resource name of the billing account. The resource name has the form
+   * `billingAccounts/{billing_account_id}`. For example,
+   * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+   * billing account `012345-567890-ABCDEF`.
+   * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The resource name of the billing account. The resource name has the form
+   * `billingAccounts/{billing_account_id}`. For example,
+   * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+   * billing account `012345-567890-ABCDEF`.
+   * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for name. + */ + 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 OPEN_FIELD_NUMBER = 2; + private boolean open_; + /** + * + * + *
+   * Output only. True if the billing account is open, and will therefore be charged for any
+   * usage on associated projects. False if the billing account is closed, and
+   * therefore projects associated with it will be unable to use paid services.
+   * 
+ * + * bool open = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The open. + */ + public boolean getOpen() { + return open_; + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 3; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * The display name given to the billing account, such as `My Billing
+   * Account`. This name is displayed in the GCP Console.
+   * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + 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; + } + } + /** + * + * + *
+   * The display name given to the billing account, such as `My Billing
+   * Account`. This name is displayed in the GCP Console.
+   * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + 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 MASTER_BILLING_ACCOUNT_FIELD_NUMBER = 4; + private volatile java.lang.Object masterBillingAccount_; + /** + * + * + *
+   * If this account is a
+   * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+   * will be the resource name of the master billing account that it is being
+   * resold through.
+   * Otherwise this will be empty.
+   * 
+ * + * string master_billing_account = 4; + * + * @return The masterBillingAccount. + */ + public java.lang.String getMasterBillingAccount() { + java.lang.Object ref = masterBillingAccount_; + 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(); + masterBillingAccount_ = s; + return s; + } + } + /** + * + * + *
+   * If this account is a
+   * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+   * will be the resource name of the master billing account that it is being
+   * resold through.
+   * Otherwise this will be empty.
+   * 
+ * + * string master_billing_account = 4; + * + * @return The bytes for masterBillingAccount. + */ + public com.google.protobuf.ByteString getMasterBillingAccountBytes() { + java.lang.Object ref = masterBillingAccount_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + masterBillingAccount_ = 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 (open_ != false) { + output.writeBool(2, open_); + } + if (!getDisplayNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, displayName_); + } + if (!getMasterBillingAccountBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, masterBillingAccount_); + } + 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 (open_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(2, open_); + } + if (!getDisplayNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, displayName_); + } + if (!getMasterBillingAccountBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, masterBillingAccount_); + } + 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.v1.BillingAccount)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.BillingAccount other = + (com.google.cloud.billing.v1.BillingAccount) obj; + + if (!getName().equals(other.getName())) return false; + if (getOpen() != other.getOpen()) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!getMasterBillingAccount().equals(other.getMasterBillingAccount())) 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) + OPEN_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getOpen()); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + MASTER_BILLING_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getMasterBillingAccount().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.BillingAccount parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.BillingAccount 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.v1.BillingAccount parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.BillingAccount 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.v1.BillingAccount parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.BillingAccount parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.BillingAccount parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.BillingAccount 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.v1.BillingAccount parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.BillingAccount 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.v1.BillingAccount parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.BillingAccount 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.v1.BillingAccount 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 billing account in [GCP Console](https://console.cloud.google.com/).
+   * You can assign a billing account to one or more projects.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.BillingAccount} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.BillingAccount) + com.google.cloud.billing.v1.BillingAccountOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_BillingAccount_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_BillingAccount_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.BillingAccount.class, + com.google.cloud.billing.v1.BillingAccount.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.BillingAccount.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_ = ""; + + open_ = false; + + displayName_ = ""; + + masterBillingAccount_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_BillingAccount_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.BillingAccount getDefaultInstanceForType() { + return com.google.cloud.billing.v1.BillingAccount.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.BillingAccount build() { + com.google.cloud.billing.v1.BillingAccount result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.BillingAccount buildPartial() { + com.google.cloud.billing.v1.BillingAccount result = + new com.google.cloud.billing.v1.BillingAccount(this); + result.name_ = name_; + result.open_ = open_; + result.displayName_ = displayName_; + result.masterBillingAccount_ = masterBillingAccount_; + 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.v1.BillingAccount) { + return mergeFrom((com.google.cloud.billing.v1.BillingAccount) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.BillingAccount other) { + if (other == com.google.cloud.billing.v1.BillingAccount.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.getOpen() != false) { + setOpen(other.getOpen()); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (!other.getMasterBillingAccount().isEmpty()) { + masterBillingAccount_ = other.masterBillingAccount_; + 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.v1.BillingAccount parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.BillingAccount) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The resource name of the billing account. The resource name has the form
+     * `billingAccounts/{billing_account_id}`. For example,
+     * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+     * billing account `012345-567890-ABCDEF`.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource name of the billing account. The resource name has the form
+     * `billingAccounts/{billing_account_id}`. For example,
+     * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+     * billing account `012345-567890-ABCDEF`.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource name of the billing account. The resource name has the form
+     * `billingAccounts/{billing_account_id}`. For example,
+     * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+     * billing account `012345-567890-ABCDEF`.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name of the billing account. The resource name has the form
+     * `billingAccounts/{billing_account_id}`. For example,
+     * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+     * billing account `012345-567890-ABCDEF`.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name of the billing account. The resource name has the form
+     * `billingAccounts/{billing_account_id}`. For example,
+     * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+     * billing account `012345-567890-ABCDEF`.
+     * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private boolean open_; + /** + * + * + *
+     * Output only. True if the billing account is open, and will therefore be charged for any
+     * usage on associated projects. False if the billing account is closed, and
+     * therefore projects associated with it will be unable to use paid services.
+     * 
+ * + * bool open = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The open. + */ + public boolean getOpen() { + return open_; + } + /** + * + * + *
+     * Output only. True if the billing account is open, and will therefore be charged for any
+     * usage on associated projects. False if the billing account is closed, and
+     * therefore projects associated with it will be unable to use paid services.
+     * 
+ * + * bool open = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The open to set. + * @return This builder for chaining. + */ + public Builder setOpen(boolean value) { + + open_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. True if the billing account is open, and will therefore be charged for any
+     * usage on associated projects. False if the billing account is closed, and
+     * therefore projects associated with it will be unable to use paid services.
+     * 
+ * + * bool open = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearOpen() { + + open_ = false; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * The display name given to the billing account, such as `My Billing
+     * Account`. This name is displayed in the GCP Console.
+     * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + 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; + } + } + /** + * + * + *
+     * The display name given to the billing account, such as `My Billing
+     * Account`. This name is displayed in the GCP Console.
+     * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + 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; + } + } + /** + * + * + *
+     * The display name given to the billing account, such as `My Billing
+     * Account`. This name is displayed in the GCP Console.
+     * 
+ * + * string display_name = 3; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The display name given to the billing account, such as `My Billing
+     * Account`. This name is displayed in the GCP Console.
+     * 
+ * + * string display_name = 3; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The display name given to the billing account, such as `My Billing
+     * Account`. This name is displayed in the GCP Console.
+     * 
+ * + * string display_name = 3; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private java.lang.Object masterBillingAccount_ = ""; + /** + * + * + *
+     * If this account is a
+     * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+     * will be the resource name of the master billing account that it is being
+     * resold through.
+     * Otherwise this will be empty.
+     * 
+ * + * string master_billing_account = 4; + * + * @return The masterBillingAccount. + */ + public java.lang.String getMasterBillingAccount() { + java.lang.Object ref = masterBillingAccount_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + masterBillingAccount_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * If this account is a
+     * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+     * will be the resource name of the master billing account that it is being
+     * resold through.
+     * Otherwise this will be empty.
+     * 
+ * + * string master_billing_account = 4; + * + * @return The bytes for masterBillingAccount. + */ + public com.google.protobuf.ByteString getMasterBillingAccountBytes() { + java.lang.Object ref = masterBillingAccount_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + masterBillingAccount_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * If this account is a
+     * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+     * will be the resource name of the master billing account that it is being
+     * resold through.
+     * Otherwise this will be empty.
+     * 
+ * + * string master_billing_account = 4; + * + * @param value The masterBillingAccount to set. + * @return This builder for chaining. + */ + public Builder setMasterBillingAccount(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + masterBillingAccount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * If this account is a
+     * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+     * will be the resource name of the master billing account that it is being
+     * resold through.
+     * Otherwise this will be empty.
+     * 
+ * + * string master_billing_account = 4; + * + * @return This builder for chaining. + */ + public Builder clearMasterBillingAccount() { + + masterBillingAccount_ = getDefaultInstance().getMasterBillingAccount(); + onChanged(); + return this; + } + /** + * + * + *
+     * If this account is a
+     * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+     * will be the resource name of the master billing account that it is being
+     * resold through.
+     * Otherwise this will be empty.
+     * 
+ * + * string master_billing_account = 4; + * + * @param value The bytes for masterBillingAccount to set. + * @return This builder for chaining. + */ + public Builder setMasterBillingAccountBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + masterBillingAccount_ = 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.v1.BillingAccount) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.BillingAccount) + private static final com.google.cloud.billing.v1.BillingAccount DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.BillingAccount(); + } + + public static com.google.cloud.billing.v1.BillingAccount getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BillingAccount parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BillingAccount(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.v1.BillingAccount getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccountName.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccountName.java new file mode 100644 index 00000000..00f8068d --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccountName.java @@ -0,0 +1,162 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.billing.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** 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-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccountOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccountOrBuilder.java new file mode 100644 index 00000000..7783928f --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccountOrBuilder.java @@ -0,0 +1,131 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface BillingAccountOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.BillingAccount) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The resource name of the billing account. The resource name has the form
+   * `billingAccounts/{billing_account_id}`. For example,
+   * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+   * billing account `012345-567890-ABCDEF`.
+   * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The resource name of the billing account. The resource name has the form
+   * `billingAccounts/{billing_account_id}`. For example,
+   * `billingAccounts/012345-567890-ABCDEF` would be the resource name for
+   * billing account `012345-567890-ABCDEF`.
+   * 
+ * + * string name = 1 [(.google.api.resource_reference) = { ... } + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. True if the billing account is open, and will therefore be charged for any
+   * usage on associated projects. False if the billing account is closed, and
+   * therefore projects associated with it will be unable to use paid services.
+   * 
+ * + * bool open = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The open. + */ + boolean getOpen(); + + /** + * + * + *
+   * The display name given to the billing account, such as `My Billing
+   * Account`. This name is displayed in the GCP Console.
+   * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * The display name given to the billing account, such as `My Billing
+   * Account`. This name is displayed in the GCP Console.
+   * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * If this account is a
+   * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+   * will be the resource name of the master billing account that it is being
+   * resold through.
+   * Otherwise this will be empty.
+   * 
+ * + * string master_billing_account = 4; + * + * @return The masterBillingAccount. + */ + java.lang.String getMasterBillingAccount(); + /** + * + * + *
+   * If this account is a
+   * [subaccount](https://cloud.google.com/billing/docs/concepts), then this
+   * will be the resource name of the master billing account that it is being
+   * resold through.
+   * Otherwise this will be empty.
+   * 
+ * + * string master_billing_account = 4; + * + * @return The bytes for masterBillingAccount. + */ + com.google.protobuf.ByteString getMasterBillingAccountBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Category.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Category.java new file mode 100644 index 00000000..54697e25 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Category.java @@ -0,0 +1,1181 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Represents the category hierarchy of a SKU.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.Category} + */ +public final class Category extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.Category) + CategoryOrBuilder { + private static final long serialVersionUID = 0L; + // Use Category.newBuilder() to construct. + private Category(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Category() { + serviceDisplayName_ = ""; + resourceFamily_ = ""; + resourceGroup_ = ""; + usageType_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Category(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Category( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + serviceDisplayName_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + resourceFamily_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + resourceGroup_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + usageType_ = 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.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Category_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Category_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.Category.class, + com.google.cloud.billing.v1.Category.Builder.class); + } + + public static final int SERVICE_DISPLAY_NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object serviceDisplayName_; + /** + * + * + *
+   * The display name of the service this SKU belongs to.
+   * 
+ * + * string service_display_name = 1; + * + * @return The serviceDisplayName. + */ + public java.lang.String getServiceDisplayName() { + java.lang.Object ref = serviceDisplayName_; + 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(); + serviceDisplayName_ = s; + return s; + } + } + /** + * + * + *
+   * The display name of the service this SKU belongs to.
+   * 
+ * + * string service_display_name = 1; + * + * @return The bytes for serviceDisplayName. + */ + public com.google.protobuf.ByteString getServiceDisplayNameBytes() { + java.lang.Object ref = serviceDisplayName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceDisplayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int RESOURCE_FAMILY_FIELD_NUMBER = 2; + private volatile java.lang.Object resourceFamily_; + /** + * + * + *
+   * The type of product the SKU refers to.
+   * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+   * 
+ * + * string resource_family = 2; + * + * @return The resourceFamily. + */ + public java.lang.String getResourceFamily() { + java.lang.Object ref = resourceFamily_; + 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(); + resourceFamily_ = s; + return s; + } + } + /** + * + * + *
+   * The type of product the SKU refers to.
+   * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+   * 
+ * + * string resource_family = 2; + * + * @return The bytes for resourceFamily. + */ + public com.google.protobuf.ByteString getResourceFamilyBytes() { + java.lang.Object ref = resourceFamily_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resourceFamily_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int RESOURCE_GROUP_FIELD_NUMBER = 3; + private volatile java.lang.Object resourceGroup_; + /** + * + * + *
+   * A group classification for related SKUs.
+   * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+   * 
+ * + * string resource_group = 3; + * + * @return The resourceGroup. + */ + public java.lang.String getResourceGroup() { + java.lang.Object ref = resourceGroup_; + 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(); + resourceGroup_ = s; + return s; + } + } + /** + * + * + *
+   * A group classification for related SKUs.
+   * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+   * 
+ * + * string resource_group = 3; + * + * @return The bytes for resourceGroup. + */ + public com.google.protobuf.ByteString getResourceGroupBytes() { + java.lang.Object ref = resourceGroup_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resourceGroup_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int USAGE_TYPE_FIELD_NUMBER = 4; + private volatile java.lang.Object usageType_; + /** + * + * + *
+   * Represents how the SKU is consumed.
+   * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+   * 
+ * + * string usage_type = 4; + * + * @return The usageType. + */ + public java.lang.String getUsageType() { + java.lang.Object ref = usageType_; + 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(); + usageType_ = s; + return s; + } + } + /** + * + * + *
+   * Represents how the SKU is consumed.
+   * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+   * 
+ * + * string usage_type = 4; + * + * @return The bytes for usageType. + */ + public com.google.protobuf.ByteString getUsageTypeBytes() { + java.lang.Object ref = usageType_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + usageType_ = 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 (!getServiceDisplayNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, serviceDisplayName_); + } + if (!getResourceFamilyBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, resourceFamily_); + } + if (!getResourceGroupBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, resourceGroup_); + } + if (!getUsageTypeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, usageType_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getServiceDisplayNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, serviceDisplayName_); + } + if (!getResourceFamilyBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, resourceFamily_); + } + if (!getResourceGroupBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, resourceGroup_); + } + if (!getUsageTypeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, usageType_); + } + 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.v1.Category)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.Category other = (com.google.cloud.billing.v1.Category) obj; + + if (!getServiceDisplayName().equals(other.getServiceDisplayName())) return false; + if (!getResourceFamily().equals(other.getResourceFamily())) return false; + if (!getResourceGroup().equals(other.getResourceGroup())) return false; + if (!getUsageType().equals(other.getUsageType())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + SERVICE_DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getServiceDisplayName().hashCode(); + hash = (37 * hash) + RESOURCE_FAMILY_FIELD_NUMBER; + hash = (53 * hash) + getResourceFamily().hashCode(); + hash = (37 * hash) + RESOURCE_GROUP_FIELD_NUMBER; + hash = (53 * hash) + getResourceGroup().hashCode(); + hash = (37 * hash) + USAGE_TYPE_FIELD_NUMBER; + hash = (53 * hash) + getUsageType().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.Category parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Category 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.v1.Category parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Category 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.v1.Category parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Category parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.Category parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Category 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.v1.Category parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Category 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.v1.Category parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Category 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.v1.Category prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents the category hierarchy of a SKU.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.Category} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.Category) + com.google.cloud.billing.v1.CategoryOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Category_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Category_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.Category.class, + com.google.cloud.billing.v1.Category.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.Category.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(); + serviceDisplayName_ = ""; + + resourceFamily_ = ""; + + resourceGroup_ = ""; + + usageType_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Category_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.Category getDefaultInstanceForType() { + return com.google.cloud.billing.v1.Category.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.Category build() { + com.google.cloud.billing.v1.Category result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.Category buildPartial() { + com.google.cloud.billing.v1.Category result = new com.google.cloud.billing.v1.Category(this); + result.serviceDisplayName_ = serviceDisplayName_; + result.resourceFamily_ = resourceFamily_; + result.resourceGroup_ = resourceGroup_; + result.usageType_ = usageType_; + 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.v1.Category) { + return mergeFrom((com.google.cloud.billing.v1.Category) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.Category other) { + if (other == com.google.cloud.billing.v1.Category.getDefaultInstance()) return this; + if (!other.getServiceDisplayName().isEmpty()) { + serviceDisplayName_ = other.serviceDisplayName_; + onChanged(); + } + if (!other.getResourceFamily().isEmpty()) { + resourceFamily_ = other.resourceFamily_; + onChanged(); + } + if (!other.getResourceGroup().isEmpty()) { + resourceGroup_ = other.resourceGroup_; + onChanged(); + } + if (!other.getUsageType().isEmpty()) { + usageType_ = other.usageType_; + 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.v1.Category parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.Category) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object serviceDisplayName_ = ""; + /** + * + * + *
+     * The display name of the service this SKU belongs to.
+     * 
+ * + * string service_display_name = 1; + * + * @return The serviceDisplayName. + */ + public java.lang.String getServiceDisplayName() { + java.lang.Object ref = serviceDisplayName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceDisplayName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The display name of the service this SKU belongs to.
+     * 
+ * + * string service_display_name = 1; + * + * @return The bytes for serviceDisplayName. + */ + public com.google.protobuf.ByteString getServiceDisplayNameBytes() { + java.lang.Object ref = serviceDisplayName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceDisplayName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The display name of the service this SKU belongs to.
+     * 
+ * + * string service_display_name = 1; + * + * @param value The serviceDisplayName to set. + * @return This builder for chaining. + */ + public Builder setServiceDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceDisplayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The display name of the service this SKU belongs to.
+     * 
+ * + * string service_display_name = 1; + * + * @return This builder for chaining. + */ + public Builder clearServiceDisplayName() { + + serviceDisplayName_ = getDefaultInstance().getServiceDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The display name of the service this SKU belongs to.
+     * 
+ * + * string service_display_name = 1; + * + * @param value The bytes for serviceDisplayName to set. + * @return This builder for chaining. + */ + public Builder setServiceDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceDisplayName_ = value; + onChanged(); + return this; + } + + private java.lang.Object resourceFamily_ = ""; + /** + * + * + *
+     * The type of product the SKU refers to.
+     * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+     * 
+ * + * string resource_family = 2; + * + * @return The resourceFamily. + */ + public java.lang.String getResourceFamily() { + java.lang.Object ref = resourceFamily_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resourceFamily_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The type of product the SKU refers to.
+     * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+     * 
+ * + * string resource_family = 2; + * + * @return The bytes for resourceFamily. + */ + public com.google.protobuf.ByteString getResourceFamilyBytes() { + java.lang.Object ref = resourceFamily_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resourceFamily_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The type of product the SKU refers to.
+     * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+     * 
+ * + * string resource_family = 2; + * + * @param value The resourceFamily to set. + * @return This builder for chaining. + */ + public Builder setResourceFamily(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + resourceFamily_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The type of product the SKU refers to.
+     * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+     * 
+ * + * string resource_family = 2; + * + * @return This builder for chaining. + */ + public Builder clearResourceFamily() { + + resourceFamily_ = getDefaultInstance().getResourceFamily(); + onChanged(); + return this; + } + /** + * + * + *
+     * The type of product the SKU refers to.
+     * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+     * 
+ * + * string resource_family = 2; + * + * @param value The bytes for resourceFamily to set. + * @return This builder for chaining. + */ + public Builder setResourceFamilyBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + resourceFamily_ = value; + onChanged(); + return this; + } + + private java.lang.Object resourceGroup_ = ""; + /** + * + * + *
+     * A group classification for related SKUs.
+     * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+     * 
+ * + * string resource_group = 3; + * + * @return The resourceGroup. + */ + public java.lang.String getResourceGroup() { + java.lang.Object ref = resourceGroup_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resourceGroup_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A group classification for related SKUs.
+     * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+     * 
+ * + * string resource_group = 3; + * + * @return The bytes for resourceGroup. + */ + public com.google.protobuf.ByteString getResourceGroupBytes() { + java.lang.Object ref = resourceGroup_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resourceGroup_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A group classification for related SKUs.
+     * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+     * 
+ * + * string resource_group = 3; + * + * @param value The resourceGroup to set. + * @return This builder for chaining. + */ + public Builder setResourceGroup(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + resourceGroup_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A group classification for related SKUs.
+     * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+     * 
+ * + * string resource_group = 3; + * + * @return This builder for chaining. + */ + public Builder clearResourceGroup() { + + resourceGroup_ = getDefaultInstance().getResourceGroup(); + onChanged(); + return this; + } + /** + * + * + *
+     * A group classification for related SKUs.
+     * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+     * 
+ * + * string resource_group = 3; + * + * @param value The bytes for resourceGroup to set. + * @return This builder for chaining. + */ + public Builder setResourceGroupBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + resourceGroup_ = value; + onChanged(); + return this; + } + + private java.lang.Object usageType_ = ""; + /** + * + * + *
+     * Represents how the SKU is consumed.
+     * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+     * 
+ * + * string usage_type = 4; + * + * @return The usageType. + */ + public java.lang.String getUsageType() { + java.lang.Object ref = usageType_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + usageType_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Represents how the SKU is consumed.
+     * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+     * 
+ * + * string usage_type = 4; + * + * @return The bytes for usageType. + */ + public com.google.protobuf.ByteString getUsageTypeBytes() { + java.lang.Object ref = usageType_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + usageType_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Represents how the SKU is consumed.
+     * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+     * 
+ * + * string usage_type = 4; + * + * @param value The usageType to set. + * @return This builder for chaining. + */ + public Builder setUsageType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + usageType_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Represents how the SKU is consumed.
+     * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+     * 
+ * + * string usage_type = 4; + * + * @return This builder for chaining. + */ + public Builder clearUsageType() { + + usageType_ = getDefaultInstance().getUsageType(); + onChanged(); + return this; + } + /** + * + * + *
+     * Represents how the SKU is consumed.
+     * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+     * 
+ * + * string usage_type = 4; + * + * @param value The bytes for usageType to set. + * @return This builder for chaining. + */ + public Builder setUsageTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + usageType_ = 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.v1.Category) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.Category) + private static final com.google.cloud.billing.v1.Category DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.Category(); + } + + public static com.google.cloud.billing.v1.Category getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Category parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Category(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.v1.Category getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CategoryOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CategoryOrBuilder.java new file mode 100644 index 00000000..9d934f6b --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CategoryOrBuilder.java @@ -0,0 +1,131 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface CategoryOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.Category) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The display name of the service this SKU belongs to.
+   * 
+ * + * string service_display_name = 1; + * + * @return The serviceDisplayName. + */ + java.lang.String getServiceDisplayName(); + /** + * + * + *
+   * The display name of the service this SKU belongs to.
+   * 
+ * + * string service_display_name = 1; + * + * @return The bytes for serviceDisplayName. + */ + com.google.protobuf.ByteString getServiceDisplayNameBytes(); + + /** + * + * + *
+   * The type of product the SKU refers to.
+   * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+   * 
+ * + * string resource_family = 2; + * + * @return The resourceFamily. + */ + java.lang.String getResourceFamily(); + /** + * + * + *
+   * The type of product the SKU refers to.
+   * Example: "Compute", "Storage", "Network", "ApplicationServices" etc.
+   * 
+ * + * string resource_family = 2; + * + * @return The bytes for resourceFamily. + */ + com.google.protobuf.ByteString getResourceFamilyBytes(); + + /** + * + * + *
+   * A group classification for related SKUs.
+   * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+   * 
+ * + * string resource_group = 3; + * + * @return The resourceGroup. + */ + java.lang.String getResourceGroup(); + /** + * + * + *
+   * A group classification for related SKUs.
+   * Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc.
+   * 
+ * + * string resource_group = 3; + * + * @return The bytes for resourceGroup. + */ + com.google.protobuf.ByteString getResourceGroupBytes(); + + /** + * + * + *
+   * Represents how the SKU is consumed.
+   * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+   * 
+ * + * string usage_type = 4; + * + * @return The usageType. + */ + java.lang.String getUsageType(); + /** + * + * + *
+   * Represents how the SKU is consumed.
+   * Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc.
+   * 
+ * + * string usage_type = 4; + * + * @return The bytes for usageType. + */ + com.google.protobuf.ByteString getUsageTypeBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudBillingProto.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudBillingProto.java new file mode 100644 index 00000000..c75795b9 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudBillingProto.java @@ -0,0 +1,295 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public final class CloudBillingProto { + private CloudBillingProto() {} + + 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_v1_BillingAccount_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_BillingAccount_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ProjectBillingInfo_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ProjectBillingInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_GetBillingAccountRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_GetBillingAccountRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n+google/cloud/billing/v1/cloud_billing." + + "proto\022\027google.cloud.billing.v1\032\034google/a" + + "pi/annotations.proto\032\027google/api/client." + + "proto\032\037google/api/field_behavior.proto\032\031" + + "google/api/resource.proto\032\036google/iam/v1" + + "/iam_policy.proto\032\032google/iam/v1/policy." + + "proto\032 google/protobuf/field_mask.proto\"" + + "\230\001\n\016BillingAccount\022=\n\004name\030\001 \001(\tB/\372A,\n*c" + + "loudbilling.googleapis.com/BillingAccoun" + + "t\022\021\n\004open\030\002 \001(\010B\003\340A\003\022\024\n\014display_name\030\003 \001" + + "(\t\022\036\n\026master_billing_account\030\004 \001(\t\"m\n\022Pr" + + "ojectBillingInfo\022\014\n\004name\030\001 \001(\t\022\022\n\nprojec" + + "t_id\030\002 \001(\t\022\034\n\024billing_account_name\030\003 \001(\t" + + "\022\027\n\017billing_enabled\030\004 \001(\010\"\\\n\030GetBillingA" + + "ccountRequest\022@\n\004name\030\001 \001(\tB2\340A\002\372A,\n*clo" + + "udbilling.googleapis.com/BillingAccount\"" + + "S\n\032ListBillingAccountsRequest\022\021\n\tpage_si" + + "ze\030\001 \001(\005\022\022\n\npage_token\030\002 \001(\t\022\016\n\006filter\030\003" + + " \001(\t\"y\n\033ListBillingAccountsResponse\022A\n\020b" + + "illing_accounts\030\001 \003(\0132\'.google.cloud.bil" + + "ling.v1.BillingAccount\022\027\n\017next_page_toke" + + "n\030\002 \001(\t\"d\n\033CreateBillingAccountRequest\022E" + + "\n\017billing_account\030\001 \001(\0132\'.google.cloud.b" + + "illing.v1.BillingAccountB\003\340A\002\"\317\001\n\033Update" + + "BillingAccountRequest\022@\n\004name\030\001 \001(\tB2\340A\002" + + "\372A,\n*cloudbilling.googleapis.com/Billing" + + "Account\022=\n\007account\030\002 \001(\0132\'.google.cloud." + + "billing.v1.BillingAccountB\003\340A\002\022/\n\013update" + + "_mask\030\003 \001(\0132\032.google.protobuf.FieldMask\"" + + "\210\001\n\035ListProjectBillingInfoRequest\022@\n\004nam" + + "e\030\001 \001(\tB2\340A\002\372A,\n*cloudbilling.googleapis" + + ".com/BillingAccount\022\021\n\tpage_size\030\002 \001(\005\022\022" + + "\n\npage_token\030\003 \001(\t\"\204\001\n\036ListProjectBillin" + + "gInfoResponse\022I\n\024project_billing_info\030\001 " + + "\003(\0132+.google.cloud.billing.v1.ProjectBil" + + "lingInfo\022\027\n\017next_page_token\030\002 \001(\t\"1\n\034Get" + + "ProjectBillingInfoRequest\022\021\n\004name\030\001 \001(\tB" + + "\003\340A\002\"\177\n\037UpdateProjectBillingInfoRequest\022" + + "\021\n\004name\030\001 \001(\tB\003\340A\002\022I\n\024project_billing_in" + + "fo\030\002 \001(\0132+.google.cloud.billing.v1.Proje" + + "ctBillingInfo2\313\016\n\014CloudBilling\022\234\001\n\021GetBi" + + "llingAccount\0221.google.cloud.billing.v1.G" + + "etBillingAccountRequest\032\'.google.cloud.b" + + "illing.v1.BillingAccount\"+\202\323\344\223\002\036\022\034/v1/{n" + + "ame=billingAccounts/*}\332A\004name\022\240\001\n\023ListBi" + + "llingAccounts\0223.google.cloud.billing.v1." + + "ListBillingAccountsRequest\0324.google.clou" + + "d.billing.v1.ListBillingAccountsResponse" + + "\"\036\202\323\344\223\002\025\022\023/v1/billingAccounts\332A\000\022\263\001\n\024Upd" + + "ateBillingAccount\0224.google.cloud.billing" + + ".v1.UpdateBillingAccountRequest\032\'.google" + + ".cloud.billing.v1.BillingAccount\"<\202\323\344\223\002\'" + + "2\034/v1/{name=billingAccounts/*}:\007account\332" + + "A\014name,account\022\265\001\n\024CreateBillingAccount\022" + + "4.google.cloud.billing.v1.CreateBillingA" + + "ccountRequest\032\'.google.cloud.billing.v1." + + "BillingAccount\">\202\323\344\223\002&\"\023/v1/billingAccou" + + "nts:\017billing_account\332A\017billing_account\022\277" + + "\001\n\026ListProjectBillingInfo\0226.google.cloud" + + ".billing.v1.ListProjectBillingInfoReques" + + "t\0327.google.cloud.billing.v1.ListProjectB" + + "illingInfoResponse\"4\202\323\344\223\002\'\022%/v1/{name=bi" + + "llingAccounts/*}/projects\332A\004name\022\255\001\n\025Get" + + "ProjectBillingInfo\0225.google.cloud.billin" + + "g.v1.GetProjectBillingInfoRequest\032+.goog" + + "le.cloud.billing.v1.ProjectBillingInfo\"0" + + "\202\323\344\223\002#\022!/v1/{name=projects/*}/billingInf" + + "o\332A\004name\022\336\001\n\030UpdateProjectBillingInfo\0228." + + "google.cloud.billing.v1.UpdateProjectBil" + + "lingInfoRequest\032+.google.cloud.billing.v" + + "1.ProjectBillingInfo\"[\202\323\344\223\0029\032!/v1/{name=" + + "projects/*}/billingInfo:\024project_billing" + + "_info\332A\031name,project_billing_info\022\213\001\n\014Ge" + + "tIamPolicy\022\".google.iam.v1.GetIamPolicyR" + + "equest\032\025.google.iam.v1.Policy\"@\202\323\344\223\002/\022-/" + + "v1/{resource=billingAccounts/*}:getIamPo" + + "licy\332A\010resource\022\225\001\n\014SetIamPolicy\022\".googl" + + "e.iam.v1.SetIamPolicyRequest\032\025.google.ia" + + "m.v1.Policy\"J\202\323\344\223\0022\"-/v1/{resource=billi" + + "ngAccounts/*}:setIamPolicy:\001*\332A\017resource" + + ",policy\022\300\001\n\022TestIamPermissions\022(.google." + + "iam.v1.TestIamPermissionsRequest\032).googl" + + "e.iam.v1.TestIamPermissionsResponse\"U\202\323\344" + + "\223\0028\"3/v1/{resource=billingAccounts/*}:te" + + "stIamPermissions:\001*\332A\024resource,permissio" + + "ns\032O\312A\033cloudbilling.googleapis.com\322A.htt" + + "ps://www.googleapis.com/auth/cloud-platf" + + "ormBr\n\033com.google.cloud.billing.v1B\021Clou" + + "dBillingProtoP\001Z>google.golang.org/genpr" + + "oto/googleapis/cloud/billing/v1;billingb" + + "\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.iam.v1.IamPolicyProto.getDescriptor(), + com.google.iam.v1.PolicyProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), + }); + internal_static_google_cloud_billing_v1_BillingAccount_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_billing_v1_BillingAccount_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_BillingAccount_descriptor, + new java.lang.String[] { + "Name", "Open", "DisplayName", "MasterBillingAccount", + }); + internal_static_google_cloud_billing_v1_ProjectBillingInfo_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_billing_v1_ProjectBillingInfo_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ProjectBillingInfo_descriptor, + new java.lang.String[] { + "Name", "ProjectId", "BillingAccountName", "BillingEnabled", + }); + internal_static_google_cloud_billing_v1_GetBillingAccountRequest_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_billing_v1_GetBillingAccountRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_GetBillingAccountRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_descriptor, + new java.lang.String[] { + "PageSize", "PageToken", "Filter", + }); + internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_descriptor, + new java.lang.String[] { + "BillingAccounts", "NextPageToken", + }); + internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_descriptor, + new java.lang.String[] { + "BillingAccount", + }); + internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_descriptor, + new java.lang.String[] { + "Name", "Account", "UpdateMask", + }); + internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_descriptor, + new java.lang.String[] { + "Name", "PageSize", "PageToken", + }); + internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_descriptor, + new java.lang.String[] { + "ProjectBillingInfo", "NextPageToken", + }); + internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_descriptor, + new java.lang.String[] { + "Name", "ProjectBillingInfo", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resourceReference); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.iam.v1.IamPolicyProto.getDescriptor(); + com.google.iam.v1.PolicyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudCatalogProto.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudCatalogProto.java new file mode 100644 index 00000000..cfc74942 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudCatalogProto.java @@ -0,0 +1,292 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public final class CloudCatalogProto { + private CloudCatalogProto() {} + + 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_v1_Service_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_Service_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_Sku_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_Sku_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_Category_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_Category_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_PricingInfo_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_PricingInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_PricingExpression_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_PricingExpression_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_PricingExpression_TierRate_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_PricingExpression_TierRate_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_AggregationInfo_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_AggregationInfo_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ListServicesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ListServicesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ListServicesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ListServicesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ListSkusRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ListSkusRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_billing_v1_ListSkusResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_billing_v1_ListSkusResponse_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n+google/cloud/billing/v1/cloud_catalog." + + "proto\022\027google.cloud.billing.v1\032\034google/a" + + "pi/annotations.proto\032\027google/api/client." + + "proto\032\037google/api/field_behavior.proto\032\031" + + "google/api/resource.proto\032\037google/protob" + + "uf/timestamp.proto\032\027google/type/money.pr" + + "oto\"\235\001\n\007Service\022\014\n\004name\030\001 \001(\t\022\022\n\nservice" + + "_id\030\002 \001(\t\022\024\n\014display_name\030\003 \001(\t\022\034\n\024busin" + + "ess_entity_name\030\004 \001(\t:<\352A9\n#cloudbilling" + + ".googleapis.com/Service\022\022services/{servi" + + "ce}\"\246\002\n\003Sku\022\014\n\004name\030\001 \001(\t\022\016\n\006sku_id\030\002 \001(" + + "\t\022\023\n\013description\030\003 \001(\t\0223\n\010category\030\004 \001(\013" + + "2!.google.cloud.billing.v1.Category\022\027\n\017s" + + "ervice_regions\030\005 \003(\t\022:\n\014pricing_info\030\006 \003" + + "(\0132$.google.cloud.billing.v1.PricingInfo" + + "\022\035\n\025service_provider_name\030\007 \001(\t:C\352A@\n\037cl" + + "oudbilling.googleapis.com/Sku\022\035services/" + + "{service}/skus/{sku}\"m\n\010Category\022\034\n\024serv" + + "ice_display_name\030\001 \001(\t\022\027\n\017resource_famil" + + "y\030\002 \001(\t\022\026\n\016resource_group\030\003 \001(\t\022\022\n\nusage" + + "_type\030\004 \001(\t\"\200\002\n\013PricingInfo\0222\n\016effective" + + "_time\030\001 \001(\0132\032.google.protobuf.Timestamp\022" + + "\017\n\007summary\030\002 \001(\t\022F\n\022pricing_expression\030\003" + + " \001(\0132*.google.cloud.billing.v1.PricingEx" + + "pression\022B\n\020aggregation_info\030\004 \001(\0132(.goo" + + "gle.cloud.billing.v1.AggregationInfo\022 \n\030" + + "currency_conversion_rate\030\005 \001(\001\"\323\002\n\021Prici" + + "ngExpression\022\022\n\nusage_unit\030\001 \001(\t\022\036\n\026usag" + + "e_unit_description\030\004 \001(\t\022\021\n\tbase_unit\030\005 " + + "\001(\t\022\035\n\025base_unit_description\030\006 \001(\t\022#\n\033ba" + + "se_unit_conversion_factor\030\007 \001(\001\022\030\n\020displ" + + "ay_quantity\030\002 \001(\001\022I\n\014tiered_rates\030\003 \003(\0132" + + "3.google.cloud.billing.v1.PricingExpress" + + "ion.TierRate\032N\n\010TierRate\022\032\n\022start_usage_" + + "amount\030\001 \001(\001\022&\n\nunit_price\030\002 \001(\0132\022.googl" + + "e.type.Money\"\204\003\n\017AggregationInfo\022T\n\021aggr" + + "egation_level\030\001 \001(\01629.google.cloud.billi" + + "ng.v1.AggregationInfo.AggregationLevel\022Z" + + "\n\024aggregation_interval\030\002 \001(\0162<.google.cl" + + "oud.billing.v1.AggregationInfo.Aggregati" + + "onInterval\022\031\n\021aggregation_count\030\003 \001(\005\"O\n" + + "\020AggregationLevel\022!\n\035AGGREGATION_LEVEL_U" + + "NSPECIFIED\020\000\022\013\n\007ACCOUNT\020\001\022\013\n\007PROJECT\020\002\"S" + + "\n\023AggregationInterval\022$\n AGGREGATION_INT" + + "ERVAL_UNSPECIFIED\020\000\022\t\n\005DAILY\020\001\022\013\n\007MONTHL" + + "Y\020\002\"<\n\023ListServicesRequest\022\021\n\tpage_size\030" + + "\001 \001(\005\022\022\n\npage_token\030\002 \001(\t\"c\n\024ListService" + + "sResponse\0222\n\010services\030\001 \003(\0132 .google.clo" + + "ud.billing.v1.Service\022\027\n\017next_page_token" + + "\030\002 \001(\t\"\352\001\n\017ListSkusRequest\022;\n\006parent\030\001 \001" + + "(\tB+\340A\002\372A%\n#cloudbilling.googleapis.com/" + + "Service\022.\n\nstart_time\030\002 \001(\0132\032.google.pro" + + "tobuf.Timestamp\022,\n\010end_time\030\003 \001(\0132\032.goog" + + "le.protobuf.Timestamp\022\025\n\rcurrency_code\030\004" + + " \001(\t\022\021\n\tpage_size\030\005 \001(\005\022\022\n\npage_token\030\006 " + + "\001(\t\"W\n\020ListSkusResponse\022*\n\004skus\030\001 \003(\0132\034." + + "google.cloud.billing.v1.Sku\022\027\n\017next_page" + + "_token\030\002 \001(\t2\367\002\n\014CloudCatalog\022\204\001\n\014ListSe" + + "rvices\022,.google.cloud.billing.v1.ListSer" + + "vicesRequest\032-.google.cloud.billing.v1.L" + + "istServicesResponse\"\027\202\323\344\223\002\016\022\014/v1/service" + + "s\332A\000\022\216\001\n\010ListSkus\022(.google.cloud.billing" + + ".v1.ListSkusRequest\032).google.cloud.billi" + + "ng.v1.ListSkusResponse\"-\202\323\344\223\002\036\022\034/v1/{par" + + "ent=services/*}/skus\332A\006parent\032O\312A\033cloudb" + + "illing.googleapis.com\322A.https://www.goog" + + "leapis.com/auth/cloud-platformB\226\001\n\033com.g" + + "oogle.cloud.billing.v1B\021CloudCatalogProt" + + "oP\001Z>google.golang.org/genproto/googleap" + + "is/cloud/billing/v1;billing\242\002\007CLDCTLG\252\002\027" + + "Google.Cloud.Billing.V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.api.AnnotationsProto.getDescriptor(), + com.google.api.ClientProto.getDescriptor(), + com.google.api.FieldBehaviorProto.getDescriptor(), + com.google.api.ResourceProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + com.google.type.MoneyProto.getDescriptor(), + }); + internal_static_google_cloud_billing_v1_Service_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_billing_v1_Service_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_Service_descriptor, + new java.lang.String[] { + "Name", "ServiceId", "DisplayName", "BusinessEntityName", + }); + internal_static_google_cloud_billing_v1_Sku_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_billing_v1_Sku_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_Sku_descriptor, + new java.lang.String[] { + "Name", + "SkuId", + "Description", + "Category", + "ServiceRegions", + "PricingInfo", + "ServiceProviderName", + }); + internal_static_google_cloud_billing_v1_Category_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_billing_v1_Category_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_Category_descriptor, + new java.lang.String[] { + "ServiceDisplayName", "ResourceFamily", "ResourceGroup", "UsageType", + }); + internal_static_google_cloud_billing_v1_PricingInfo_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_billing_v1_PricingInfo_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_PricingInfo_descriptor, + new java.lang.String[] { + "EffectiveTime", + "Summary", + "PricingExpression", + "AggregationInfo", + "CurrencyConversionRate", + }); + internal_static_google_cloud_billing_v1_PricingExpression_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_google_cloud_billing_v1_PricingExpression_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_PricingExpression_descriptor, + new java.lang.String[] { + "UsageUnit", + "UsageUnitDescription", + "BaseUnit", + "BaseUnitDescription", + "BaseUnitConversionFactor", + "DisplayQuantity", + "TieredRates", + }); + internal_static_google_cloud_billing_v1_PricingExpression_TierRate_descriptor = + internal_static_google_cloud_billing_v1_PricingExpression_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_billing_v1_PricingExpression_TierRate_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_PricingExpression_TierRate_descriptor, + new java.lang.String[] { + "StartUsageAmount", "UnitPrice", + }); + internal_static_google_cloud_billing_v1_AggregationInfo_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_google_cloud_billing_v1_AggregationInfo_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_AggregationInfo_descriptor, + new java.lang.String[] { + "AggregationLevel", "AggregationInterval", "AggregationCount", + }); + internal_static_google_cloud_billing_v1_ListServicesRequest_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_google_cloud_billing_v1_ListServicesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ListServicesRequest_descriptor, + new java.lang.String[] { + "PageSize", "PageToken", + }); + internal_static_google_cloud_billing_v1_ListServicesResponse_descriptor = + getDescriptor().getMessageTypes().get(7); + internal_static_google_cloud_billing_v1_ListServicesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ListServicesResponse_descriptor, + new java.lang.String[] { + "Services", "NextPageToken", + }); + internal_static_google_cloud_billing_v1_ListSkusRequest_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_billing_v1_ListSkusRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ListSkusRequest_descriptor, + new java.lang.String[] { + "Parent", "StartTime", "EndTime", "CurrencyCode", "PageSize", "PageToken", + }); + internal_static_google_cloud_billing_v1_ListSkusResponse_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_billing_v1_ListSkusResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_billing_v1_ListSkusResponse_descriptor, + new java.lang.String[] { + "Skus", "NextPageToken", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.ClientProto.defaultHost); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.AnnotationsProto.http); + registry.add(com.google.api.ClientProto.methodSignature); + registry.add(com.google.api.ClientProto.oauthScopes); + registry.add(com.google.api.ResourceProto.resource); + registry.add(com.google.api.ResourceProto.resourceReference); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); + com.google.api.AnnotationsProto.getDescriptor(); + com.google.api.ClientProto.getDescriptor(); + com.google.api.FieldBehaviorProto.getDescriptor(); + com.google.api.ResourceProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + com.google.type.MoneyProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CreateBillingAccountRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CreateBillingAccountRequest.java new file mode 100644 index 00000000..9efec0e8 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CreateBillingAccountRequest.java @@ -0,0 +1,792 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `CreateBillingAccount`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.CreateBillingAccountRequest} + */ +public final class CreateBillingAccountRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.CreateBillingAccountRequest) + CreateBillingAccountRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateBillingAccountRequest.newBuilder() to construct. + private CreateBillingAccountRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateBillingAccountRequest() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateBillingAccountRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private CreateBillingAccountRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.billing.v1.BillingAccount.Builder subBuilder = null; + if (billingAccount_ != null) { + subBuilder = billingAccount_.toBuilder(); + } + billingAccount_ = + input.readMessage( + com.google.cloud.billing.v1.BillingAccount.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(billingAccount_); + billingAccount_ = 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.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.CreateBillingAccountRequest.class, + com.google.cloud.billing.v1.CreateBillingAccountRequest.Builder.class); + } + + public static final int BILLING_ACCOUNT_FIELD_NUMBER = 1; + private com.google.cloud.billing.v1.BillingAccount billingAccount_; + /** + * + * + *
+   * Required. The billing account resource to create.
+   * Currently CreateBillingAccount only supports subaccount creation, so
+   * any created billing accounts must be under a provided master billing
+   * account.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the billingAccount field is set. + */ + public boolean hasBillingAccount() { + return billingAccount_ != null; + } + /** + * + * + *
+   * Required. The billing account resource to create.
+   * Currently CreateBillingAccount only supports subaccount creation, so
+   * any created billing accounts must be under a provided master billing
+   * account.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The billingAccount. + */ + public com.google.cloud.billing.v1.BillingAccount getBillingAccount() { + return billingAccount_ == null + ? com.google.cloud.billing.v1.BillingAccount.getDefaultInstance() + : billingAccount_; + } + /** + * + * + *
+   * Required. The billing account resource to create.
+   * Currently CreateBillingAccount only supports subaccount creation, so
+   * any created billing accounts must be under a provided master billing
+   * account.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.v1.BillingAccountOrBuilder getBillingAccountOrBuilder() { + return getBillingAccount(); + } + + 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 (billingAccount_ != null) { + output.writeMessage(1, getBillingAccount()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (billingAccount_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getBillingAccount()); + } + 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.v1.CreateBillingAccountRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.CreateBillingAccountRequest other = + (com.google.cloud.billing.v1.CreateBillingAccountRequest) obj; + + if (hasBillingAccount() != other.hasBillingAccount()) return false; + if (hasBillingAccount()) { + if (!getBillingAccount().equals(other.getBillingAccount())) 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 (hasBillingAccount()) { + hash = (37 * hash) + BILLING_ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getBillingAccount().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest 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.v1.CreateBillingAccountRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest 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.v1.CreateBillingAccountRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest 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.v1.CreateBillingAccountRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest 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.v1.CreateBillingAccountRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest 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.v1.CreateBillingAccountRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `CreateBillingAccount`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.CreateBillingAccountRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.CreateBillingAccountRequest) + com.google.cloud.billing.v1.CreateBillingAccountRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.CreateBillingAccountRequest.class, + com.google.cloud.billing.v1.CreateBillingAccountRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.CreateBillingAccountRequest.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 (billingAccountBuilder_ == null) { + billingAccount_ = null; + } else { + billingAccount_ = null; + billingAccountBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_CreateBillingAccountRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.CreateBillingAccountRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.CreateBillingAccountRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.CreateBillingAccountRequest build() { + com.google.cloud.billing.v1.CreateBillingAccountRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.CreateBillingAccountRequest buildPartial() { + com.google.cloud.billing.v1.CreateBillingAccountRequest result = + new com.google.cloud.billing.v1.CreateBillingAccountRequest(this); + if (billingAccountBuilder_ == null) { + result.billingAccount_ = billingAccount_; + } else { + result.billingAccount_ = billingAccountBuilder_.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.v1.CreateBillingAccountRequest) { + return mergeFrom((com.google.cloud.billing.v1.CreateBillingAccountRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.CreateBillingAccountRequest other) { + if (other == com.google.cloud.billing.v1.CreateBillingAccountRequest.getDefaultInstance()) + return this; + if (other.hasBillingAccount()) { + mergeBillingAccount(other.getBillingAccount()); + } + 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.v1.CreateBillingAccountRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.CreateBillingAccountRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.cloud.billing.v1.BillingAccount billingAccount_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder> + billingAccountBuilder_; + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the billingAccount field is set. + */ + public boolean hasBillingAccount() { + return billingAccountBuilder_ != null || billingAccount_ != null; + } + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The billingAccount. + */ + public com.google.cloud.billing.v1.BillingAccount getBillingAccount() { + if (billingAccountBuilder_ == null) { + return billingAccount_ == null + ? com.google.cloud.billing.v1.BillingAccount.getDefaultInstance() + : billingAccount_; + } else { + return billingAccountBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBillingAccount(com.google.cloud.billing.v1.BillingAccount value) { + if (billingAccountBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + billingAccount_ = value; + onChanged(); + } else { + billingAccountBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setBillingAccount( + com.google.cloud.billing.v1.BillingAccount.Builder builderForValue) { + if (billingAccountBuilder_ == null) { + billingAccount_ = builderForValue.build(); + onChanged(); + } else { + billingAccountBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeBillingAccount(com.google.cloud.billing.v1.BillingAccount value) { + if (billingAccountBuilder_ == null) { + if (billingAccount_ != null) { + billingAccount_ = + com.google.cloud.billing.v1.BillingAccount.newBuilder(billingAccount_) + .mergeFrom(value) + .buildPartial(); + } else { + billingAccount_ = value; + } + onChanged(); + } else { + billingAccountBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearBillingAccount() { + if (billingAccountBuilder_ == null) { + billingAccount_ = null; + onChanged(); + } else { + billingAccount_ = null; + billingAccountBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.v1.BillingAccount.Builder getBillingAccountBuilder() { + + onChanged(); + return getBillingAccountFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.v1.BillingAccountOrBuilder getBillingAccountOrBuilder() { + if (billingAccountBuilder_ != null) { + return billingAccountBuilder_.getMessageOrBuilder(); + } else { + return billingAccount_ == null + ? com.google.cloud.billing.v1.BillingAccount.getDefaultInstance() + : billingAccount_; + } + } + /** + * + * + *
+     * Required. The billing account resource to create.
+     * Currently CreateBillingAccount only supports subaccount creation, so
+     * any created billing accounts must be under a provided master billing
+     * account.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder> + getBillingAccountFieldBuilder() { + if (billingAccountBuilder_ == null) { + billingAccountBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder>( + getBillingAccount(), getParentForChildren(), isClean()); + billingAccount_ = null; + } + return billingAccountBuilder_; + } + + @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.v1.CreateBillingAccountRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.CreateBillingAccountRequest) + private static final com.google.cloud.billing.v1.CreateBillingAccountRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.CreateBillingAccountRequest(); + } + + public static com.google.cloud.billing.v1.CreateBillingAccountRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateBillingAccountRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new CreateBillingAccountRequest(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.v1.CreateBillingAccountRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CreateBillingAccountRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CreateBillingAccountRequestOrBuilder.java new file mode 100644 index 00000000..32ed78c3 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CreateBillingAccountRequestOrBuilder.java @@ -0,0 +1,75 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface CreateBillingAccountRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.CreateBillingAccountRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The billing account resource to create.
+   * Currently CreateBillingAccount only supports subaccount creation, so
+   * any created billing accounts must be under a provided master billing
+   * account.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the billingAccount field is set. + */ + boolean hasBillingAccount(); + /** + * + * + *
+   * Required. The billing account resource to create.
+   * Currently CreateBillingAccount only supports subaccount creation, so
+   * any created billing accounts must be under a provided master billing
+   * account.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The billingAccount. + */ + com.google.cloud.billing.v1.BillingAccount getBillingAccount(); + /** + * + * + *
+   * Required. The billing account resource to create.
+   * Currently CreateBillingAccount only supports subaccount creation, so
+   * any created billing accounts must be under a provided master billing
+   * account.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount billing_account = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.v1.BillingAccountOrBuilder getBillingAccountOrBuilder(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetBillingAccountRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetBillingAccountRequest.java new file mode 100644 index 00000000..013922ca --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetBillingAccountRequest.java @@ -0,0 +1,655 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `GetBillingAccount`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.GetBillingAccountRequest} + */ +public final class GetBillingAccountRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.GetBillingAccountRequest) + GetBillingAccountRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetBillingAccountRequest.newBuilder() to construct. + private GetBillingAccountRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetBillingAccountRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetBillingAccountRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetBillingAccountRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetBillingAccountRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetBillingAccountRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.GetBillingAccountRequest.class, + com.google.cloud.billing.v1.GetBillingAccountRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the billing account to retrieve. For example,
+   * `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the billing account to retrieve. For example,
+   * `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof 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.v1.GetBillingAccountRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.GetBillingAccountRequest other = + (com.google.cloud.billing.v1.GetBillingAccountRequest) 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.v1.GetBillingAccountRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.GetBillingAccountRequest 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.v1.GetBillingAccountRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.GetBillingAccountRequest 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.v1.GetBillingAccountRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.GetBillingAccountRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.GetBillingAccountRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.GetBillingAccountRequest 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.v1.GetBillingAccountRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.GetBillingAccountRequest 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.v1.GetBillingAccountRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.GetBillingAccountRequest 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.v1.GetBillingAccountRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `GetBillingAccount`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.GetBillingAccountRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.GetBillingAccountRequest) + com.google.cloud.billing.v1.GetBillingAccountRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetBillingAccountRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetBillingAccountRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.GetBillingAccountRequest.class, + com.google.cloud.billing.v1.GetBillingAccountRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.GetBillingAccountRequest.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.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetBillingAccountRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.GetBillingAccountRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.GetBillingAccountRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.GetBillingAccountRequest build() { + com.google.cloud.billing.v1.GetBillingAccountRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.GetBillingAccountRequest buildPartial() { + com.google.cloud.billing.v1.GetBillingAccountRequest result = + new com.google.cloud.billing.v1.GetBillingAccountRequest(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.v1.GetBillingAccountRequest) { + return mergeFrom((com.google.cloud.billing.v1.GetBillingAccountRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.GetBillingAccountRequest other) { + if (other == com.google.cloud.billing.v1.GetBillingAccountRequest.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.v1.GetBillingAccountRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.GetBillingAccountRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the billing account to retrieve. For example,
+     * `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the billing account to retrieve. For example,
+     * `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the billing account to retrieve. For example,
+     * `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the billing account to retrieve. For example,
+     * `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the billing account to retrieve. For example,
+     * `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.GetBillingAccountRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.GetBillingAccountRequest) + private static final com.google.cloud.billing.v1.GetBillingAccountRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.GetBillingAccountRequest(); + } + + public static com.google.cloud.billing.v1.GetBillingAccountRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetBillingAccountRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetBillingAccountRequest(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.v1.GetBillingAccountRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetBillingAccountRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetBillingAccountRequestOrBuilder.java new file mode 100644 index 00000000..c363f300 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetBillingAccountRequestOrBuilder.java @@ -0,0 +1,56 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface GetBillingAccountRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.GetBillingAccountRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the billing account to retrieve. For example,
+   * `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the billing account to retrieve. For example,
+   * `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetProjectBillingInfoRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetProjectBillingInfoRequest.java new file mode 100644 index 00000000..ae4e3d33 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetProjectBillingInfoRequest.java @@ -0,0 +1,642 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `GetProjectBillingInfo`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.GetProjectBillingInfoRequest} + */ +public final class GetProjectBillingInfoRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.GetProjectBillingInfoRequest) + GetProjectBillingInfoRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetProjectBillingInfoRequest.newBuilder() to construct. + private GetProjectBillingInfoRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetProjectBillingInfoRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetProjectBillingInfoRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private GetProjectBillingInfoRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.GetProjectBillingInfoRequest.class, + com.google.cloud.billing.v1.GetProjectBillingInfoRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the project for which billing information is
+   * retrieved. For example, `projects/tokyo-rain-123`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the project for which billing information is
+   * retrieved. For example, `projects/tokyo-rain-123`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof 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.v1.GetProjectBillingInfoRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.GetProjectBillingInfoRequest other = + (com.google.cloud.billing.v1.GetProjectBillingInfoRequest) 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.v1.GetProjectBillingInfoRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.GetProjectBillingInfoRequest 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.v1.GetProjectBillingInfoRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.GetProjectBillingInfoRequest 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.v1.GetProjectBillingInfoRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.GetProjectBillingInfoRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.GetProjectBillingInfoRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.GetProjectBillingInfoRequest 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.v1.GetProjectBillingInfoRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.GetProjectBillingInfoRequest 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.v1.GetProjectBillingInfoRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.GetProjectBillingInfoRequest 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.v1.GetProjectBillingInfoRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `GetProjectBillingInfo`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.GetProjectBillingInfoRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.GetProjectBillingInfoRequest) + com.google.cloud.billing.v1.GetProjectBillingInfoRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.GetProjectBillingInfoRequest.class, + com.google.cloud.billing.v1.GetProjectBillingInfoRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.GetProjectBillingInfoRequest.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.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_GetProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.GetProjectBillingInfoRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.GetProjectBillingInfoRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.GetProjectBillingInfoRequest build() { + com.google.cloud.billing.v1.GetProjectBillingInfoRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.GetProjectBillingInfoRequest buildPartial() { + com.google.cloud.billing.v1.GetProjectBillingInfoRequest result = + new com.google.cloud.billing.v1.GetProjectBillingInfoRequest(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.v1.GetProjectBillingInfoRequest) { + return mergeFrom((com.google.cloud.billing.v1.GetProjectBillingInfoRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.GetProjectBillingInfoRequest other) { + if (other == com.google.cloud.billing.v1.GetProjectBillingInfoRequest.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.v1.GetProjectBillingInfoRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.GetProjectBillingInfoRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the project for which billing information is
+     * retrieved. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the project for which billing information is
+     * retrieved. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the project for which billing information is
+     * retrieved. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the project for which billing information is
+     * retrieved. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the project for which billing information is
+     * retrieved. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + @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.v1.GetProjectBillingInfoRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.GetProjectBillingInfoRequest) + private static final com.google.cloud.billing.v1.GetProjectBillingInfoRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.GetProjectBillingInfoRequest(); + } + + public static com.google.cloud.billing.v1.GetProjectBillingInfoRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetProjectBillingInfoRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new GetProjectBillingInfoRequest(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.v1.GetProjectBillingInfoRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetProjectBillingInfoRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetProjectBillingInfoRequestOrBuilder.java new file mode 100644 index 00000000..bd1d3ba4 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetProjectBillingInfoRequestOrBuilder.java @@ -0,0 +1,52 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface GetProjectBillingInfoRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.GetProjectBillingInfoRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the project for which billing information is
+   * retrieved. For example, `projects/tokyo-rain-123`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the project for which billing information is
+   * retrieved. For example, `projects/tokyo-rain-123`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsRequest.java new file mode 100644 index 00000000..1d8139bf --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsRequest.java @@ -0,0 +1,953 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `ListBillingAccounts`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListBillingAccountsRequest} + */ +public final class ListBillingAccountsRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ListBillingAccountsRequest) + ListBillingAccountsRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListBillingAccountsRequest.newBuilder() to construct. + private ListBillingAccountsRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListBillingAccountsRequest() { + pageToken_ = ""; + filter_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListBillingAccountsRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListBillingAccountsRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + pageSize_ = input.readInt32(); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + pageToken_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + filter_ = 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.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListBillingAccountsRequest.class, + com.google.cloud.billing.v1.ListBillingAccountsRequest.Builder.class); + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 1; + private int pageSize_; + /** + * + * + *
+   * Requested page size. The maximum page size is 100; this is also the
+   * default.
+   * 
+ * + * int32 page_size = 1; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListBillingAccounts`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 2; + * + * @return The pageToken. + */ + 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; + } + } + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListBillingAccounts`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 2; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int FILTER_FIELD_NUMBER = 3; + private volatile java.lang.Object filter_; + /** + * + * + *
+   * Options for how to filter the returned billing accounts.
+   * Currently this only supports filtering for
+   * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+   * single provided reseller billing account.
+   * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+   * Boolean algebra and other fields are not currently supported.
+   * 
+ * + * string filter = 3; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } + } + /** + * + * + *
+   * Options for how to filter the returned billing accounts.
+   * Currently this only supports filtering for
+   * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+   * single provided reseller billing account.
+   * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+   * Boolean algebra and other fields are not currently supported.
+   * 
+ * + * string filter = 3; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (pageSize_ != 0) { + output.writeInt32(1, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, pageToken_); + } + if (!getFilterBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, filter_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, pageToken_); + } + if (!getFilterBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, filter_); + } + 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.v1.ListBillingAccountsRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ListBillingAccountsRequest other = + (com.google.cloud.billing.v1.ListBillingAccountsRequest) obj; + + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getFilter().equals(other.getFilter())) 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) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (37 * hash) + FILTER_FIELD_NUMBER; + hash = (53 * hash) + getFilter().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest 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.v1.ListBillingAccountsRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest 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.v1.ListBillingAccountsRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest 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.v1.ListBillingAccountsRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest 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.v1.ListBillingAccountsRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest 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.v1.ListBillingAccountsRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `ListBillingAccounts`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListBillingAccountsRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ListBillingAccountsRequest) + com.google.cloud.billing.v1.ListBillingAccountsRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListBillingAccountsRequest.class, + com.google.cloud.billing.v1.ListBillingAccountsRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ListBillingAccountsRequest.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(); + pageSize_ = 0; + + pageToken_ = ""; + + filter_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListBillingAccountsRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ListBillingAccountsRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListBillingAccountsRequest build() { + com.google.cloud.billing.v1.ListBillingAccountsRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListBillingAccountsRequest buildPartial() { + com.google.cloud.billing.v1.ListBillingAccountsRequest result = + new com.google.cloud.billing.v1.ListBillingAccountsRequest(this); + result.pageSize_ = pageSize_; + result.pageToken_ = pageToken_; + result.filter_ = filter_; + 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.v1.ListBillingAccountsRequest) { + return mergeFrom((com.google.cloud.billing.v1.ListBillingAccountsRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ListBillingAccountsRequest other) { + if (other == com.google.cloud.billing.v1.ListBillingAccountsRequest.getDefaultInstance()) + return this; + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + onChanged(); + } + if (!other.getFilter().isEmpty()) { + filter_ = other.filter_; + 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.v1.ListBillingAccountsRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.ListBillingAccountsRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Requested page size. The maximum page size is 100; this is also the
+     * default.
+     * 
+ * + * int32 page_size = 1; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Requested page size. The maximum page size is 100; this is also the
+     * default.
+     * 
+ * + * int32 page_size = 1; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Requested page size. The maximum page size is 100; this is also the
+     * default.
+     * 
+ * + * int32 page_size = 1; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListBillingAccounts`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListBillingAccounts`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListBillingAccounts`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListBillingAccounts`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListBillingAccounts`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + private java.lang.Object filter_ = ""; + /** + * + * + *
+     * Options for how to filter the returned billing accounts.
+     * Currently this only supports filtering for
+     * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+     * single provided reseller billing account.
+     * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+     * Boolean algebra and other fields are not currently supported.
+     * 
+ * + * string filter = 3; + * + * @return The filter. + */ + public java.lang.String getFilter() { + java.lang.Object ref = filter_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + filter_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Options for how to filter the returned billing accounts.
+     * Currently this only supports filtering for
+     * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+     * single provided reseller billing account.
+     * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+     * Boolean algebra and other fields are not currently supported.
+     * 
+ * + * string filter = 3; + * + * @return The bytes for filter. + */ + public com.google.protobuf.ByteString getFilterBytes() { + java.lang.Object ref = filter_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + filter_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Options for how to filter the returned billing accounts.
+     * Currently this only supports filtering for
+     * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+     * single provided reseller billing account.
+     * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+     * Boolean algebra and other fields are not currently supported.
+     * 
+ * + * string filter = 3; + * + * @param value The filter to set. + * @return This builder for chaining. + */ + public Builder setFilter(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + filter_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Options for how to filter the returned billing accounts.
+     * Currently this only supports filtering for
+     * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+     * single provided reseller billing account.
+     * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+     * Boolean algebra and other fields are not currently supported.
+     * 
+ * + * string filter = 3; + * + * @return This builder for chaining. + */ + public Builder clearFilter() { + + filter_ = getDefaultInstance().getFilter(); + onChanged(); + return this; + } + /** + * + * + *
+     * Options for how to filter the returned billing accounts.
+     * Currently this only supports filtering for
+     * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+     * single provided reseller billing account.
+     * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+     * Boolean algebra and other fields are not currently supported.
+     * 
+ * + * string filter = 3; + * + * @param value The bytes for filter to set. + * @return This builder for chaining. + */ + public Builder setFilterBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + filter_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ListBillingAccountsRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ListBillingAccountsRequest) + private static final com.google.cloud.billing.v1.ListBillingAccountsRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ListBillingAccountsRequest(); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListBillingAccountsRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListBillingAccountsRequest(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.v1.ListBillingAccountsRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsRequestOrBuilder.java new file mode 100644 index 00000000..3905e078 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsRequestOrBuilder.java @@ -0,0 +1,103 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface ListBillingAccountsRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ListBillingAccountsRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Requested page size. The maximum page size is 100; this is also the
+   * default.
+   * 
+ * + * int32 page_size = 1; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListBillingAccounts`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 2; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListBillingAccounts`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 2; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); + + /** + * + * + *
+   * Options for how to filter the returned billing accounts.
+   * Currently this only supports filtering for
+   * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+   * single provided reseller billing account.
+   * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+   * Boolean algebra and other fields are not currently supported.
+   * 
+ * + * string filter = 3; + * + * @return The filter. + */ + java.lang.String getFilter(); + /** + * + * + *
+   * Options for how to filter the returned billing accounts.
+   * Currently this only supports filtering for
+   * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a
+   * single provided reseller billing account.
+   * (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF").
+   * Boolean algebra and other fields are not currently supported.
+   * 
+ * + * string filter = 3; + * + * @return The bytes for filter. + */ + com.google.protobuf.ByteString getFilterBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsResponse.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsResponse.java new file mode 100644 index 00000000..2861d14b --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsResponse.java @@ -0,0 +1,1144 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Response message for `ListBillingAccounts`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListBillingAccountsResponse} + */ +public final class ListBillingAccountsResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ListBillingAccountsResponse) + ListBillingAccountsResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListBillingAccountsResponse.newBuilder() to construct. + private ListBillingAccountsResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListBillingAccountsResponse() { + billingAccounts_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListBillingAccountsResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListBillingAccountsResponse( + 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)) { + billingAccounts_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + billingAccounts_.add( + input.readMessage( + com.google.cloud.billing.v1.BillingAccount.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)) { + billingAccounts_ = java.util.Collections.unmodifiableList(billingAccounts_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListBillingAccountsResponse.class, + com.google.cloud.billing.v1.ListBillingAccountsResponse.Builder.class); + } + + public static final int BILLING_ACCOUNTS_FIELD_NUMBER = 1; + private java.util.List billingAccounts_; + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public java.util.List getBillingAccountsList() { + return billingAccounts_; + } + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public java.util.List + getBillingAccountsOrBuilderList() { + return billingAccounts_; + } + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public int getBillingAccountsCount() { + return billingAccounts_.size(); + } + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public com.google.cloud.billing.v1.BillingAccount getBillingAccounts(int index) { + return billingAccounts_.get(index); + } + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public com.google.cloud.billing.v1.BillingAccountOrBuilder getBillingAccountsOrBuilder( + int index) { + return billingAccounts_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListBillingAccounts` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListBillingAccounts` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + 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 < billingAccounts_.size(); i++) { + output.writeMessage(1, billingAccounts_.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 < billingAccounts_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, billingAccounts_.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.v1.ListBillingAccountsResponse)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ListBillingAccountsResponse other = + (com.google.cloud.billing.v1.ListBillingAccountsResponse) obj; + + if (!getBillingAccountsList().equals(other.getBillingAccountsList())) 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 (getBillingAccountsCount() > 0) { + hash = (37 * hash) + BILLING_ACCOUNTS_FIELD_NUMBER; + hash = (53 * hash) + getBillingAccountsList().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.v1.ListBillingAccountsResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsResponse 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.v1.ListBillingAccountsResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsResponse 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.v1.ListBillingAccountsResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsResponse 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.v1.ListBillingAccountsResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsResponse 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.v1.ListBillingAccountsResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsResponse 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.v1.ListBillingAccountsResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for `ListBillingAccounts`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListBillingAccountsResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ListBillingAccountsResponse) + com.google.cloud.billing.v1.ListBillingAccountsResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListBillingAccountsResponse.class, + com.google.cloud.billing.v1.ListBillingAccountsResponse.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ListBillingAccountsResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getBillingAccountsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (billingAccountsBuilder_ == null) { + billingAccounts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + billingAccountsBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListBillingAccountsResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListBillingAccountsResponse getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ListBillingAccountsResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListBillingAccountsResponse build() { + com.google.cloud.billing.v1.ListBillingAccountsResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListBillingAccountsResponse buildPartial() { + com.google.cloud.billing.v1.ListBillingAccountsResponse result = + new com.google.cloud.billing.v1.ListBillingAccountsResponse(this); + int from_bitField0_ = bitField0_; + if (billingAccountsBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + billingAccounts_ = java.util.Collections.unmodifiableList(billingAccounts_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.billingAccounts_ = billingAccounts_; + } else { + result.billingAccounts_ = billingAccountsBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.v1.ListBillingAccountsResponse) { + return mergeFrom((com.google.cloud.billing.v1.ListBillingAccountsResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ListBillingAccountsResponse other) { + if (other == com.google.cloud.billing.v1.ListBillingAccountsResponse.getDefaultInstance()) + return this; + if (billingAccountsBuilder_ == null) { + if (!other.billingAccounts_.isEmpty()) { + if (billingAccounts_.isEmpty()) { + billingAccounts_ = other.billingAccounts_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureBillingAccountsIsMutable(); + billingAccounts_.addAll(other.billingAccounts_); + } + onChanged(); + } + } else { + if (!other.billingAccounts_.isEmpty()) { + if (billingAccountsBuilder_.isEmpty()) { + billingAccountsBuilder_.dispose(); + billingAccountsBuilder_ = null; + billingAccounts_ = other.billingAccounts_; + bitField0_ = (bitField0_ & ~0x00000001); + billingAccountsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getBillingAccountsFieldBuilder() + : null; + } else { + billingAccountsBuilder_.addAllMessages(other.billingAccounts_); + } + } + } + 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.v1.ListBillingAccountsResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.ListBillingAccountsResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List billingAccounts_ = + java.util.Collections.emptyList(); + + private void ensureBillingAccountsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + billingAccounts_ = + new java.util.ArrayList(billingAccounts_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder> + billingAccountsBuilder_; + + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public java.util.List getBillingAccountsList() { + if (billingAccountsBuilder_ == null) { + return java.util.Collections.unmodifiableList(billingAccounts_); + } else { + return billingAccountsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public int getBillingAccountsCount() { + if (billingAccountsBuilder_ == null) { + return billingAccounts_.size(); + } else { + return billingAccountsBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public com.google.cloud.billing.v1.BillingAccount getBillingAccounts(int index) { + if (billingAccountsBuilder_ == null) { + return billingAccounts_.get(index); + } else { + return billingAccountsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder setBillingAccounts(int index, com.google.cloud.billing.v1.BillingAccount value) { + if (billingAccountsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBillingAccountsIsMutable(); + billingAccounts_.set(index, value); + onChanged(); + } else { + billingAccountsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder setBillingAccounts( + int index, com.google.cloud.billing.v1.BillingAccount.Builder builderForValue) { + if (billingAccountsBuilder_ == null) { + ensureBillingAccountsIsMutable(); + billingAccounts_.set(index, builderForValue.build()); + onChanged(); + } else { + billingAccountsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder addBillingAccounts(com.google.cloud.billing.v1.BillingAccount value) { + if (billingAccountsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBillingAccountsIsMutable(); + billingAccounts_.add(value); + onChanged(); + } else { + billingAccountsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder addBillingAccounts(int index, com.google.cloud.billing.v1.BillingAccount value) { + if (billingAccountsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureBillingAccountsIsMutable(); + billingAccounts_.add(index, value); + onChanged(); + } else { + billingAccountsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder addBillingAccounts( + com.google.cloud.billing.v1.BillingAccount.Builder builderForValue) { + if (billingAccountsBuilder_ == null) { + ensureBillingAccountsIsMutable(); + billingAccounts_.add(builderForValue.build()); + onChanged(); + } else { + billingAccountsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder addBillingAccounts( + int index, com.google.cloud.billing.v1.BillingAccount.Builder builderForValue) { + if (billingAccountsBuilder_ == null) { + ensureBillingAccountsIsMutable(); + billingAccounts_.add(index, builderForValue.build()); + onChanged(); + } else { + billingAccountsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder addAllBillingAccounts( + java.lang.Iterable values) { + if (billingAccountsBuilder_ == null) { + ensureBillingAccountsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, billingAccounts_); + onChanged(); + } else { + billingAccountsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder clearBillingAccounts() { + if (billingAccountsBuilder_ == null) { + billingAccounts_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + billingAccountsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public Builder removeBillingAccounts(int index) { + if (billingAccountsBuilder_ == null) { + ensureBillingAccountsIsMutable(); + billingAccounts_.remove(index); + onChanged(); + } else { + billingAccountsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public com.google.cloud.billing.v1.BillingAccount.Builder getBillingAccountsBuilder(int index) { + return getBillingAccountsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public com.google.cloud.billing.v1.BillingAccountOrBuilder getBillingAccountsOrBuilder( + int index) { + if (billingAccountsBuilder_ == null) { + return billingAccounts_.get(index); + } else { + return billingAccountsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public java.util.List + getBillingAccountsOrBuilderList() { + if (billingAccountsBuilder_ != null) { + return billingAccountsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(billingAccounts_); + } + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public com.google.cloud.billing.v1.BillingAccount.Builder addBillingAccountsBuilder() { + return getBillingAccountsFieldBuilder() + .addBuilder(com.google.cloud.billing.v1.BillingAccount.getDefaultInstance()); + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public com.google.cloud.billing.v1.BillingAccount.Builder addBillingAccountsBuilder(int index) { + return getBillingAccountsFieldBuilder() + .addBuilder(index, com.google.cloud.billing.v1.BillingAccount.getDefaultInstance()); + } + /** + * + * + *
+     * A list of billing accounts.
+     * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + public java.util.List + getBillingAccountsBuilderList() { + return getBillingAccountsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder> + getBillingAccountsFieldBuilder() { + if (billingAccountsBuilder_ == null) { + billingAccountsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder>( + billingAccounts_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + billingAccounts_ = null; + } + return billingAccountsBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListBillingAccounts` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListBillingAccounts` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListBillingAccounts` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListBillingAccounts` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListBillingAccounts` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ListBillingAccountsResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ListBillingAccountsResponse) + private static final com.google.cloud.billing.v1.ListBillingAccountsResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ListBillingAccountsResponse(); + } + + public static com.google.cloud.billing.v1.ListBillingAccountsResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListBillingAccountsResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListBillingAccountsResponse(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.v1.ListBillingAccountsResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsResponseOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsResponseOrBuilder.java new file mode 100644 index 00000000..7c1d331f --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsResponseOrBuilder.java @@ -0,0 +1,106 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface ListBillingAccountsResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ListBillingAccountsResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + java.util.List getBillingAccountsList(); + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + com.google.cloud.billing.v1.BillingAccount getBillingAccounts(int index); + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + int getBillingAccountsCount(); + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + java.util.List + getBillingAccountsOrBuilderList(); + /** + * + * + *
+   * A list of billing accounts.
+   * 
+ * + * repeated .google.cloud.billing.v1.BillingAccount billing_accounts = 1; + */ + com.google.cloud.billing.v1.BillingAccountOrBuilder getBillingAccountsOrBuilder(int index); + + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListBillingAccounts` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListBillingAccounts` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoRequest.java new file mode 100644 index 00000000..04780938 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoRequest.java @@ -0,0 +1,939 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `ListProjectBillingInfo`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListProjectBillingInfoRequest} + */ +public final class ListProjectBillingInfoRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ListProjectBillingInfoRequest) + ListProjectBillingInfoRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListProjectBillingInfoRequest.newBuilder() to construct. + private ListProjectBillingInfoRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListProjectBillingInfoRequest() { + name_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListProjectBillingInfoRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListProjectBillingInfoRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 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.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListProjectBillingInfoRequest.class, + com.google.cloud.billing.v1.ListProjectBillingInfoRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the billing account associated with the projects that
+   * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the billing account associated with the projects that
+   * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof 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 PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_; + /** + * + * + *
+   * Requested page size. The maximum page size is 100; this is also the
+   * default.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A token identifying a page of results to be returned. This should be a
+   * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + 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; + } + } + /** + * + * + *
+   * A token identifying a page of results to be returned. This should be a
+   * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + 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 (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + 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 (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + 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.v1.ListProjectBillingInfoRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ListProjectBillingInfoRequest other = + (com.google.cloud.billing.v1.ListProjectBillingInfoRequest) obj; + + if (!getName().equals(other.getName())) 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) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().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.v1.ListProjectBillingInfoRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoRequest 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.v1.ListProjectBillingInfoRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoRequest 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.v1.ListProjectBillingInfoRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoRequest 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.v1.ListProjectBillingInfoRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoRequest 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.v1.ListProjectBillingInfoRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoRequest 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.v1.ListProjectBillingInfoRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `ListProjectBillingInfo`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListProjectBillingInfoRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ListProjectBillingInfoRequest) + com.google.cloud.billing.v1.ListProjectBillingInfoRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListProjectBillingInfoRequest.class, + com.google.cloud.billing.v1.ListProjectBillingInfoRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ListProjectBillingInfoRequest.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_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListProjectBillingInfoRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ListProjectBillingInfoRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListProjectBillingInfoRequest build() { + com.google.cloud.billing.v1.ListProjectBillingInfoRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListProjectBillingInfoRequest buildPartial() { + com.google.cloud.billing.v1.ListProjectBillingInfoRequest result = + new com.google.cloud.billing.v1.ListProjectBillingInfoRequest(this); + result.name_ = name_; + 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.v1.ListProjectBillingInfoRequest) { + return mergeFrom((com.google.cloud.billing.v1.ListProjectBillingInfoRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ListProjectBillingInfoRequest other) { + if (other == com.google.cloud.billing.v1.ListProjectBillingInfoRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + 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.v1.ListProjectBillingInfoRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.ListProjectBillingInfoRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the billing account associated with the projects that
+     * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the billing account associated with the projects that
+     * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the billing account associated with the projects that
+     * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the billing account associated with the projects that
+     * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the billing account associated with the projects that
+     * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Requested page size. The maximum page size is 100; this is also the
+     * default.
+     * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Requested page size. The maximum page size is 100; this is also the
+     * default.
+     * 
+ * + * int32 page_size = 2; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Requested page size. The maximum page size is 100; this is also the
+     * default.
+     * 
+ * + * int32 page_size = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A token identifying a page of results to be returned. This should be a
+     * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token identifying a page of results to be returned. This should be a
+     * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token identifying a page of results to be returned. This should be a
+     * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 3; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token identifying a page of results to be returned. This should be a
+     * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 3; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token identifying a page of results to be returned. This should be a
+     * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 3; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ListProjectBillingInfoRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ListProjectBillingInfoRequest) + private static final com.google.cloud.billing.v1.ListProjectBillingInfoRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ListProjectBillingInfoRequest(); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListProjectBillingInfoRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListProjectBillingInfoRequest(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.v1.ListProjectBillingInfoRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoRequestOrBuilder.java new file mode 100644 index 00000000..f36541f0 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoRequestOrBuilder.java @@ -0,0 +1,99 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface ListProjectBillingInfoRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ListProjectBillingInfoRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the billing account associated with the projects that
+   * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the billing account associated with the projects that
+   * you want to list. For example, `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Requested page size. The maximum page size is 100; this is also the
+   * default.
+   * 
+ * + * int32 page_size = 2; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A token identifying a page of results to be returned. This should be a
+   * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 3; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A token identifying a page of results to be returned. This should be a
+   * `next_page_token` value returned from a previous `ListProjectBillingInfo`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 3; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoResponse.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoResponse.java new file mode 100644 index 00000000..0682962a --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoResponse.java @@ -0,0 +1,1176 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `ListProjectBillingInfoResponse`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListProjectBillingInfoResponse} + */ +public final class ListProjectBillingInfoResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ListProjectBillingInfoResponse) + ListProjectBillingInfoResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListProjectBillingInfoResponse.newBuilder() to construct. + private ListProjectBillingInfoResponse( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListProjectBillingInfoResponse() { + projectBillingInfo_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListProjectBillingInfoResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListProjectBillingInfoResponse( + 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)) { + projectBillingInfo_ = + new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + projectBillingInfo_.add( + input.readMessage( + com.google.cloud.billing.v1.ProjectBillingInfo.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)) { + projectBillingInfo_ = java.util.Collections.unmodifiableList(projectBillingInfo_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListProjectBillingInfoResponse.class, + com.google.cloud.billing.v1.ListProjectBillingInfoResponse.Builder.class); + } + + public static final int PROJECT_BILLING_INFO_FIELD_NUMBER = 1; + private java.util.List projectBillingInfo_; + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public java.util.List + getProjectBillingInfoList() { + return projectBillingInfo_; + } + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public java.util.List + getProjectBillingInfoOrBuilderList() { + return projectBillingInfo_; + } + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public int getProjectBillingInfoCount() { + return projectBillingInfo_.size(); + } + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public com.google.cloud.billing.v1.ProjectBillingInfo getProjectBillingInfo(int index) { + return projectBillingInfo_.get(index); + } + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder getProjectBillingInfoOrBuilder( + int index) { + return projectBillingInfo_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListProjectBillingInfo` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListProjectBillingInfo` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + 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 < projectBillingInfo_.size(); i++) { + output.writeMessage(1, projectBillingInfo_.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 < projectBillingInfo_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, projectBillingInfo_.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.v1.ListProjectBillingInfoResponse)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ListProjectBillingInfoResponse other = + (com.google.cloud.billing.v1.ListProjectBillingInfoResponse) obj; + + if (!getProjectBillingInfoList().equals(other.getProjectBillingInfoList())) 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 (getProjectBillingInfoCount() > 0) { + hash = (37 * hash) + PROJECT_BILLING_INFO_FIELD_NUMBER; + hash = (53 * hash) + getProjectBillingInfoList().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.v1.ListProjectBillingInfoResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoResponse 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.v1.ListProjectBillingInfoResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoResponse 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.v1.ListProjectBillingInfoResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoResponse 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.v1.ListProjectBillingInfoResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoResponse 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.v1.ListProjectBillingInfoResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoResponse 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.v1.ListProjectBillingInfoResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `ListProjectBillingInfoResponse`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListProjectBillingInfoResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ListProjectBillingInfoResponse) + com.google.cloud.billing.v1.ListProjectBillingInfoResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListProjectBillingInfoResponse.class, + com.google.cloud.billing.v1.ListProjectBillingInfoResponse.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ListProjectBillingInfoResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getProjectBillingInfoFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (projectBillingInfoBuilder_ == null) { + projectBillingInfo_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + projectBillingInfoBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ListProjectBillingInfoResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListProjectBillingInfoResponse getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ListProjectBillingInfoResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListProjectBillingInfoResponse build() { + com.google.cloud.billing.v1.ListProjectBillingInfoResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListProjectBillingInfoResponse buildPartial() { + com.google.cloud.billing.v1.ListProjectBillingInfoResponse result = + new com.google.cloud.billing.v1.ListProjectBillingInfoResponse(this); + int from_bitField0_ = bitField0_; + if (projectBillingInfoBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + projectBillingInfo_ = java.util.Collections.unmodifiableList(projectBillingInfo_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.projectBillingInfo_ = projectBillingInfo_; + } else { + result.projectBillingInfo_ = projectBillingInfoBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.v1.ListProjectBillingInfoResponse) { + return mergeFrom((com.google.cloud.billing.v1.ListProjectBillingInfoResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ListProjectBillingInfoResponse other) { + if (other == com.google.cloud.billing.v1.ListProjectBillingInfoResponse.getDefaultInstance()) + return this; + if (projectBillingInfoBuilder_ == null) { + if (!other.projectBillingInfo_.isEmpty()) { + if (projectBillingInfo_.isEmpty()) { + projectBillingInfo_ = other.projectBillingInfo_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureProjectBillingInfoIsMutable(); + projectBillingInfo_.addAll(other.projectBillingInfo_); + } + onChanged(); + } + } else { + if (!other.projectBillingInfo_.isEmpty()) { + if (projectBillingInfoBuilder_.isEmpty()) { + projectBillingInfoBuilder_.dispose(); + projectBillingInfoBuilder_ = null; + projectBillingInfo_ = other.projectBillingInfo_; + bitField0_ = (bitField0_ & ~0x00000001); + projectBillingInfoBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getProjectBillingInfoFieldBuilder() + : null; + } else { + projectBillingInfoBuilder_.addAllMessages(other.projectBillingInfo_); + } + } + } + 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.v1.ListProjectBillingInfoResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.ListProjectBillingInfoResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List projectBillingInfo_ = + java.util.Collections.emptyList(); + + private void ensureProjectBillingInfoIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + projectBillingInfo_ = + new java.util.ArrayList( + projectBillingInfo_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.ProjectBillingInfo, + com.google.cloud.billing.v1.ProjectBillingInfo.Builder, + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder> + projectBillingInfoBuilder_; + + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public java.util.List + getProjectBillingInfoList() { + if (projectBillingInfoBuilder_ == null) { + return java.util.Collections.unmodifiableList(projectBillingInfo_); + } else { + return projectBillingInfoBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public int getProjectBillingInfoCount() { + if (projectBillingInfoBuilder_ == null) { + return projectBillingInfo_.size(); + } else { + return projectBillingInfoBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public com.google.cloud.billing.v1.ProjectBillingInfo getProjectBillingInfo(int index) { + if (projectBillingInfoBuilder_ == null) { + return projectBillingInfo_.get(index); + } else { + return projectBillingInfoBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder setProjectBillingInfo( + int index, com.google.cloud.billing.v1.ProjectBillingInfo value) { + if (projectBillingInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProjectBillingInfoIsMutable(); + projectBillingInfo_.set(index, value); + onChanged(); + } else { + projectBillingInfoBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder setProjectBillingInfo( + int index, com.google.cloud.billing.v1.ProjectBillingInfo.Builder builderForValue) { + if (projectBillingInfoBuilder_ == null) { + ensureProjectBillingInfoIsMutable(); + projectBillingInfo_.set(index, builderForValue.build()); + onChanged(); + } else { + projectBillingInfoBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder addProjectBillingInfo(com.google.cloud.billing.v1.ProjectBillingInfo value) { + if (projectBillingInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProjectBillingInfoIsMutable(); + projectBillingInfo_.add(value); + onChanged(); + } else { + projectBillingInfoBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder addProjectBillingInfo( + int index, com.google.cloud.billing.v1.ProjectBillingInfo value) { + if (projectBillingInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureProjectBillingInfoIsMutable(); + projectBillingInfo_.add(index, value); + onChanged(); + } else { + projectBillingInfoBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder addProjectBillingInfo( + com.google.cloud.billing.v1.ProjectBillingInfo.Builder builderForValue) { + if (projectBillingInfoBuilder_ == null) { + ensureProjectBillingInfoIsMutable(); + projectBillingInfo_.add(builderForValue.build()); + onChanged(); + } else { + projectBillingInfoBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder addProjectBillingInfo( + int index, com.google.cloud.billing.v1.ProjectBillingInfo.Builder builderForValue) { + if (projectBillingInfoBuilder_ == null) { + ensureProjectBillingInfoIsMutable(); + projectBillingInfo_.add(index, builderForValue.build()); + onChanged(); + } else { + projectBillingInfoBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder addAllProjectBillingInfo( + java.lang.Iterable values) { + if (projectBillingInfoBuilder_ == null) { + ensureProjectBillingInfoIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, projectBillingInfo_); + onChanged(); + } else { + projectBillingInfoBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder clearProjectBillingInfo() { + if (projectBillingInfoBuilder_ == null) { + projectBillingInfo_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + projectBillingInfoBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public Builder removeProjectBillingInfo(int index) { + if (projectBillingInfoBuilder_ == null) { + ensureProjectBillingInfoIsMutable(); + projectBillingInfo_.remove(index); + onChanged(); + } else { + projectBillingInfoBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public com.google.cloud.billing.v1.ProjectBillingInfo.Builder getProjectBillingInfoBuilder( + int index) { + return getProjectBillingInfoFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder getProjectBillingInfoOrBuilder( + int index) { + if (projectBillingInfoBuilder_ == null) { + return projectBillingInfo_.get(index); + } else { + return projectBillingInfoBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public java.util.List + getProjectBillingInfoOrBuilderList() { + if (projectBillingInfoBuilder_ != null) { + return projectBillingInfoBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(projectBillingInfo_); + } + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public com.google.cloud.billing.v1.ProjectBillingInfo.Builder addProjectBillingInfoBuilder() { + return getProjectBillingInfoFieldBuilder() + .addBuilder(com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance()); + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public com.google.cloud.billing.v1.ProjectBillingInfo.Builder addProjectBillingInfoBuilder( + int index) { + return getProjectBillingInfoFieldBuilder() + .addBuilder(index, com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance()); + } + /** + * + * + *
+     * A list of `ProjectBillingInfo` resources representing the projects
+     * associated with the billing account.
+     * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + public java.util.List + getProjectBillingInfoBuilderList() { + return getProjectBillingInfoFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.ProjectBillingInfo, + com.google.cloud.billing.v1.ProjectBillingInfo.Builder, + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder> + getProjectBillingInfoFieldBuilder() { + if (projectBillingInfoBuilder_ == null) { + projectBillingInfoBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.ProjectBillingInfo, + com.google.cloud.billing.v1.ProjectBillingInfo.Builder, + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder>( + projectBillingInfo_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + projectBillingInfo_ = null; + } + return projectBillingInfoBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListProjectBillingInfo` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListProjectBillingInfo` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListProjectBillingInfo` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListProjectBillingInfo` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListProjectBillingInfo` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ListProjectBillingInfoResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ListProjectBillingInfoResponse) + private static final com.google.cloud.billing.v1.ListProjectBillingInfoResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ListProjectBillingInfoResponse(); + } + + public static com.google.cloud.billing.v1.ListProjectBillingInfoResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListProjectBillingInfoResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListProjectBillingInfoResponse(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.v1.ListProjectBillingInfoResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoResponseOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoResponseOrBuilder.java new file mode 100644 index 00000000..0fdf71d9 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoResponseOrBuilder.java @@ -0,0 +1,111 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface ListProjectBillingInfoResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ListProjectBillingInfoResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + java.util.List getProjectBillingInfoList(); + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + com.google.cloud.billing.v1.ProjectBillingInfo getProjectBillingInfo(int index); + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + int getProjectBillingInfoCount(); + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + java.util.List + getProjectBillingInfoOrBuilderList(); + /** + * + * + *
+   * A list of `ProjectBillingInfo` resources representing the projects
+   * associated with the billing account.
+   * 
+ * + * repeated .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 1; + */ + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder getProjectBillingInfoOrBuilder(int index); + + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListProjectBillingInfo` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListProjectBillingInfo` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesRequest.java new file mode 100644 index 00000000..d33e866b --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesRequest.java @@ -0,0 +1,735 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `ListServices`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListServicesRequest} + */ +public final class ListServicesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ListServicesRequest) + ListServicesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListServicesRequest.newBuilder() to construct. + private ListServicesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListServicesRequest() { + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListServicesRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListServicesRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + pageSize_ = input.readInt32(); + break; + } + case 18: + { + 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.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListServicesRequest.class, + com.google.cloud.billing.v1.ListServicesRequest.Builder.class); + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 1; + private int pageSize_; + /** + * + * + *
+   * Requested page size. Defaults to 5000.
+   * 
+ * + * int32 page_size = 1; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListServices`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 2; + * + * @return The pageToken. + */ + 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; + } + } + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListServices`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 2; + * + * @return The bytes for pageToken. + */ + 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 (pageSize_ != 0) { + output.writeInt32(1, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, pageToken_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, 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.v1.ListServicesRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ListServicesRequest other = + (com.google.cloud.billing.v1.ListServicesRequest) obj; + + 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) + 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.v1.ListServicesRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListServicesRequest 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.v1.ListServicesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListServicesRequest 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.v1.ListServicesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListServicesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ListServicesRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListServicesRequest 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.v1.ListServicesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListServicesRequest 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.v1.ListServicesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListServicesRequest 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.v1.ListServicesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `ListServices`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListServicesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ListServicesRequest) + com.google.cloud.billing.v1.ListServicesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListServicesRequest.class, + com.google.cloud.billing.v1.ListServicesRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ListServicesRequest.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(); + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListServicesRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ListServicesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListServicesRequest build() { + com.google.cloud.billing.v1.ListServicesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListServicesRequest buildPartial() { + com.google.cloud.billing.v1.ListServicesRequest result = + new com.google.cloud.billing.v1.ListServicesRequest(this); + 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.v1.ListServicesRequest) { + return mergeFrom((com.google.cloud.billing.v1.ListServicesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ListServicesRequest other) { + if (other == com.google.cloud.billing.v1.ListServicesRequest.getDefaultInstance()) + return this; + 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.v1.ListServicesRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.ListServicesRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Requested page size. Defaults to 5000.
+     * 
+ * + * int32 page_size = 1; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Requested page size. Defaults to 5000.
+     * 
+ * + * int32 page_size = 1; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Requested page size. Defaults to 5000.
+     * 
+ * + * int32 page_size = 1; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListServices`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListServices`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListServices`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListServices`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListServices`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 2; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ListServicesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ListServicesRequest) + private static final com.google.cloud.billing.v1.ListServicesRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ListServicesRequest(); + } + + public static com.google.cloud.billing.v1.ListServicesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListServicesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListServicesRequest(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.v1.ListServicesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesRequestOrBuilder.java new file mode 100644 index 00000000..66eb7274 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesRequestOrBuilder.java @@ -0,0 +1,67 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface ListServicesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ListServicesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Requested page size. Defaults to 5000.
+   * 
+ * + * int32 page_size = 1; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListServices`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 2; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListServices`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 2; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesResponse.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesResponse.java new file mode 100644 index 00000000..14ab5453 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesResponse.java @@ -0,0 +1,1133 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Response message for `ListServices`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListServicesResponse} + */ +public final class ListServicesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ListServicesResponse) + ListServicesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListServicesResponse.newBuilder() to construct. + private ListServicesResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListServicesResponse() { + services_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListServicesResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListServicesResponse( + 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)) { + services_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + services_.add( + input.readMessage( + com.google.cloud.billing.v1.Service.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)) { + services_ = java.util.Collections.unmodifiableList(services_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListServicesResponse.class, + com.google.cloud.billing.v1.ListServicesResponse.Builder.class); + } + + public static final int SERVICES_FIELD_NUMBER = 1; + private java.util.List services_; + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public java.util.List getServicesList() { + return services_; + } + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public java.util.List + getServicesOrBuilderList() { + return services_; + } + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public int getServicesCount() { + return services_.size(); + } + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public com.google.cloud.billing.v1.Service getServices(int index) { + return services_.get(index); + } + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public com.google.cloud.billing.v1.ServiceOrBuilder getServicesOrBuilder(int index) { + return services_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListServices` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListServices` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + 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 < services_.size(); i++) { + output.writeMessage(1, services_.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 < services_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, services_.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.v1.ListServicesResponse)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ListServicesResponse other = + (com.google.cloud.billing.v1.ListServicesResponse) obj; + + if (!getServicesList().equals(other.getServicesList())) 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 (getServicesCount() > 0) { + hash = (37 * hash) + SERVICES_FIELD_NUMBER; + hash = (53 * hash) + getServicesList().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.v1.ListServicesResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListServicesResponse 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.v1.ListServicesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListServicesResponse 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.v1.ListServicesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListServicesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ListServicesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListServicesResponse 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.v1.ListServicesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListServicesResponse 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.v1.ListServicesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListServicesResponse 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.v1.ListServicesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for `ListServices`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListServicesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ListServicesResponse) + com.google.cloud.billing.v1.ListServicesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListServicesResponse.class, + com.google.cloud.billing.v1.ListServicesResponse.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ListServicesResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getServicesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (servicesBuilder_ == null) { + services_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + servicesBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListServicesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListServicesResponse getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ListServicesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListServicesResponse build() { + com.google.cloud.billing.v1.ListServicesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListServicesResponse buildPartial() { + com.google.cloud.billing.v1.ListServicesResponse result = + new com.google.cloud.billing.v1.ListServicesResponse(this); + int from_bitField0_ = bitField0_; + if (servicesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + services_ = java.util.Collections.unmodifiableList(services_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.services_ = services_; + } else { + result.services_ = servicesBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.v1.ListServicesResponse) { + return mergeFrom((com.google.cloud.billing.v1.ListServicesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ListServicesResponse other) { + if (other == com.google.cloud.billing.v1.ListServicesResponse.getDefaultInstance()) + return this; + if (servicesBuilder_ == null) { + if (!other.services_.isEmpty()) { + if (services_.isEmpty()) { + services_ = other.services_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureServicesIsMutable(); + services_.addAll(other.services_); + } + onChanged(); + } + } else { + if (!other.services_.isEmpty()) { + if (servicesBuilder_.isEmpty()) { + servicesBuilder_.dispose(); + servicesBuilder_ = null; + services_ = other.services_; + bitField0_ = (bitField0_ & ~0x00000001); + servicesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getServicesFieldBuilder() + : null; + } else { + servicesBuilder_.addAllMessages(other.services_); + } + } + } + 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.v1.ListServicesResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.ListServicesResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List services_ = + java.util.Collections.emptyList(); + + private void ensureServicesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + services_ = new java.util.ArrayList(services_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.Service, + com.google.cloud.billing.v1.Service.Builder, + com.google.cloud.billing.v1.ServiceOrBuilder> + servicesBuilder_; + + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public java.util.List getServicesList() { + if (servicesBuilder_ == null) { + return java.util.Collections.unmodifiableList(services_); + } else { + return servicesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public int getServicesCount() { + if (servicesBuilder_ == null) { + return services_.size(); + } else { + return servicesBuilder_.getCount(); + } + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public com.google.cloud.billing.v1.Service getServices(int index) { + if (servicesBuilder_ == null) { + return services_.get(index); + } else { + return servicesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder setServices(int index, com.google.cloud.billing.v1.Service value) { + if (servicesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureServicesIsMutable(); + services_.set(index, value); + onChanged(); + } else { + servicesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder setServices( + int index, com.google.cloud.billing.v1.Service.Builder builderForValue) { + if (servicesBuilder_ == null) { + ensureServicesIsMutable(); + services_.set(index, builderForValue.build()); + onChanged(); + } else { + servicesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder addServices(com.google.cloud.billing.v1.Service value) { + if (servicesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureServicesIsMutable(); + services_.add(value); + onChanged(); + } else { + servicesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder addServices(int index, com.google.cloud.billing.v1.Service value) { + if (servicesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureServicesIsMutable(); + services_.add(index, value); + onChanged(); + } else { + servicesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder addServices(com.google.cloud.billing.v1.Service.Builder builderForValue) { + if (servicesBuilder_ == null) { + ensureServicesIsMutable(); + services_.add(builderForValue.build()); + onChanged(); + } else { + servicesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder addServices( + int index, com.google.cloud.billing.v1.Service.Builder builderForValue) { + if (servicesBuilder_ == null) { + ensureServicesIsMutable(); + services_.add(index, builderForValue.build()); + onChanged(); + } else { + servicesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder addAllServices( + java.lang.Iterable values) { + if (servicesBuilder_ == null) { + ensureServicesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, services_); + onChanged(); + } else { + servicesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder clearServices() { + if (servicesBuilder_ == null) { + services_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + servicesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public Builder removeServices(int index) { + if (servicesBuilder_ == null) { + ensureServicesIsMutable(); + services_.remove(index); + onChanged(); + } else { + servicesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public com.google.cloud.billing.v1.Service.Builder getServicesBuilder(int index) { + return getServicesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public com.google.cloud.billing.v1.ServiceOrBuilder getServicesOrBuilder(int index) { + if (servicesBuilder_ == null) { + return services_.get(index); + } else { + return servicesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public java.util.List + getServicesOrBuilderList() { + if (servicesBuilder_ != null) { + return servicesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(services_); + } + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public com.google.cloud.billing.v1.Service.Builder addServicesBuilder() { + return getServicesFieldBuilder() + .addBuilder(com.google.cloud.billing.v1.Service.getDefaultInstance()); + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public com.google.cloud.billing.v1.Service.Builder addServicesBuilder(int index) { + return getServicesFieldBuilder() + .addBuilder(index, com.google.cloud.billing.v1.Service.getDefaultInstance()); + } + /** + * + * + *
+     * A list of services.
+     * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + public java.util.List getServicesBuilderList() { + return getServicesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.Service, + com.google.cloud.billing.v1.Service.Builder, + com.google.cloud.billing.v1.ServiceOrBuilder> + getServicesFieldBuilder() { + if (servicesBuilder_ == null) { + servicesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.Service, + com.google.cloud.billing.v1.Service.Builder, + com.google.cloud.billing.v1.ServiceOrBuilder>( + services_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + services_ = null; + } + return servicesBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListServices` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListServices` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListServices` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListServices` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListServices` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ListServicesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ListServicesResponse) + private static final com.google.cloud.billing.v1.ListServicesResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ListServicesResponse(); + } + + public static com.google.cloud.billing.v1.ListServicesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListServicesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListServicesResponse(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.v1.ListServicesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesResponseOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesResponseOrBuilder.java new file mode 100644 index 00000000..f6034dfb --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesResponseOrBuilder.java @@ -0,0 +1,105 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface ListServicesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ListServicesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + java.util.List getServicesList(); + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + com.google.cloud.billing.v1.Service getServices(int index); + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + int getServicesCount(); + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + java.util.List getServicesOrBuilderList(); + /** + * + * + *
+   * A list of services.
+   * 
+ * + * repeated .google.cloud.billing.v1.Service services = 1; + */ + com.google.cloud.billing.v1.ServiceOrBuilder getServicesOrBuilder(int index); + + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListServices` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListServices` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusRequest.java new file mode 100644 index 00000000..64b5fe73 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusRequest.java @@ -0,0 +1,1773 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `ListSkus`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListSkusRequest} + */ +public final class ListSkusRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ListSkusRequest) + ListSkusRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListSkusRequest.newBuilder() to construct. + private ListSkusRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListSkusRequest() { + parent_ = ""; + currencyCode_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListSkusRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListSkusRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + parent_ = s; + break; + } + case 18: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (startTime_ != null) { + subBuilder = startTime_.toBuilder(); + } + startTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(startTime_); + startTime_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (endTime_ != null) { + subBuilder = endTime_.toBuilder(); + } + endTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(endTime_); + endTime_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + currencyCode_ = s; + break; + } + case 40: + { + pageSize_ = input.readInt32(); + break; + } + case 50: + { + 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.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListSkusRequest.class, + com.google.cloud.billing.v1.ListSkusRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + private volatile java.lang.Object parent_; + /** + * + * + *
+   * Required. The name of the service.
+   * Example: "services/DA34-426B-A397"
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + 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 service.
+   * Example: "services/DA34-426B-A397"
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof 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 START_TIME_FIELD_NUMBER = 2; + private com.google.protobuf.Timestamp startTime_; + /** + * + * + *
+   * Optional inclusive start time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return startTime_ != null; + } + /** + * + * + *
+   * Optional inclusive start time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + /** + * + * + *
+   * Optional inclusive start time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + return getStartTime(); + } + + public static final int END_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp endTime_; + /** + * + * + *
+   * Optional exclusive end time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + * + * @return Whether the endTime field is set. + */ + public boolean hasEndTime() { + return endTime_ != null; + } + /** + * + * + *
+   * Optional exclusive end time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + * + * @return The endTime. + */ + public com.google.protobuf.Timestamp getEndTime() { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + /** + * + * + *
+   * Optional exclusive end time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + return getEndTime(); + } + + public static final int CURRENCY_CODE_FIELD_NUMBER = 4; + private volatile java.lang.Object currencyCode_; + /** + * + * + *
+   * The ISO 4217 currency code for the pricing info in the response proto.
+   * Will use the conversion rate as of start_time.
+   * Optional. If not specified USD will be used.
+   * 
+ * + * string currency_code = 4; + * + * @return The currencyCode. + */ + public java.lang.String getCurrencyCode() { + java.lang.Object ref = currencyCode_; + 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(); + currencyCode_ = s; + return s; + } + } + /** + * + * + *
+   * The ISO 4217 currency code for the pricing info in the response proto.
+   * Will use the conversion rate as of start_time.
+   * Optional. If not specified USD will be used.
+   * 
+ * + * string currency_code = 4; + * + * @return The bytes for currencyCode. + */ + public com.google.protobuf.ByteString getCurrencyCodeBytes() { + java.lang.Object ref = currencyCode_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + currencyCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 5; + private int pageSize_; + /** + * + * + *
+   * Requested page size. Defaults to 5000.
+   * 
+ * + * int32 page_size = 5; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 6; + private volatile java.lang.Object pageToken_; + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListSkus`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 6; + * + * @return The pageToken. + */ + 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; + } + } + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListSkus`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 6; + * + * @return The bytes for pageToken. + */ + 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 (startTime_ != null) { + output.writeMessage(2, getStartTime()); + } + if (endTime_ != null) { + output.writeMessage(3, getEndTime()); + } + if (!getCurrencyCodeBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, currencyCode_); + } + if (pageSize_ != 0) { + output.writeInt32(5, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, 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 (startTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStartTime()); + } + if (endTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getEndTime()); + } + if (!getCurrencyCodeBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, currencyCode_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, pageSize_); + } + if (!getPageTokenBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, 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.v1.ListSkusRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ListSkusRequest other = + (com.google.cloud.billing.v1.ListSkusRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (hasStartTime() != other.hasStartTime()) return false; + if (hasStartTime()) { + if (!getStartTime().equals(other.getStartTime())) return false; + } + if (hasEndTime() != other.hasEndTime()) return false; + if (hasEndTime()) { + if (!getEndTime().equals(other.getEndTime())) return false; + } + if (!getCurrencyCode().equals(other.getCurrencyCode())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + if (hasStartTime()) { + hash = (37 * hash) + START_TIME_FIELD_NUMBER; + hash = (53 * hash) + getStartTime().hashCode(); + } + if (hasEndTime()) { + hash = (37 * hash) + END_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEndTime().hashCode(); + } + hash = (37 * hash) + CURRENCY_CODE_FIELD_NUMBER; + hash = (53 * hash) + getCurrencyCode().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.v1.ListSkusRequest parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListSkusRequest 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.v1.ListSkusRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListSkusRequest 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.v1.ListSkusRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListSkusRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ListSkusRequest parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListSkusRequest 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.v1.ListSkusRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListSkusRequest 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.v1.ListSkusRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListSkusRequest 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.v1.ListSkusRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `ListSkus`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListSkusRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ListSkusRequest) + com.google.cloud.billing.v1.ListSkusRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListSkusRequest.class, + com.google.cloud.billing.v1.ListSkusRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ListSkusRequest.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 (startTimeBuilder_ == null) { + startTime_ = null; + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + if (endTimeBuilder_ == null) { + endTime_ = null; + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + currencyCode_ = ""; + + pageSize_ = 0; + + pageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListSkusRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ListSkusRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListSkusRequest build() { + com.google.cloud.billing.v1.ListSkusRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListSkusRequest buildPartial() { + com.google.cloud.billing.v1.ListSkusRequest result = + new com.google.cloud.billing.v1.ListSkusRequest(this); + result.parent_ = parent_; + if (startTimeBuilder_ == null) { + result.startTime_ = startTime_; + } else { + result.startTime_ = startTimeBuilder_.build(); + } + if (endTimeBuilder_ == null) { + result.endTime_ = endTime_; + } else { + result.endTime_ = endTimeBuilder_.build(); + } + result.currencyCode_ = currencyCode_; + 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.v1.ListSkusRequest) { + return mergeFrom((com.google.cloud.billing.v1.ListSkusRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ListSkusRequest other) { + if (other == com.google.cloud.billing.v1.ListSkusRequest.getDefaultInstance()) return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + onChanged(); + } + if (other.hasStartTime()) { + mergeStartTime(other.getStartTime()); + } + if (other.hasEndTime()) { + mergeEndTime(other.getEndTime()); + } + if (!other.getCurrencyCode().isEmpty()) { + currencyCode_ = other.currencyCode_; + 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.v1.ListSkusRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.ListSkusRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The name of the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + parent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + + parent_ = getDefaultInstance().getParent(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + parent_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp startTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + startTimeBuilder_; + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + public boolean hasStartTime() { + return startTimeBuilder_ != null || startTime_ != null; + } + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + public com.google.protobuf.Timestamp getStartTime() { + if (startTimeBuilder_ == null) { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } else { + return startTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder setStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + startTime_ = value; + onChanged(); + } else { + startTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder setStartTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (startTimeBuilder_ == null) { + startTime_ = builderForValue.build(); + onChanged(); + } else { + startTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder mergeStartTime(com.google.protobuf.Timestamp value) { + if (startTimeBuilder_ == null) { + if (startTime_ != null) { + startTime_ = + com.google.protobuf.Timestamp.newBuilder(startTime_).mergeFrom(value).buildPartial(); + } else { + startTime_ = value; + } + onChanged(); + } else { + startTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public Builder clearStartTime() { + if (startTimeBuilder_ == null) { + startTime_ = null; + onChanged(); + } else { + startTime_ = null; + startTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public com.google.protobuf.Timestamp.Builder getStartTimeBuilder() { + + onChanged(); + return getStartTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + public com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder() { + if (startTimeBuilder_ != null) { + return startTimeBuilder_.getMessageOrBuilder(); + } else { + return startTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : startTime_; + } + } + /** + * + * + *
+     * Optional inclusive start time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getStartTimeFieldBuilder() { + if (startTimeBuilder_ == null) { + startTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getStartTime(), getParentForChildren(), isClean()); + startTime_ = null; + } + return startTimeBuilder_; + } + + private com.google.protobuf.Timestamp endTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + endTimeBuilder_; + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + * + * @return Whether the endTime field is set. + */ + public boolean hasEndTime() { + return endTimeBuilder_ != null || endTime_ != null; + } + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + * + * @return The endTime. + */ + public com.google.protobuf.Timestamp getEndTime() { + if (endTimeBuilder_ == null) { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } else { + return endTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public Builder setEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + endTime_ = value; + onChanged(); + } else { + endTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public Builder setEndTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (endTimeBuilder_ == null) { + endTime_ = builderForValue.build(); + onChanged(); + } else { + endTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public Builder mergeEndTime(com.google.protobuf.Timestamp value) { + if (endTimeBuilder_ == null) { + if (endTime_ != null) { + endTime_ = + com.google.protobuf.Timestamp.newBuilder(endTime_).mergeFrom(value).buildPartial(); + } else { + endTime_ = value; + } + onChanged(); + } else { + endTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public Builder clearEndTime() { + if (endTimeBuilder_ == null) { + endTime_ = null; + onChanged(); + } else { + endTime_ = null; + endTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public com.google.protobuf.Timestamp.Builder getEndTimeBuilder() { + + onChanged(); + return getEndTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + public com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder() { + if (endTimeBuilder_ != null) { + return endTimeBuilder_.getMessageOrBuilder(); + } else { + return endTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : endTime_; + } + } + /** + * + * + *
+     * Optional exclusive end time of the time range for which the pricing
+     * versions will be returned. Timestamps in the future are not allowed.
+     * The time range has to be within a single calendar month in
+     * America/Los_Angeles timezone. Time range as a whole is optional. If not
+     * specified, the latest pricing will be returned (up to 12 hours old at
+     * most).
+     * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEndTimeFieldBuilder() { + if (endTimeBuilder_ == null) { + endTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEndTime(), getParentForChildren(), isClean()); + endTime_ = null; + } + return endTimeBuilder_; + } + + private java.lang.Object currencyCode_ = ""; + /** + * + * + *
+     * The ISO 4217 currency code for the pricing info in the response proto.
+     * Will use the conversion rate as of start_time.
+     * Optional. If not specified USD will be used.
+     * 
+ * + * string currency_code = 4; + * + * @return The currencyCode. + */ + public java.lang.String getCurrencyCode() { + java.lang.Object ref = currencyCode_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + currencyCode_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The ISO 4217 currency code for the pricing info in the response proto.
+     * Will use the conversion rate as of start_time.
+     * Optional. If not specified USD will be used.
+     * 
+ * + * string currency_code = 4; + * + * @return The bytes for currencyCode. + */ + public com.google.protobuf.ByteString getCurrencyCodeBytes() { + java.lang.Object ref = currencyCode_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + currencyCode_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The ISO 4217 currency code for the pricing info in the response proto.
+     * Will use the conversion rate as of start_time.
+     * Optional. If not specified USD will be used.
+     * 
+ * + * string currency_code = 4; + * + * @param value The currencyCode to set. + * @return This builder for chaining. + */ + public Builder setCurrencyCode(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + currencyCode_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The ISO 4217 currency code for the pricing info in the response proto.
+     * Will use the conversion rate as of start_time.
+     * Optional. If not specified USD will be used.
+     * 
+ * + * string currency_code = 4; + * + * @return This builder for chaining. + */ + public Builder clearCurrencyCode() { + + currencyCode_ = getDefaultInstance().getCurrencyCode(); + onChanged(); + return this; + } + /** + * + * + *
+     * The ISO 4217 currency code for the pricing info in the response proto.
+     * Will use the conversion rate as of start_time.
+     * Optional. If not specified USD will be used.
+     * 
+ * + * string currency_code = 4; + * + * @param value The bytes for currencyCode to set. + * @return This builder for chaining. + */ + public Builder setCurrencyCodeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + currencyCode_ = value; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Requested page size. Defaults to 5000.
+     * 
+ * + * int32 page_size = 5; + * + * @return The pageSize. + */ + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Requested page size. Defaults to 5000.
+     * 
+ * + * int32 page_size = 5; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Requested page size. Defaults to 5000.
+     * 
+ * + * int32 page_size = 5; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListSkus`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 6; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListSkus`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 6; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListSkus`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 6; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + pageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListSkus`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 6; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + + pageToken_ = getDefaultInstance().getPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token identifying a page of results to return. This should be a
+     * `next_page_token` value returned from a previous `ListSkus`
+     * call. If unspecified, the first page of results is returned.
+     * 
+ * + * string page_token = 6; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + pageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ListSkusRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ListSkusRequest) + private static final com.google.cloud.billing.v1.ListSkusRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ListSkusRequest(); + } + + public static com.google.cloud.billing.v1.ListSkusRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListSkusRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListSkusRequest(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.v1.ListSkusRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusRequestOrBuilder.java new file mode 100644 index 00000000..b03408d4 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusRequestOrBuilder.java @@ -0,0 +1,227 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface ListSkusRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ListSkusRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the service.
+   * Example: "services/DA34-426B-A397"
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The name of the service.
+   * Example: "services/DA34-426B-A397"
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional inclusive start time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return Whether the startTime field is set. + */ + boolean hasStartTime(); + /** + * + * + *
+   * Optional inclusive start time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + * + * @return The startTime. + */ + com.google.protobuf.Timestamp getStartTime(); + /** + * + * + *
+   * Optional inclusive start time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp start_time = 2; + */ + com.google.protobuf.TimestampOrBuilder getStartTimeOrBuilder(); + + /** + * + * + *
+   * Optional exclusive end time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + * + * @return Whether the endTime field is set. + */ + boolean hasEndTime(); + /** + * + * + *
+   * Optional exclusive end time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + * + * @return The endTime. + */ + com.google.protobuf.Timestamp getEndTime(); + /** + * + * + *
+   * Optional exclusive end time of the time range for which the pricing
+   * versions will be returned. Timestamps in the future are not allowed.
+   * The time range has to be within a single calendar month in
+   * America/Los_Angeles timezone. Time range as a whole is optional. If not
+   * specified, the latest pricing will be returned (up to 12 hours old at
+   * most).
+   * 
+ * + * .google.protobuf.Timestamp end_time = 3; + */ + com.google.protobuf.TimestampOrBuilder getEndTimeOrBuilder(); + + /** + * + * + *
+   * The ISO 4217 currency code for the pricing info in the response proto.
+   * Will use the conversion rate as of start_time.
+   * Optional. If not specified USD will be used.
+   * 
+ * + * string currency_code = 4; + * + * @return The currencyCode. + */ + java.lang.String getCurrencyCode(); + /** + * + * + *
+   * The ISO 4217 currency code for the pricing info in the response proto.
+   * Will use the conversion rate as of start_time.
+   * Optional. If not specified USD will be used.
+   * 
+ * + * string currency_code = 4; + * + * @return The bytes for currencyCode. + */ + com.google.protobuf.ByteString getCurrencyCodeBytes(); + + /** + * + * + *
+   * Requested page size. Defaults to 5000.
+   * 
+ * + * int32 page_size = 5; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListSkus`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 6; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * A token identifying a page of results to return. This should be a
+   * `next_page_token` value returned from a previous `ListSkus`
+   * call. If unspecified, the first page of results is returned.
+   * 
+ * + * string page_token = 6; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusResponse.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusResponse.java new file mode 100644 index 00000000..53dd5296 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusResponse.java @@ -0,0 +1,1127 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Response message for `ListSkus`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListSkusResponse} + */ +public final class ListSkusResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ListSkusResponse) + ListSkusResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListSkusResponse.newBuilder() to construct. + private ListSkusResponse(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListSkusResponse() { + skus_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListSkusResponse(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListSkusResponse( + 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)) { + skus_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + skus_.add( + input.readMessage(com.google.cloud.billing.v1.Sku.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)) { + skus_ = java.util.Collections.unmodifiableList(skus_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListSkusResponse.class, + com.google.cloud.billing.v1.ListSkusResponse.Builder.class); + } + + public static final int SKUS_FIELD_NUMBER = 1; + private java.util.List skus_; + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public java.util.List getSkusList() { + return skus_; + } + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public java.util.List getSkusOrBuilderList() { + return skus_; + } + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public int getSkusCount() { + return skus_.size(); + } + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public com.google.cloud.billing.v1.Sku getSkus(int index) { + return skus_.get(index); + } + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public com.google.cloud.billing.v1.SkuOrBuilder getSkusOrBuilder(int index) { + return skus_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + private volatile java.lang.Object nextPageToken_; + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListSkus` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListSkus` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + 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 < skus_.size(); i++) { + output.writeMessage(1, skus_.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 < skus_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, skus_.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.v1.ListSkusResponse)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ListSkusResponse other = + (com.google.cloud.billing.v1.ListSkusResponse) obj; + + if (!getSkusList().equals(other.getSkusList())) 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 (getSkusCount() > 0) { + hash = (37 * hash) + SKUS_FIELD_NUMBER; + hash = (53 * hash) + getSkusList().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.v1.ListSkusResponse parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListSkusResponse 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.v1.ListSkusResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListSkusResponse 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.v1.ListSkusResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ListSkusResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ListSkusResponse parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListSkusResponse 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.v1.ListSkusResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListSkusResponse 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.v1.ListSkusResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ListSkusResponse 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.v1.ListSkusResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Response message for `ListSkus`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ListSkusResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ListSkusResponse) + com.google.cloud.billing.v1.ListSkusResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ListSkusResponse.class, + com.google.cloud.billing.v1.ListSkusResponse.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ListSkusResponse.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getSkusFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + if (skusBuilder_ == null) { + skus_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + skusBuilder_.clear(); + } + nextPageToken_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_ListSkusResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListSkusResponse getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ListSkusResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListSkusResponse build() { + com.google.cloud.billing.v1.ListSkusResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ListSkusResponse buildPartial() { + com.google.cloud.billing.v1.ListSkusResponse result = + new com.google.cloud.billing.v1.ListSkusResponse(this); + int from_bitField0_ = bitField0_; + if (skusBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + skus_ = java.util.Collections.unmodifiableList(skus_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.skus_ = skus_; + } else { + result.skus_ = skusBuilder_.build(); + } + result.nextPageToken_ = nextPageToken_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.billing.v1.ListSkusResponse) { + return mergeFrom((com.google.cloud.billing.v1.ListSkusResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ListSkusResponse other) { + if (other == com.google.cloud.billing.v1.ListSkusResponse.getDefaultInstance()) return this; + if (skusBuilder_ == null) { + if (!other.skus_.isEmpty()) { + if (skus_.isEmpty()) { + skus_ = other.skus_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSkusIsMutable(); + skus_.addAll(other.skus_); + } + onChanged(); + } + } else { + if (!other.skus_.isEmpty()) { + if (skusBuilder_.isEmpty()) { + skusBuilder_.dispose(); + skusBuilder_ = null; + skus_ = other.skus_; + bitField0_ = (bitField0_ & ~0x00000001); + skusBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getSkusFieldBuilder() + : null; + } else { + skusBuilder_.addAllMessages(other.skus_); + } + } + } + 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.v1.ListSkusResponse parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.ListSkusResponse) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.util.List skus_ = + java.util.Collections.emptyList(); + + private void ensureSkusIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + skus_ = new java.util.ArrayList(skus_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.Sku, + com.google.cloud.billing.v1.Sku.Builder, + com.google.cloud.billing.v1.SkuOrBuilder> + skusBuilder_; + + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public java.util.List getSkusList() { + if (skusBuilder_ == null) { + return java.util.Collections.unmodifiableList(skus_); + } else { + return skusBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public int getSkusCount() { + if (skusBuilder_ == null) { + return skus_.size(); + } else { + return skusBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public com.google.cloud.billing.v1.Sku getSkus(int index) { + if (skusBuilder_ == null) { + return skus_.get(index); + } else { + return skusBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder setSkus(int index, com.google.cloud.billing.v1.Sku value) { + if (skusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkusIsMutable(); + skus_.set(index, value); + onChanged(); + } else { + skusBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder setSkus(int index, com.google.cloud.billing.v1.Sku.Builder builderForValue) { + if (skusBuilder_ == null) { + ensureSkusIsMutable(); + skus_.set(index, builderForValue.build()); + onChanged(); + } else { + skusBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder addSkus(com.google.cloud.billing.v1.Sku value) { + if (skusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkusIsMutable(); + skus_.add(value); + onChanged(); + } else { + skusBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder addSkus(int index, com.google.cloud.billing.v1.Sku value) { + if (skusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSkusIsMutable(); + skus_.add(index, value); + onChanged(); + } else { + skusBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder addSkus(com.google.cloud.billing.v1.Sku.Builder builderForValue) { + if (skusBuilder_ == null) { + ensureSkusIsMutable(); + skus_.add(builderForValue.build()); + onChanged(); + } else { + skusBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder addSkus(int index, com.google.cloud.billing.v1.Sku.Builder builderForValue) { + if (skusBuilder_ == null) { + ensureSkusIsMutable(); + skus_.add(index, builderForValue.build()); + onChanged(); + } else { + skusBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder addAllSkus( + java.lang.Iterable values) { + if (skusBuilder_ == null) { + ensureSkusIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, skus_); + onChanged(); + } else { + skusBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder clearSkus() { + if (skusBuilder_ == null) { + skus_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + skusBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public Builder removeSkus(int index) { + if (skusBuilder_ == null) { + ensureSkusIsMutable(); + skus_.remove(index); + onChanged(); + } else { + skusBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public com.google.cloud.billing.v1.Sku.Builder getSkusBuilder(int index) { + return getSkusFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public com.google.cloud.billing.v1.SkuOrBuilder getSkusOrBuilder(int index) { + if (skusBuilder_ == null) { + return skus_.get(index); + } else { + return skusBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public java.util.List + getSkusOrBuilderList() { + if (skusBuilder_ != null) { + return skusBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(skus_); + } + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public com.google.cloud.billing.v1.Sku.Builder addSkusBuilder() { + return getSkusFieldBuilder().addBuilder(com.google.cloud.billing.v1.Sku.getDefaultInstance()); + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public com.google.cloud.billing.v1.Sku.Builder addSkusBuilder(int index) { + return getSkusFieldBuilder() + .addBuilder(index, com.google.cloud.billing.v1.Sku.getDefaultInstance()); + } + /** + * + * + *
+     * The list of public SKUs of the given service.
+     * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + public java.util.List getSkusBuilderList() { + return getSkusFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.Sku, + com.google.cloud.billing.v1.Sku.Builder, + com.google.cloud.billing.v1.SkuOrBuilder> + getSkusFieldBuilder() { + if (skusBuilder_ == null) { + skusBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.Sku, + com.google.cloud.billing.v1.Sku.Builder, + com.google.cloud.billing.v1.SkuOrBuilder>( + skus_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + skus_ = null; + } + return skusBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListSkus` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListSkus` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListSkus` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + nextPageToken_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListSkus` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + + nextPageToken_ = getDefaultInstance().getNextPageToken(); + onChanged(); + return this; + } + /** + * + * + *
+     * A token to retrieve the next page of results. To retrieve the next page,
+     * call `ListSkus` again with the `page_token` field set to this
+     * value. This field is empty if there are no more results to retrieve.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + nextPageToken_ = value; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ListSkusResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ListSkusResponse) + private static final com.google.cloud.billing.v1.ListSkusResponse DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ListSkusResponse(); + } + + public static com.google.cloud.billing.v1.ListSkusResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListSkusResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListSkusResponse(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.v1.ListSkusResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusResponseOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusResponseOrBuilder.java new file mode 100644 index 00000000..db85cce3 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusResponseOrBuilder.java @@ -0,0 +1,105 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface ListSkusResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ListSkusResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + java.util.List getSkusList(); + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + com.google.cloud.billing.v1.Sku getSkus(int index); + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + int getSkusCount(); + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + java.util.List getSkusOrBuilderList(); + /** + * + * + *
+   * The list of public SKUs of the given service.
+   * 
+ * + * repeated .google.cloud.billing.v1.Sku skus = 1; + */ + com.google.cloud.billing.v1.SkuOrBuilder getSkusOrBuilder(int index); + + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListSkus` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * A token to retrieve the next page of results. To retrieve the next page,
+   * call `ListSkus` again with the `page_token` field set to this
+   * value. This field is empty if there are no more results to retrieve.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingExpression.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingExpression.java new file mode 100644 index 00000000..c046521b --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingExpression.java @@ -0,0 +1,2855 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Expresses a mathematical pricing formula. For Example:-
+ * `usage_unit: GBy`
+ * `tiered_rates:`
+ *    `[start_usage_amount: 20, unit_price: $10]`
+ *    `[start_usage_amount: 100, unit_price: $5]`
+ * The above expresses a pricing formula where the first 20GB is free, the
+ * next 80GB is priced at $10 per GB followed by $5 per GB for additional
+ * usage.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.PricingExpression} + */ +public final class PricingExpression extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.PricingExpression) + PricingExpressionOrBuilder { + private static final long serialVersionUID = 0L; + // Use PricingExpression.newBuilder() to construct. + private PricingExpression(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PricingExpression() { + usageUnit_ = ""; + usageUnitDescription_ = ""; + baseUnit_ = ""; + baseUnitDescription_ = ""; + tieredRates_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PricingExpression(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PricingExpression( + 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(); + + usageUnit_ = s; + break; + } + case 17: + { + displayQuantity_ = input.readDouble(); + break; + } + case 26: + { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + tieredRates_ = + new java.util.ArrayList< + com.google.cloud.billing.v1.PricingExpression.TierRate>(); + mutable_bitField0_ |= 0x00000001; + } + tieredRates_.add( + input.readMessage( + com.google.cloud.billing.v1.PricingExpression.TierRate.parser(), + extensionRegistry)); + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + usageUnitDescription_ = s; + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + + baseUnit_ = s; + break; + } + case 50: + { + java.lang.String s = input.readStringRequireUtf8(); + + baseUnitDescription_ = s; + break; + } + case 57: + { + baseUnitConversionFactor_ = input.readDouble(); + 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)) { + tieredRates_ = java.util.Collections.unmodifiableList(tieredRates_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.PricingExpression.class, + com.google.cloud.billing.v1.PricingExpression.Builder.class); + } + + public interface TierRateOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.PricingExpression.TierRate) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Usage is priced at this rate only after this amount.
+     * Example: start_usage_amount of 10 indicates that the usage will be priced
+     * at the unit_price after the first 10 usage_units.
+     * 
+ * + * double start_usage_amount = 1; + * + * @return The startUsageAmount. + */ + double getStartUsageAmount(); + + /** + * + * + *
+     * The price per unit of usage.
+     * Example: unit_price of amount $10 indicates that each unit will cost $10.
+     * 
+ * + * .google.type.Money unit_price = 2; + * + * @return Whether the unitPrice field is set. + */ + boolean hasUnitPrice(); + /** + * + * + *
+     * The price per unit of usage.
+     * Example: unit_price of amount $10 indicates that each unit will cost $10.
+     * 
+ * + * .google.type.Money unit_price = 2; + * + * @return The unitPrice. + */ + com.google.type.Money getUnitPrice(); + /** + * + * + *
+     * The price per unit of usage.
+     * Example: unit_price of amount $10 indicates that each unit will cost $10.
+     * 
+ * + * .google.type.Money unit_price = 2; + */ + com.google.type.MoneyOrBuilder getUnitPriceOrBuilder(); + } + /** + * + * + *
+   * The price rate indicating starting usage and its corresponding price.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.PricingExpression.TierRate} + */ + public static final class TierRate extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.PricingExpression.TierRate) + TierRateOrBuilder { + private static final long serialVersionUID = 0L; + // Use TierRate.newBuilder() to construct. + private TierRate(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private TierRate() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new TierRate(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private TierRate( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 9: + { + startUsageAmount_ = input.readDouble(); + break; + } + case 18: + { + com.google.type.Money.Builder subBuilder = null; + if (unitPrice_ != null) { + subBuilder = unitPrice_.toBuilder(); + } + unitPrice_ = input.readMessage(com.google.type.Money.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(unitPrice_); + unitPrice_ = 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.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_TierRate_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_TierRate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.PricingExpression.TierRate.class, + com.google.cloud.billing.v1.PricingExpression.TierRate.Builder.class); + } + + public static final int START_USAGE_AMOUNT_FIELD_NUMBER = 1; + private double startUsageAmount_; + /** + * + * + *
+     * Usage is priced at this rate only after this amount.
+     * Example: start_usage_amount of 10 indicates that the usage will be priced
+     * at the unit_price after the first 10 usage_units.
+     * 
+ * + * double start_usage_amount = 1; + * + * @return The startUsageAmount. + */ + public double getStartUsageAmount() { + return startUsageAmount_; + } + + public static final int UNIT_PRICE_FIELD_NUMBER = 2; + private com.google.type.Money unitPrice_; + /** + * + * + *
+     * The price per unit of usage.
+     * Example: unit_price of amount $10 indicates that each unit will cost $10.
+     * 
+ * + * .google.type.Money unit_price = 2; + * + * @return Whether the unitPrice field is set. + */ + public boolean hasUnitPrice() { + return unitPrice_ != null; + } + /** + * + * + *
+     * The price per unit of usage.
+     * Example: unit_price of amount $10 indicates that each unit will cost $10.
+     * 
+ * + * .google.type.Money unit_price = 2; + * + * @return The unitPrice. + */ + public com.google.type.Money getUnitPrice() { + return unitPrice_ == null ? com.google.type.Money.getDefaultInstance() : unitPrice_; + } + /** + * + * + *
+     * The price per unit of usage.
+     * Example: unit_price of amount $10 indicates that each unit will cost $10.
+     * 
+ * + * .google.type.Money unit_price = 2; + */ + public com.google.type.MoneyOrBuilder getUnitPriceOrBuilder() { + return getUnitPrice(); + } + + 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 (startUsageAmount_ != 0D) { + output.writeDouble(1, startUsageAmount_); + } + if (unitPrice_ != null) { + output.writeMessage(2, getUnitPrice()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (startUsageAmount_ != 0D) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(1, startUsageAmount_); + } + if (unitPrice_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUnitPrice()); + } + 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.v1.PricingExpression.TierRate)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.PricingExpression.TierRate other = + (com.google.cloud.billing.v1.PricingExpression.TierRate) obj; + + if (java.lang.Double.doubleToLongBits(getStartUsageAmount()) + != java.lang.Double.doubleToLongBits(other.getStartUsageAmount())) return false; + if (hasUnitPrice() != other.hasUnitPrice()) return false; + if (hasUnitPrice()) { + if (!getUnitPrice().equals(other.getUnitPrice())) 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) + START_USAGE_AMOUNT_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getStartUsageAmount())); + if (hasUnitPrice()) { + hash = (37 * hash) + UNIT_PRICE_FIELD_NUMBER; + hash = (53 * hash) + getUnitPrice().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate 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.v1.PricingExpression.TierRate parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate 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.v1.PricingExpression.TierRate parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate 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.v1.PricingExpression.TierRate parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate 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.v1.PricingExpression.TierRate parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate 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.v1.PricingExpression.TierRate 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 price rate indicating starting usage and its corresponding price.
+     * 
+ * + * Protobuf type {@code google.cloud.billing.v1.PricingExpression.TierRate} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.PricingExpression.TierRate) + com.google.cloud.billing.v1.PricingExpression.TierRateOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_TierRate_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_TierRate_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.PricingExpression.TierRate.class, + com.google.cloud.billing.v1.PricingExpression.TierRate.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.PricingExpression.TierRate.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(); + startUsageAmount_ = 0D; + + if (unitPriceBuilder_ == null) { + unitPrice_ = null; + } else { + unitPrice_ = null; + unitPriceBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_TierRate_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingExpression.TierRate getDefaultInstanceForType() { + return com.google.cloud.billing.v1.PricingExpression.TierRate.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingExpression.TierRate build() { + com.google.cloud.billing.v1.PricingExpression.TierRate result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingExpression.TierRate buildPartial() { + com.google.cloud.billing.v1.PricingExpression.TierRate result = + new com.google.cloud.billing.v1.PricingExpression.TierRate(this); + result.startUsageAmount_ = startUsageAmount_; + if (unitPriceBuilder_ == null) { + result.unitPrice_ = unitPrice_; + } else { + result.unitPrice_ = unitPriceBuilder_.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.v1.PricingExpression.TierRate) { + return mergeFrom((com.google.cloud.billing.v1.PricingExpression.TierRate) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.PricingExpression.TierRate other) { + if (other == com.google.cloud.billing.v1.PricingExpression.TierRate.getDefaultInstance()) + return this; + if (other.getStartUsageAmount() != 0D) { + setStartUsageAmount(other.getStartUsageAmount()); + } + if (other.hasUnitPrice()) { + mergeUnitPrice(other.getUnitPrice()); + } + 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.v1.PricingExpression.TierRate parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.PricingExpression.TierRate) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private double startUsageAmount_; + /** + * + * + *
+       * Usage is priced at this rate only after this amount.
+       * Example: start_usage_amount of 10 indicates that the usage will be priced
+       * at the unit_price after the first 10 usage_units.
+       * 
+ * + * double start_usage_amount = 1; + * + * @return The startUsageAmount. + */ + public double getStartUsageAmount() { + return startUsageAmount_; + } + /** + * + * + *
+       * Usage is priced at this rate only after this amount.
+       * Example: start_usage_amount of 10 indicates that the usage will be priced
+       * at the unit_price after the first 10 usage_units.
+       * 
+ * + * double start_usage_amount = 1; + * + * @param value The startUsageAmount to set. + * @return This builder for chaining. + */ + public Builder setStartUsageAmount(double value) { + + startUsageAmount_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Usage is priced at this rate only after this amount.
+       * Example: start_usage_amount of 10 indicates that the usage will be priced
+       * at the unit_price after the first 10 usage_units.
+       * 
+ * + * double start_usage_amount = 1; + * + * @return This builder for chaining. + */ + public Builder clearStartUsageAmount() { + + startUsageAmount_ = 0D; + onChanged(); + return this; + } + + private com.google.type.Money unitPrice_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder> + unitPriceBuilder_; + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + * + * @return Whether the unitPrice field is set. + */ + public boolean hasUnitPrice() { + return unitPriceBuilder_ != null || unitPrice_ != null; + } + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + * + * @return The unitPrice. + */ + public com.google.type.Money getUnitPrice() { + if (unitPriceBuilder_ == null) { + return unitPrice_ == null ? com.google.type.Money.getDefaultInstance() : unitPrice_; + } else { + return unitPriceBuilder_.getMessage(); + } + } + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + */ + public Builder setUnitPrice(com.google.type.Money value) { + if (unitPriceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + unitPrice_ = value; + onChanged(); + } else { + unitPriceBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + */ + public Builder setUnitPrice(com.google.type.Money.Builder builderForValue) { + if (unitPriceBuilder_ == null) { + unitPrice_ = builderForValue.build(); + onChanged(); + } else { + unitPriceBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + */ + public Builder mergeUnitPrice(com.google.type.Money value) { + if (unitPriceBuilder_ == null) { + if (unitPrice_ != null) { + unitPrice_ = + com.google.type.Money.newBuilder(unitPrice_).mergeFrom(value).buildPartial(); + } else { + unitPrice_ = value; + } + onChanged(); + } else { + unitPriceBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + */ + public Builder clearUnitPrice() { + if (unitPriceBuilder_ == null) { + unitPrice_ = null; + onChanged(); + } else { + unitPrice_ = null; + unitPriceBuilder_ = null; + } + + return this; + } + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + */ + public com.google.type.Money.Builder getUnitPriceBuilder() { + + onChanged(); + return getUnitPriceFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + */ + public com.google.type.MoneyOrBuilder getUnitPriceOrBuilder() { + if (unitPriceBuilder_ != null) { + return unitPriceBuilder_.getMessageOrBuilder(); + } else { + return unitPrice_ == null ? com.google.type.Money.getDefaultInstance() : unitPrice_; + } + } + /** + * + * + *
+       * The price per unit of usage.
+       * Example: unit_price of amount $10 indicates that each unit will cost $10.
+       * 
+ * + * .google.type.Money unit_price = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, com.google.type.Money.Builder, com.google.type.MoneyOrBuilder> + getUnitPriceFieldBuilder() { + if (unitPriceBuilder_ == null) { + unitPriceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Money, + com.google.type.Money.Builder, + com.google.type.MoneyOrBuilder>( + getUnitPrice(), getParentForChildren(), isClean()); + unitPrice_ = null; + } + return unitPriceBuilder_; + } + + @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.v1.PricingExpression.TierRate) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.PricingExpression.TierRate) + private static final com.google.cloud.billing.v1.PricingExpression.TierRate DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.PricingExpression.TierRate(); + } + + public static com.google.cloud.billing.v1.PricingExpression.TierRate getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public TierRate parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new TierRate(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.v1.PricingExpression.TierRate getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public static final int USAGE_UNIT_FIELD_NUMBER = 1; + private volatile java.lang.Object usageUnit_; + /** + * + * + *
+   * The short hand for unit of usage this pricing is specified in.
+   * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+   * 
+ * + * string usage_unit = 1; + * + * @return The usageUnit. + */ + public java.lang.String getUsageUnit() { + java.lang.Object ref = usageUnit_; + 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(); + usageUnit_ = s; + return s; + } + } + /** + * + * + *
+   * The short hand for unit of usage this pricing is specified in.
+   * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+   * 
+ * + * string usage_unit = 1; + * + * @return The bytes for usageUnit. + */ + public com.google.protobuf.ByteString getUsageUnitBytes() { + java.lang.Object ref = usageUnit_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + usageUnit_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int USAGE_UNIT_DESCRIPTION_FIELD_NUMBER = 4; + private volatile java.lang.Object usageUnitDescription_; + /** + * + * + *
+   * The unit of usage in human readable form.
+   * Example: "gibi byte".
+   * 
+ * + * string usage_unit_description = 4; + * + * @return The usageUnitDescription. + */ + public java.lang.String getUsageUnitDescription() { + java.lang.Object ref = usageUnitDescription_; + 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(); + usageUnitDescription_ = s; + return s; + } + } + /** + * + * + *
+   * The unit of usage in human readable form.
+   * Example: "gibi byte".
+   * 
+ * + * string usage_unit_description = 4; + * + * @return The bytes for usageUnitDescription. + */ + public com.google.protobuf.ByteString getUsageUnitDescriptionBytes() { + java.lang.Object ref = usageUnitDescription_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + usageUnitDescription_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BASE_UNIT_FIELD_NUMBER = 5; + private volatile java.lang.Object baseUnit_; + /** + * + * + *
+   * The base unit for the SKU which is the unit used in usage exports.
+   * Example: "By"
+   * 
+ * + * string base_unit = 5; + * + * @return The baseUnit. + */ + public java.lang.String getBaseUnit() { + java.lang.Object ref = baseUnit_; + 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(); + baseUnit_ = s; + return s; + } + } + /** + * + * + *
+   * The base unit for the SKU which is the unit used in usage exports.
+   * Example: "By"
+   * 
+ * + * string base_unit = 5; + * + * @return The bytes for baseUnit. + */ + public com.google.protobuf.ByteString getBaseUnitBytes() { + java.lang.Object ref = baseUnit_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + baseUnit_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BASE_UNIT_DESCRIPTION_FIELD_NUMBER = 6; + private volatile java.lang.Object baseUnitDescription_; + /** + * + * + *
+   * The base unit in human readable form.
+   * Example: "byte".
+   * 
+ * + * string base_unit_description = 6; + * + * @return The baseUnitDescription. + */ + public java.lang.String getBaseUnitDescription() { + java.lang.Object ref = baseUnitDescription_; + 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(); + baseUnitDescription_ = s; + return s; + } + } + /** + * + * + *
+   * The base unit in human readable form.
+   * Example: "byte".
+   * 
+ * + * string base_unit_description = 6; + * + * @return The bytes for baseUnitDescription. + */ + public com.google.protobuf.ByteString getBaseUnitDescriptionBytes() { + java.lang.Object ref = baseUnitDescription_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + baseUnitDescription_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BASE_UNIT_CONVERSION_FACTOR_FIELD_NUMBER = 7; + private double baseUnitConversionFactor_; + /** + * + * + *
+   * Conversion factor for converting from price per usage_unit to price per
+   * base_unit, and start_usage_amount to start_usage_amount in base_unit.
+   * unit_price / base_unit_conversion_factor = price per base_unit.
+   * start_usage_amount * base_unit_conversion_factor = start_usage_amount in
+   * base_unit.
+   * 
+ * + * double base_unit_conversion_factor = 7; + * + * @return The baseUnitConversionFactor. + */ + public double getBaseUnitConversionFactor() { + return baseUnitConversionFactor_; + } + + public static final int DISPLAY_QUANTITY_FIELD_NUMBER = 2; + private double displayQuantity_; + /** + * + * + *
+   * The recommended quantity of units for displaying pricing info. When
+   * displaying pricing info it is recommended to display:
+   * (unit_price * display_quantity) per display_quantity usage_unit.
+   * This field does not affect the pricing formula and is for display purposes
+   * only.
+   * Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
+   * the display_quantity is "1000" then the recommended way of displaying the
+   * pricing info is "0.10 USD per 1000 GB"
+   * 
+ * + * double display_quantity = 2; + * + * @return The displayQuantity. + */ + public double getDisplayQuantity() { + return displayQuantity_; + } + + public static final int TIERED_RATES_FIELD_NUMBER = 3; + private java.util.List tieredRates_; + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public java.util.List + getTieredRatesList() { + return tieredRates_; + } + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public java.util.List + getTieredRatesOrBuilderList() { + return tieredRates_; + } + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public int getTieredRatesCount() { + return tieredRates_.size(); + } + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public com.google.cloud.billing.v1.PricingExpression.TierRate getTieredRates(int index) { + return tieredRates_.get(index); + } + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public com.google.cloud.billing.v1.PricingExpression.TierRateOrBuilder getTieredRatesOrBuilder( + int index) { + return tieredRates_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!getUsageUnitBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, usageUnit_); + } + if (displayQuantity_ != 0D) { + output.writeDouble(2, displayQuantity_); + } + for (int i = 0; i < tieredRates_.size(); i++) { + output.writeMessage(3, tieredRates_.get(i)); + } + if (!getUsageUnitDescriptionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, usageUnitDescription_); + } + if (!getBaseUnitBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, baseUnit_); + } + if (!getBaseUnitDescriptionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 6, baseUnitDescription_); + } + if (baseUnitConversionFactor_ != 0D) { + output.writeDouble(7, baseUnitConversionFactor_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getUsageUnitBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, usageUnit_); + } + if (displayQuantity_ != 0D) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(2, displayQuantity_); + } + for (int i = 0; i < tieredRates_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, tieredRates_.get(i)); + } + if (!getUsageUnitDescriptionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, usageUnitDescription_); + } + if (!getBaseUnitBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, baseUnit_); + } + if (!getBaseUnitDescriptionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, baseUnitDescription_); + } + if (baseUnitConversionFactor_ != 0D) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(7, baseUnitConversionFactor_); + } + 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.v1.PricingExpression)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.PricingExpression other = + (com.google.cloud.billing.v1.PricingExpression) obj; + + if (!getUsageUnit().equals(other.getUsageUnit())) return false; + if (!getUsageUnitDescription().equals(other.getUsageUnitDescription())) return false; + if (!getBaseUnit().equals(other.getBaseUnit())) return false; + if (!getBaseUnitDescription().equals(other.getBaseUnitDescription())) return false; + if (java.lang.Double.doubleToLongBits(getBaseUnitConversionFactor()) + != java.lang.Double.doubleToLongBits(other.getBaseUnitConversionFactor())) return false; + if (java.lang.Double.doubleToLongBits(getDisplayQuantity()) + != java.lang.Double.doubleToLongBits(other.getDisplayQuantity())) return false; + if (!getTieredRatesList().equals(other.getTieredRatesList())) 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) + USAGE_UNIT_FIELD_NUMBER; + hash = (53 * hash) + getUsageUnit().hashCode(); + hash = (37 * hash) + USAGE_UNIT_DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getUsageUnitDescription().hashCode(); + hash = (37 * hash) + BASE_UNIT_FIELD_NUMBER; + hash = (53 * hash) + getBaseUnit().hashCode(); + hash = (37 * hash) + BASE_UNIT_DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getBaseUnitDescription().hashCode(); + hash = (37 * hash) + BASE_UNIT_CONVERSION_FACTOR_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getBaseUnitConversionFactor())); + hash = (37 * hash) + DISPLAY_QUANTITY_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getDisplayQuantity())); + if (getTieredRatesCount() > 0) { + hash = (37 * hash) + TIERED_RATES_FIELD_NUMBER; + hash = (53 * hash) + getTieredRatesList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.PricingExpression parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingExpression 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.v1.PricingExpression parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingExpression 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.v1.PricingExpression parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingExpression parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.PricingExpression parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingExpression 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.v1.PricingExpression parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingExpression 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.v1.PricingExpression parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingExpression 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.v1.PricingExpression 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; + } + /** + * + * + *
+   * Expresses a mathematical pricing formula. For Example:-
+   * `usage_unit: GBy`
+   * `tiered_rates:`
+   *    `[start_usage_amount: 20, unit_price: $10]`
+   *    `[start_usage_amount: 100, unit_price: $5]`
+   * The above expresses a pricing formula where the first 20GB is free, the
+   * next 80GB is priced at $10 per GB followed by $5 per GB for additional
+   * usage.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.PricingExpression} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.PricingExpression) + com.google.cloud.billing.v1.PricingExpressionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.PricingExpression.class, + com.google.cloud.billing.v1.PricingExpression.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.PricingExpression.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getTieredRatesFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + usageUnit_ = ""; + + usageUnitDescription_ = ""; + + baseUnit_ = ""; + + baseUnitDescription_ = ""; + + baseUnitConversionFactor_ = 0D; + + displayQuantity_ = 0D; + + if (tieredRatesBuilder_ == null) { + tieredRates_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + tieredRatesBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingExpression_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingExpression getDefaultInstanceForType() { + return com.google.cloud.billing.v1.PricingExpression.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingExpression build() { + com.google.cloud.billing.v1.PricingExpression result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingExpression buildPartial() { + com.google.cloud.billing.v1.PricingExpression result = + new com.google.cloud.billing.v1.PricingExpression(this); + int from_bitField0_ = bitField0_; + result.usageUnit_ = usageUnit_; + result.usageUnitDescription_ = usageUnitDescription_; + result.baseUnit_ = baseUnit_; + result.baseUnitDescription_ = baseUnitDescription_; + result.baseUnitConversionFactor_ = baseUnitConversionFactor_; + result.displayQuantity_ = displayQuantity_; + if (tieredRatesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + tieredRates_ = java.util.Collections.unmodifiableList(tieredRates_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.tieredRates_ = tieredRates_; + } else { + result.tieredRates_ = tieredRatesBuilder_.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.v1.PricingExpression) { + return mergeFrom((com.google.cloud.billing.v1.PricingExpression) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.PricingExpression other) { + if (other == com.google.cloud.billing.v1.PricingExpression.getDefaultInstance()) return this; + if (!other.getUsageUnit().isEmpty()) { + usageUnit_ = other.usageUnit_; + onChanged(); + } + if (!other.getUsageUnitDescription().isEmpty()) { + usageUnitDescription_ = other.usageUnitDescription_; + onChanged(); + } + if (!other.getBaseUnit().isEmpty()) { + baseUnit_ = other.baseUnit_; + onChanged(); + } + if (!other.getBaseUnitDescription().isEmpty()) { + baseUnitDescription_ = other.baseUnitDescription_; + onChanged(); + } + if (other.getBaseUnitConversionFactor() != 0D) { + setBaseUnitConversionFactor(other.getBaseUnitConversionFactor()); + } + if (other.getDisplayQuantity() != 0D) { + setDisplayQuantity(other.getDisplayQuantity()); + } + if (tieredRatesBuilder_ == null) { + if (!other.tieredRates_.isEmpty()) { + if (tieredRates_.isEmpty()) { + tieredRates_ = other.tieredRates_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureTieredRatesIsMutable(); + tieredRates_.addAll(other.tieredRates_); + } + onChanged(); + } + } else { + if (!other.tieredRates_.isEmpty()) { + if (tieredRatesBuilder_.isEmpty()) { + tieredRatesBuilder_.dispose(); + tieredRatesBuilder_ = null; + tieredRates_ = other.tieredRates_; + bitField0_ = (bitField0_ & ~0x00000001); + tieredRatesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getTieredRatesFieldBuilder() + : null; + } else { + tieredRatesBuilder_.addAllMessages(other.tieredRates_); + } + } + } + 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.v1.PricingExpression parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.PricingExpression) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object usageUnit_ = ""; + /** + * + * + *
+     * The short hand for unit of usage this pricing is specified in.
+     * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+     * 
+ * + * string usage_unit = 1; + * + * @return The usageUnit. + */ + public java.lang.String getUsageUnit() { + java.lang.Object ref = usageUnit_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + usageUnit_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The short hand for unit of usage this pricing is specified in.
+     * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+     * 
+ * + * string usage_unit = 1; + * + * @return The bytes for usageUnit. + */ + public com.google.protobuf.ByteString getUsageUnitBytes() { + java.lang.Object ref = usageUnit_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + usageUnit_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The short hand for unit of usage this pricing is specified in.
+     * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+     * 
+ * + * string usage_unit = 1; + * + * @param value The usageUnit to set. + * @return This builder for chaining. + */ + public Builder setUsageUnit(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + usageUnit_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The short hand for unit of usage this pricing is specified in.
+     * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+     * 
+ * + * string usage_unit = 1; + * + * @return This builder for chaining. + */ + public Builder clearUsageUnit() { + + usageUnit_ = getDefaultInstance().getUsageUnit(); + onChanged(); + return this; + } + /** + * + * + *
+     * The short hand for unit of usage this pricing is specified in.
+     * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+     * 
+ * + * string usage_unit = 1; + * + * @param value The bytes for usageUnit to set. + * @return This builder for chaining. + */ + public Builder setUsageUnitBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + usageUnit_ = value; + onChanged(); + return this; + } + + private java.lang.Object usageUnitDescription_ = ""; + /** + * + * + *
+     * The unit of usage in human readable form.
+     * Example: "gibi byte".
+     * 
+ * + * string usage_unit_description = 4; + * + * @return The usageUnitDescription. + */ + public java.lang.String getUsageUnitDescription() { + java.lang.Object ref = usageUnitDescription_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + usageUnitDescription_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The unit of usage in human readable form.
+     * Example: "gibi byte".
+     * 
+ * + * string usage_unit_description = 4; + * + * @return The bytes for usageUnitDescription. + */ + public com.google.protobuf.ByteString getUsageUnitDescriptionBytes() { + java.lang.Object ref = usageUnitDescription_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + usageUnitDescription_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The unit of usage in human readable form.
+     * Example: "gibi byte".
+     * 
+ * + * string usage_unit_description = 4; + * + * @param value The usageUnitDescription to set. + * @return This builder for chaining. + */ + public Builder setUsageUnitDescription(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + usageUnitDescription_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The unit of usage in human readable form.
+     * Example: "gibi byte".
+     * 
+ * + * string usage_unit_description = 4; + * + * @return This builder for chaining. + */ + public Builder clearUsageUnitDescription() { + + usageUnitDescription_ = getDefaultInstance().getUsageUnitDescription(); + onChanged(); + return this; + } + /** + * + * + *
+     * The unit of usage in human readable form.
+     * Example: "gibi byte".
+     * 
+ * + * string usage_unit_description = 4; + * + * @param value The bytes for usageUnitDescription to set. + * @return This builder for chaining. + */ + public Builder setUsageUnitDescriptionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + usageUnitDescription_ = value; + onChanged(); + return this; + } + + private java.lang.Object baseUnit_ = ""; + /** + * + * + *
+     * The base unit for the SKU which is the unit used in usage exports.
+     * Example: "By"
+     * 
+ * + * string base_unit = 5; + * + * @return The baseUnit. + */ + public java.lang.String getBaseUnit() { + java.lang.Object ref = baseUnit_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + baseUnit_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The base unit for the SKU which is the unit used in usage exports.
+     * Example: "By"
+     * 
+ * + * string base_unit = 5; + * + * @return The bytes for baseUnit. + */ + public com.google.protobuf.ByteString getBaseUnitBytes() { + java.lang.Object ref = baseUnit_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + baseUnit_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The base unit for the SKU which is the unit used in usage exports.
+     * Example: "By"
+     * 
+ * + * string base_unit = 5; + * + * @param value The baseUnit to set. + * @return This builder for chaining. + */ + public Builder setBaseUnit(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + baseUnit_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The base unit for the SKU which is the unit used in usage exports.
+     * Example: "By"
+     * 
+ * + * string base_unit = 5; + * + * @return This builder for chaining. + */ + public Builder clearBaseUnit() { + + baseUnit_ = getDefaultInstance().getBaseUnit(); + onChanged(); + return this; + } + /** + * + * + *
+     * The base unit for the SKU which is the unit used in usage exports.
+     * Example: "By"
+     * 
+ * + * string base_unit = 5; + * + * @param value The bytes for baseUnit to set. + * @return This builder for chaining. + */ + public Builder setBaseUnitBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + baseUnit_ = value; + onChanged(); + return this; + } + + private java.lang.Object baseUnitDescription_ = ""; + /** + * + * + *
+     * The base unit in human readable form.
+     * Example: "byte".
+     * 
+ * + * string base_unit_description = 6; + * + * @return The baseUnitDescription. + */ + public java.lang.String getBaseUnitDescription() { + java.lang.Object ref = baseUnitDescription_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + baseUnitDescription_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The base unit in human readable form.
+     * Example: "byte".
+     * 
+ * + * string base_unit_description = 6; + * + * @return The bytes for baseUnitDescription. + */ + public com.google.protobuf.ByteString getBaseUnitDescriptionBytes() { + java.lang.Object ref = baseUnitDescription_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + baseUnitDescription_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The base unit in human readable form.
+     * Example: "byte".
+     * 
+ * + * string base_unit_description = 6; + * + * @param value The baseUnitDescription to set. + * @return This builder for chaining. + */ + public Builder setBaseUnitDescription(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + baseUnitDescription_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The base unit in human readable form.
+     * Example: "byte".
+     * 
+ * + * string base_unit_description = 6; + * + * @return This builder for chaining. + */ + public Builder clearBaseUnitDescription() { + + baseUnitDescription_ = getDefaultInstance().getBaseUnitDescription(); + onChanged(); + return this; + } + /** + * + * + *
+     * The base unit in human readable form.
+     * Example: "byte".
+     * 
+ * + * string base_unit_description = 6; + * + * @param value The bytes for baseUnitDescription to set. + * @return This builder for chaining. + */ + public Builder setBaseUnitDescriptionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + baseUnitDescription_ = value; + onChanged(); + return this; + } + + private double baseUnitConversionFactor_; + /** + * + * + *
+     * Conversion factor for converting from price per usage_unit to price per
+     * base_unit, and start_usage_amount to start_usage_amount in base_unit.
+     * unit_price / base_unit_conversion_factor = price per base_unit.
+     * start_usage_amount * base_unit_conversion_factor = start_usage_amount in
+     * base_unit.
+     * 
+ * + * double base_unit_conversion_factor = 7; + * + * @return The baseUnitConversionFactor. + */ + public double getBaseUnitConversionFactor() { + return baseUnitConversionFactor_; + } + /** + * + * + *
+     * Conversion factor for converting from price per usage_unit to price per
+     * base_unit, and start_usage_amount to start_usage_amount in base_unit.
+     * unit_price / base_unit_conversion_factor = price per base_unit.
+     * start_usage_amount * base_unit_conversion_factor = start_usage_amount in
+     * base_unit.
+     * 
+ * + * double base_unit_conversion_factor = 7; + * + * @param value The baseUnitConversionFactor to set. + * @return This builder for chaining. + */ + public Builder setBaseUnitConversionFactor(double value) { + + baseUnitConversionFactor_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Conversion factor for converting from price per usage_unit to price per
+     * base_unit, and start_usage_amount to start_usage_amount in base_unit.
+     * unit_price / base_unit_conversion_factor = price per base_unit.
+     * start_usage_amount * base_unit_conversion_factor = start_usage_amount in
+     * base_unit.
+     * 
+ * + * double base_unit_conversion_factor = 7; + * + * @return This builder for chaining. + */ + public Builder clearBaseUnitConversionFactor() { + + baseUnitConversionFactor_ = 0D; + onChanged(); + return this; + } + + private double displayQuantity_; + /** + * + * + *
+     * The recommended quantity of units for displaying pricing info. When
+     * displaying pricing info it is recommended to display:
+     * (unit_price * display_quantity) per display_quantity usage_unit.
+     * This field does not affect the pricing formula and is for display purposes
+     * only.
+     * Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
+     * the display_quantity is "1000" then the recommended way of displaying the
+     * pricing info is "0.10 USD per 1000 GB"
+     * 
+ * + * double display_quantity = 2; + * + * @return The displayQuantity. + */ + public double getDisplayQuantity() { + return displayQuantity_; + } + /** + * + * + *
+     * The recommended quantity of units for displaying pricing info. When
+     * displaying pricing info it is recommended to display:
+     * (unit_price * display_quantity) per display_quantity usage_unit.
+     * This field does not affect the pricing formula and is for display purposes
+     * only.
+     * Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
+     * the display_quantity is "1000" then the recommended way of displaying the
+     * pricing info is "0.10 USD per 1000 GB"
+     * 
+ * + * double display_quantity = 2; + * + * @param value The displayQuantity to set. + * @return This builder for chaining. + */ + public Builder setDisplayQuantity(double value) { + + displayQuantity_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The recommended quantity of units for displaying pricing info. When
+     * displaying pricing info it is recommended to display:
+     * (unit_price * display_quantity) per display_quantity usage_unit.
+     * This field does not affect the pricing formula and is for display purposes
+     * only.
+     * Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
+     * the display_quantity is "1000" then the recommended way of displaying the
+     * pricing info is "0.10 USD per 1000 GB"
+     * 
+ * + * double display_quantity = 2; + * + * @return This builder for chaining. + */ + public Builder clearDisplayQuantity() { + + displayQuantity_ = 0D; + onChanged(); + return this; + } + + private java.util.List tieredRates_ = + java.util.Collections.emptyList(); + + private void ensureTieredRatesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + tieredRates_ = + new java.util.ArrayList( + tieredRates_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.PricingExpression.TierRate, + com.google.cloud.billing.v1.PricingExpression.TierRate.Builder, + com.google.cloud.billing.v1.PricingExpression.TierRateOrBuilder> + tieredRatesBuilder_; + + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public java.util.List + getTieredRatesList() { + if (tieredRatesBuilder_ == null) { + return java.util.Collections.unmodifiableList(tieredRates_); + } else { + return tieredRatesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public int getTieredRatesCount() { + if (tieredRatesBuilder_ == null) { + return tieredRates_.size(); + } else { + return tieredRatesBuilder_.getCount(); + } + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public com.google.cloud.billing.v1.PricingExpression.TierRate getTieredRates(int index) { + if (tieredRatesBuilder_ == null) { + return tieredRates_.get(index); + } else { + return tieredRatesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder setTieredRates( + int index, com.google.cloud.billing.v1.PricingExpression.TierRate value) { + if (tieredRatesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTieredRatesIsMutable(); + tieredRates_.set(index, value); + onChanged(); + } else { + tieredRatesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder setTieredRates( + int index, com.google.cloud.billing.v1.PricingExpression.TierRate.Builder builderForValue) { + if (tieredRatesBuilder_ == null) { + ensureTieredRatesIsMutable(); + tieredRates_.set(index, builderForValue.build()); + onChanged(); + } else { + tieredRatesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder addTieredRates(com.google.cloud.billing.v1.PricingExpression.TierRate value) { + if (tieredRatesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTieredRatesIsMutable(); + tieredRates_.add(value); + onChanged(); + } else { + tieredRatesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder addTieredRates( + int index, com.google.cloud.billing.v1.PricingExpression.TierRate value) { + if (tieredRatesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureTieredRatesIsMutable(); + tieredRates_.add(index, value); + onChanged(); + } else { + tieredRatesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder addTieredRates( + com.google.cloud.billing.v1.PricingExpression.TierRate.Builder builderForValue) { + if (tieredRatesBuilder_ == null) { + ensureTieredRatesIsMutable(); + tieredRates_.add(builderForValue.build()); + onChanged(); + } else { + tieredRatesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder addTieredRates( + int index, com.google.cloud.billing.v1.PricingExpression.TierRate.Builder builderForValue) { + if (tieredRatesBuilder_ == null) { + ensureTieredRatesIsMutable(); + tieredRates_.add(index, builderForValue.build()); + onChanged(); + } else { + tieredRatesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder addAllTieredRates( + java.lang.Iterable + values) { + if (tieredRatesBuilder_ == null) { + ensureTieredRatesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, tieredRates_); + onChanged(); + } else { + tieredRatesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder clearTieredRates() { + if (tieredRatesBuilder_ == null) { + tieredRates_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + tieredRatesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public Builder removeTieredRates(int index) { + if (tieredRatesBuilder_ == null) { + ensureTieredRatesIsMutable(); + tieredRates_.remove(index); + onChanged(); + } else { + tieredRatesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public com.google.cloud.billing.v1.PricingExpression.TierRate.Builder getTieredRatesBuilder( + int index) { + return getTieredRatesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public com.google.cloud.billing.v1.PricingExpression.TierRateOrBuilder getTieredRatesOrBuilder( + int index) { + if (tieredRatesBuilder_ == null) { + return tieredRates_.get(index); + } else { + return tieredRatesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public java.util.List + getTieredRatesOrBuilderList() { + if (tieredRatesBuilder_ != null) { + return tieredRatesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(tieredRates_); + } + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public com.google.cloud.billing.v1.PricingExpression.TierRate.Builder addTieredRatesBuilder() { + return getTieredRatesFieldBuilder() + .addBuilder(com.google.cloud.billing.v1.PricingExpression.TierRate.getDefaultInstance()); + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public com.google.cloud.billing.v1.PricingExpression.TierRate.Builder addTieredRatesBuilder( + int index) { + return getTieredRatesFieldBuilder() + .addBuilder( + index, com.google.cloud.billing.v1.PricingExpression.TierRate.getDefaultInstance()); + } + /** + * + * + *
+     * The list of tiered rates for this pricing. The total cost is computed by
+     * applying each of the tiered rates on usage. This repeated list is sorted
+     * by ascending order of start_usage_amount.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + public java.util.List + getTieredRatesBuilderList() { + return getTieredRatesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.PricingExpression.TierRate, + com.google.cloud.billing.v1.PricingExpression.TierRate.Builder, + com.google.cloud.billing.v1.PricingExpression.TierRateOrBuilder> + getTieredRatesFieldBuilder() { + if (tieredRatesBuilder_ == null) { + tieredRatesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.PricingExpression.TierRate, + com.google.cloud.billing.v1.PricingExpression.TierRate.Builder, + com.google.cloud.billing.v1.PricingExpression.TierRateOrBuilder>( + tieredRates_, ((bitField0_ & 0x00000001) != 0), getParentForChildren(), isClean()); + tieredRates_ = null; + } + return tieredRatesBuilder_; + } + + @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.v1.PricingExpression) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.PricingExpression) + private static final com.google.cloud.billing.v1.PricingExpression DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.PricingExpression(); + } + + public static com.google.cloud.billing.v1.PricingExpression getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PricingExpression parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PricingExpression(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.v1.PricingExpression getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingExpressionOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingExpressionOrBuilder.java new file mode 100644 index 00000000..847a1caf --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingExpressionOrBuilder.java @@ -0,0 +1,233 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface PricingExpressionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.PricingExpression) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The short hand for unit of usage this pricing is specified in.
+   * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+   * 
+ * + * string usage_unit = 1; + * + * @return The usageUnit. + */ + java.lang.String getUsageUnit(); + /** + * + * + *
+   * The short hand for unit of usage this pricing is specified in.
+   * Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte".
+   * 
+ * + * string usage_unit = 1; + * + * @return The bytes for usageUnit. + */ + com.google.protobuf.ByteString getUsageUnitBytes(); + + /** + * + * + *
+   * The unit of usage in human readable form.
+   * Example: "gibi byte".
+   * 
+ * + * string usage_unit_description = 4; + * + * @return The usageUnitDescription. + */ + java.lang.String getUsageUnitDescription(); + /** + * + * + *
+   * The unit of usage in human readable form.
+   * Example: "gibi byte".
+   * 
+ * + * string usage_unit_description = 4; + * + * @return The bytes for usageUnitDescription. + */ + com.google.protobuf.ByteString getUsageUnitDescriptionBytes(); + + /** + * + * + *
+   * The base unit for the SKU which is the unit used in usage exports.
+   * Example: "By"
+   * 
+ * + * string base_unit = 5; + * + * @return The baseUnit. + */ + java.lang.String getBaseUnit(); + /** + * + * + *
+   * The base unit for the SKU which is the unit used in usage exports.
+   * Example: "By"
+   * 
+ * + * string base_unit = 5; + * + * @return The bytes for baseUnit. + */ + com.google.protobuf.ByteString getBaseUnitBytes(); + + /** + * + * + *
+   * The base unit in human readable form.
+   * Example: "byte".
+   * 
+ * + * string base_unit_description = 6; + * + * @return The baseUnitDescription. + */ + java.lang.String getBaseUnitDescription(); + /** + * + * + *
+   * The base unit in human readable form.
+   * Example: "byte".
+   * 
+ * + * string base_unit_description = 6; + * + * @return The bytes for baseUnitDescription. + */ + com.google.protobuf.ByteString getBaseUnitDescriptionBytes(); + + /** + * + * + *
+   * Conversion factor for converting from price per usage_unit to price per
+   * base_unit, and start_usage_amount to start_usage_amount in base_unit.
+   * unit_price / base_unit_conversion_factor = price per base_unit.
+   * start_usage_amount * base_unit_conversion_factor = start_usage_amount in
+   * base_unit.
+   * 
+ * + * double base_unit_conversion_factor = 7; + * + * @return The baseUnitConversionFactor. + */ + double getBaseUnitConversionFactor(); + + /** + * + * + *
+   * The recommended quantity of units for displaying pricing info. When
+   * displaying pricing info it is recommended to display:
+   * (unit_price * display_quantity) per display_quantity usage_unit.
+   * This field does not affect the pricing formula and is for display purposes
+   * only.
+   * Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and
+   * the display_quantity is "1000" then the recommended way of displaying the
+   * pricing info is "0.10 USD per 1000 GB"
+   * 
+ * + * double display_quantity = 2; + * + * @return The displayQuantity. + */ + double getDisplayQuantity(); + + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + java.util.List getTieredRatesList(); + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + com.google.cloud.billing.v1.PricingExpression.TierRate getTieredRates(int index); + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + int getTieredRatesCount(); + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + java.util.List + getTieredRatesOrBuilderList(); + /** + * + * + *
+   * The list of tiered rates for this pricing. The total cost is computed by
+   * applying each of the tiered rates on usage. This repeated list is sorted
+   * by ascending order of start_usage_amount.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingExpression.TierRate tiered_rates = 3; + */ + com.google.cloud.billing.v1.PricingExpression.TierRateOrBuilder getTieredRatesOrBuilder( + int index); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingInfo.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingInfo.java new file mode 100644 index 00000000..6bee2378 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingInfo.java @@ -0,0 +1,1641 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Represents the pricing information for a SKU at a single point of time.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.PricingInfo} + */ +public final class PricingInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.PricingInfo) + PricingInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use PricingInfo.newBuilder() to construct. + private PricingInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PricingInfo() { + summary_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PricingInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private PricingInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (effectiveTime_ != null) { + subBuilder = effectiveTime_.toBuilder(); + } + effectiveTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(effectiveTime_); + effectiveTime_ = subBuilder.buildPartial(); + } + + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + summary_ = s; + break; + } + case 26: + { + com.google.cloud.billing.v1.PricingExpression.Builder subBuilder = null; + if (pricingExpression_ != null) { + subBuilder = pricingExpression_.toBuilder(); + } + pricingExpression_ = + input.readMessage( + com.google.cloud.billing.v1.PricingExpression.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(pricingExpression_); + pricingExpression_ = subBuilder.buildPartial(); + } + + break; + } + case 34: + { + com.google.cloud.billing.v1.AggregationInfo.Builder subBuilder = null; + if (aggregationInfo_ != null) { + subBuilder = aggregationInfo_.toBuilder(); + } + aggregationInfo_ = + input.readMessage( + com.google.cloud.billing.v1.AggregationInfo.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(aggregationInfo_); + aggregationInfo_ = subBuilder.buildPartial(); + } + + break; + } + case 41: + { + currencyConversionRate_ = input.readDouble(); + 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.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.PricingInfo.class, + com.google.cloud.billing.v1.PricingInfo.Builder.class); + } + + public static final int EFFECTIVE_TIME_FIELD_NUMBER = 1; + private com.google.protobuf.Timestamp effectiveTime_; + /** + * + * + *
+   * The timestamp from which this pricing was effective within the requested
+   * time range. This is guaranteed to be greater than or equal to the
+   * start_time field in the request and less than the end_time field in the
+   * request. If a time range was not specified in the request this field will
+   * be equivalent to a time within the last 12 hours, indicating the latest
+   * pricing info.
+   * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + * + * @return Whether the effectiveTime field is set. + */ + public boolean hasEffectiveTime() { + return effectiveTime_ != null; + } + /** + * + * + *
+   * The timestamp from which this pricing was effective within the requested
+   * time range. This is guaranteed to be greater than or equal to the
+   * start_time field in the request and less than the end_time field in the
+   * request. If a time range was not specified in the request this field will
+   * be equivalent to a time within the last 12 hours, indicating the latest
+   * pricing info.
+   * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + * + * @return The effectiveTime. + */ + public com.google.protobuf.Timestamp getEffectiveTime() { + return effectiveTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : effectiveTime_; + } + /** + * + * + *
+   * The timestamp from which this pricing was effective within the requested
+   * time range. This is guaranteed to be greater than or equal to the
+   * start_time field in the request and less than the end_time field in the
+   * request. If a time range was not specified in the request this field will
+   * be equivalent to a time within the last 12 hours, indicating the latest
+   * pricing info.
+   * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getEffectiveTimeOrBuilder() { + return getEffectiveTime(); + } + + public static final int SUMMARY_FIELD_NUMBER = 2; + private volatile java.lang.Object summary_; + /** + * + * + *
+   * An optional human readable summary of the pricing information, has a
+   * maximum length of 256 characters.
+   * 
+ * + * string summary = 2; + * + * @return The summary. + */ + public java.lang.String getSummary() { + java.lang.Object ref = summary_; + 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(); + summary_ = s; + return s; + } + } + /** + * + * + *
+   * An optional human readable summary of the pricing information, has a
+   * maximum length of 256 characters.
+   * 
+ * + * string summary = 2; + * + * @return The bytes for summary. + */ + public com.google.protobuf.ByteString getSummaryBytes() { + java.lang.Object ref = summary_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + summary_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PRICING_EXPRESSION_FIELD_NUMBER = 3; + private com.google.cloud.billing.v1.PricingExpression pricingExpression_; + /** + * + * + *
+   * Expresses the pricing formula. See `PricingExpression` for an example.
+   * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + * + * @return Whether the pricingExpression field is set. + */ + public boolean hasPricingExpression() { + return pricingExpression_ != null; + } + /** + * + * + *
+   * Expresses the pricing formula. See `PricingExpression` for an example.
+   * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + * + * @return The pricingExpression. + */ + public com.google.cloud.billing.v1.PricingExpression getPricingExpression() { + return pricingExpression_ == null + ? com.google.cloud.billing.v1.PricingExpression.getDefaultInstance() + : pricingExpression_; + } + /** + * + * + *
+   * Expresses the pricing formula. See `PricingExpression` for an example.
+   * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + public com.google.cloud.billing.v1.PricingExpressionOrBuilder getPricingExpressionOrBuilder() { + return getPricingExpression(); + } + + public static final int AGGREGATION_INFO_FIELD_NUMBER = 4; + private com.google.cloud.billing.v1.AggregationInfo aggregationInfo_; + /** + * + * + *
+   * Aggregation Info. This can be left unspecified if the pricing expression
+   * doesn't require aggregation.
+   * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + * + * @return Whether the aggregationInfo field is set. + */ + public boolean hasAggregationInfo() { + return aggregationInfo_ != null; + } + /** + * + * + *
+   * Aggregation Info. This can be left unspecified if the pricing expression
+   * doesn't require aggregation.
+   * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + * + * @return The aggregationInfo. + */ + public com.google.cloud.billing.v1.AggregationInfo getAggregationInfo() { + return aggregationInfo_ == null + ? com.google.cloud.billing.v1.AggregationInfo.getDefaultInstance() + : aggregationInfo_; + } + /** + * + * + *
+   * Aggregation Info. This can be left unspecified if the pricing expression
+   * doesn't require aggregation.
+   * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + public com.google.cloud.billing.v1.AggregationInfoOrBuilder getAggregationInfoOrBuilder() { + return getAggregationInfo(); + } + + public static final int CURRENCY_CONVERSION_RATE_FIELD_NUMBER = 5; + private double currencyConversionRate_; + /** + * + * + *
+   * Conversion rate used for currency conversion, from USD to the currency
+   * specified in the request. This includes any surcharge collected for billing
+   * in non USD currency. If a currency is not specified in the request this
+   * defaults to 1.0.
+   * Example: USD * currency_conversion_rate = JPY
+   * 
+ * + * double currency_conversion_rate = 5; + * + * @return The currencyConversionRate. + */ + public double getCurrencyConversionRate() { + return currencyConversionRate_; + } + + 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 (effectiveTime_ != null) { + output.writeMessage(1, getEffectiveTime()); + } + if (!getSummaryBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, summary_); + } + if (pricingExpression_ != null) { + output.writeMessage(3, getPricingExpression()); + } + if (aggregationInfo_ != null) { + output.writeMessage(4, getAggregationInfo()); + } + if (currencyConversionRate_ != 0D) { + output.writeDouble(5, currencyConversionRate_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (effectiveTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getEffectiveTime()); + } + if (!getSummaryBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, summary_); + } + if (pricingExpression_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getPricingExpression()); + } + if (aggregationInfo_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getAggregationInfo()); + } + if (currencyConversionRate_ != 0D) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(5, currencyConversionRate_); + } + 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.v1.PricingInfo)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.PricingInfo other = (com.google.cloud.billing.v1.PricingInfo) obj; + + if (hasEffectiveTime() != other.hasEffectiveTime()) return false; + if (hasEffectiveTime()) { + if (!getEffectiveTime().equals(other.getEffectiveTime())) return false; + } + if (!getSummary().equals(other.getSummary())) return false; + if (hasPricingExpression() != other.hasPricingExpression()) return false; + if (hasPricingExpression()) { + if (!getPricingExpression().equals(other.getPricingExpression())) return false; + } + if (hasAggregationInfo() != other.hasAggregationInfo()) return false; + if (hasAggregationInfo()) { + if (!getAggregationInfo().equals(other.getAggregationInfo())) return false; + } + if (java.lang.Double.doubleToLongBits(getCurrencyConversionRate()) + != java.lang.Double.doubleToLongBits(other.getCurrencyConversionRate())) 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 (hasEffectiveTime()) { + hash = (37 * hash) + EFFECTIVE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getEffectiveTime().hashCode(); + } + hash = (37 * hash) + SUMMARY_FIELD_NUMBER; + hash = (53 * hash) + getSummary().hashCode(); + if (hasPricingExpression()) { + hash = (37 * hash) + PRICING_EXPRESSION_FIELD_NUMBER; + hash = (53 * hash) + getPricingExpression().hashCode(); + } + if (hasAggregationInfo()) { + hash = (37 * hash) + AGGREGATION_INFO_FIELD_NUMBER; + hash = (53 * hash) + getAggregationInfo().hashCode(); + } + hash = (37 * hash) + CURRENCY_CONVERSION_RATE_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getCurrencyConversionRate())); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.PricingInfo parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingInfo 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.v1.PricingInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingInfo 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.v1.PricingInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.PricingInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.PricingInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingInfo 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.v1.PricingInfo parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingInfo 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.v1.PricingInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.PricingInfo 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.v1.PricingInfo prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents the pricing information for a SKU at a single point of time.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.PricingInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.PricingInfo) + com.google.cloud.billing.v1.PricingInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.PricingInfo.class, + com.google.cloud.billing.v1.PricingInfo.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.PricingInfo.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 (effectiveTimeBuilder_ == null) { + effectiveTime_ = null; + } else { + effectiveTime_ = null; + effectiveTimeBuilder_ = null; + } + summary_ = ""; + + if (pricingExpressionBuilder_ == null) { + pricingExpression_ = null; + } else { + pricingExpression_ = null; + pricingExpressionBuilder_ = null; + } + if (aggregationInfoBuilder_ == null) { + aggregationInfo_ = null; + } else { + aggregationInfo_ = null; + aggregationInfoBuilder_ = null; + } + currencyConversionRate_ = 0D; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_PricingInfo_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingInfo getDefaultInstanceForType() { + return com.google.cloud.billing.v1.PricingInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingInfo build() { + com.google.cloud.billing.v1.PricingInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.PricingInfo buildPartial() { + com.google.cloud.billing.v1.PricingInfo result = + new com.google.cloud.billing.v1.PricingInfo(this); + if (effectiveTimeBuilder_ == null) { + result.effectiveTime_ = effectiveTime_; + } else { + result.effectiveTime_ = effectiveTimeBuilder_.build(); + } + result.summary_ = summary_; + if (pricingExpressionBuilder_ == null) { + result.pricingExpression_ = pricingExpression_; + } else { + result.pricingExpression_ = pricingExpressionBuilder_.build(); + } + if (aggregationInfoBuilder_ == null) { + result.aggregationInfo_ = aggregationInfo_; + } else { + result.aggregationInfo_ = aggregationInfoBuilder_.build(); + } + result.currencyConversionRate_ = currencyConversionRate_; + 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.v1.PricingInfo) { + return mergeFrom((com.google.cloud.billing.v1.PricingInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.PricingInfo other) { + if (other == com.google.cloud.billing.v1.PricingInfo.getDefaultInstance()) return this; + if (other.hasEffectiveTime()) { + mergeEffectiveTime(other.getEffectiveTime()); + } + if (!other.getSummary().isEmpty()) { + summary_ = other.summary_; + onChanged(); + } + if (other.hasPricingExpression()) { + mergePricingExpression(other.getPricingExpression()); + } + if (other.hasAggregationInfo()) { + mergeAggregationInfo(other.getAggregationInfo()); + } + if (other.getCurrencyConversionRate() != 0D) { + setCurrencyConversionRate(other.getCurrencyConversionRate()); + } + 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.v1.PricingInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.PricingInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private com.google.protobuf.Timestamp effectiveTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + effectiveTimeBuilder_; + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + * + * @return Whether the effectiveTime field is set. + */ + public boolean hasEffectiveTime() { + return effectiveTimeBuilder_ != null || effectiveTime_ != null; + } + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + * + * @return The effectiveTime. + */ + public com.google.protobuf.Timestamp getEffectiveTime() { + if (effectiveTimeBuilder_ == null) { + return effectiveTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : effectiveTime_; + } else { + return effectiveTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + public Builder setEffectiveTime(com.google.protobuf.Timestamp value) { + if (effectiveTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + effectiveTime_ = value; + onChanged(); + } else { + effectiveTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + public Builder setEffectiveTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (effectiveTimeBuilder_ == null) { + effectiveTime_ = builderForValue.build(); + onChanged(); + } else { + effectiveTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + public Builder mergeEffectiveTime(com.google.protobuf.Timestamp value) { + if (effectiveTimeBuilder_ == null) { + if (effectiveTime_ != null) { + effectiveTime_ = + com.google.protobuf.Timestamp.newBuilder(effectiveTime_) + .mergeFrom(value) + .buildPartial(); + } else { + effectiveTime_ = value; + } + onChanged(); + } else { + effectiveTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + public Builder clearEffectiveTime() { + if (effectiveTimeBuilder_ == null) { + effectiveTime_ = null; + onChanged(); + } else { + effectiveTime_ = null; + effectiveTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + public com.google.protobuf.Timestamp.Builder getEffectiveTimeBuilder() { + + onChanged(); + return getEffectiveTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + public com.google.protobuf.TimestampOrBuilder getEffectiveTimeOrBuilder() { + if (effectiveTimeBuilder_ != null) { + return effectiveTimeBuilder_.getMessageOrBuilder(); + } else { + return effectiveTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : effectiveTime_; + } + } + /** + * + * + *
+     * The timestamp from which this pricing was effective within the requested
+     * time range. This is guaranteed to be greater than or equal to the
+     * start_time field in the request and less than the end_time field in the
+     * request. If a time range was not specified in the request this field will
+     * be equivalent to a time within the last 12 hours, indicating the latest
+     * pricing info.
+     * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getEffectiveTimeFieldBuilder() { + if (effectiveTimeBuilder_ == null) { + effectiveTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getEffectiveTime(), getParentForChildren(), isClean()); + effectiveTime_ = null; + } + return effectiveTimeBuilder_; + } + + private java.lang.Object summary_ = ""; + /** + * + * + *
+     * An optional human readable summary of the pricing information, has a
+     * maximum length of 256 characters.
+     * 
+ * + * string summary = 2; + * + * @return The summary. + */ + public java.lang.String getSummary() { + java.lang.Object ref = summary_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + summary_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * An optional human readable summary of the pricing information, has a
+     * maximum length of 256 characters.
+     * 
+ * + * string summary = 2; + * + * @return The bytes for summary. + */ + public com.google.protobuf.ByteString getSummaryBytes() { + java.lang.Object ref = summary_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + summary_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * An optional human readable summary of the pricing information, has a
+     * maximum length of 256 characters.
+     * 
+ * + * string summary = 2; + * + * @param value The summary to set. + * @return This builder for chaining. + */ + public Builder setSummary(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + summary_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * An optional human readable summary of the pricing information, has a
+     * maximum length of 256 characters.
+     * 
+ * + * string summary = 2; + * + * @return This builder for chaining. + */ + public Builder clearSummary() { + + summary_ = getDefaultInstance().getSummary(); + onChanged(); + return this; + } + /** + * + * + *
+     * An optional human readable summary of the pricing information, has a
+     * maximum length of 256 characters.
+     * 
+ * + * string summary = 2; + * + * @param value The bytes for summary to set. + * @return This builder for chaining. + */ + public Builder setSummaryBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + summary_ = value; + onChanged(); + return this; + } + + private com.google.cloud.billing.v1.PricingExpression pricingExpression_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.PricingExpression, + com.google.cloud.billing.v1.PricingExpression.Builder, + com.google.cloud.billing.v1.PricingExpressionOrBuilder> + pricingExpressionBuilder_; + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + * + * @return Whether the pricingExpression field is set. + */ + public boolean hasPricingExpression() { + return pricingExpressionBuilder_ != null || pricingExpression_ != null; + } + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + * + * @return The pricingExpression. + */ + public com.google.cloud.billing.v1.PricingExpression getPricingExpression() { + if (pricingExpressionBuilder_ == null) { + return pricingExpression_ == null + ? com.google.cloud.billing.v1.PricingExpression.getDefaultInstance() + : pricingExpression_; + } else { + return pricingExpressionBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + public Builder setPricingExpression(com.google.cloud.billing.v1.PricingExpression value) { + if (pricingExpressionBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + pricingExpression_ = value; + onChanged(); + } else { + pricingExpressionBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + public Builder setPricingExpression( + com.google.cloud.billing.v1.PricingExpression.Builder builderForValue) { + if (pricingExpressionBuilder_ == null) { + pricingExpression_ = builderForValue.build(); + onChanged(); + } else { + pricingExpressionBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + public Builder mergePricingExpression(com.google.cloud.billing.v1.PricingExpression value) { + if (pricingExpressionBuilder_ == null) { + if (pricingExpression_ != null) { + pricingExpression_ = + com.google.cloud.billing.v1.PricingExpression.newBuilder(pricingExpression_) + .mergeFrom(value) + .buildPartial(); + } else { + pricingExpression_ = value; + } + onChanged(); + } else { + pricingExpressionBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + public Builder clearPricingExpression() { + if (pricingExpressionBuilder_ == null) { + pricingExpression_ = null; + onChanged(); + } else { + pricingExpression_ = null; + pricingExpressionBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + public com.google.cloud.billing.v1.PricingExpression.Builder getPricingExpressionBuilder() { + + onChanged(); + return getPricingExpressionFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + public com.google.cloud.billing.v1.PricingExpressionOrBuilder getPricingExpressionOrBuilder() { + if (pricingExpressionBuilder_ != null) { + return pricingExpressionBuilder_.getMessageOrBuilder(); + } else { + return pricingExpression_ == null + ? com.google.cloud.billing.v1.PricingExpression.getDefaultInstance() + : pricingExpression_; + } + } + /** + * + * + *
+     * Expresses the pricing formula. See `PricingExpression` for an example.
+     * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.PricingExpression, + com.google.cloud.billing.v1.PricingExpression.Builder, + com.google.cloud.billing.v1.PricingExpressionOrBuilder> + getPricingExpressionFieldBuilder() { + if (pricingExpressionBuilder_ == null) { + pricingExpressionBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.PricingExpression, + com.google.cloud.billing.v1.PricingExpression.Builder, + com.google.cloud.billing.v1.PricingExpressionOrBuilder>( + getPricingExpression(), getParentForChildren(), isClean()); + pricingExpression_ = null; + } + return pricingExpressionBuilder_; + } + + private com.google.cloud.billing.v1.AggregationInfo aggregationInfo_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.AggregationInfo, + com.google.cloud.billing.v1.AggregationInfo.Builder, + com.google.cloud.billing.v1.AggregationInfoOrBuilder> + aggregationInfoBuilder_; + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + * + * @return Whether the aggregationInfo field is set. + */ + public boolean hasAggregationInfo() { + return aggregationInfoBuilder_ != null || aggregationInfo_ != null; + } + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + * + * @return The aggregationInfo. + */ + public com.google.cloud.billing.v1.AggregationInfo getAggregationInfo() { + if (aggregationInfoBuilder_ == null) { + return aggregationInfo_ == null + ? com.google.cloud.billing.v1.AggregationInfo.getDefaultInstance() + : aggregationInfo_; + } else { + return aggregationInfoBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + public Builder setAggregationInfo(com.google.cloud.billing.v1.AggregationInfo value) { + if (aggregationInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + aggregationInfo_ = value; + onChanged(); + } else { + aggregationInfoBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + public Builder setAggregationInfo( + com.google.cloud.billing.v1.AggregationInfo.Builder builderForValue) { + if (aggregationInfoBuilder_ == null) { + aggregationInfo_ = builderForValue.build(); + onChanged(); + } else { + aggregationInfoBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + public Builder mergeAggregationInfo(com.google.cloud.billing.v1.AggregationInfo value) { + if (aggregationInfoBuilder_ == null) { + if (aggregationInfo_ != null) { + aggregationInfo_ = + com.google.cloud.billing.v1.AggregationInfo.newBuilder(aggregationInfo_) + .mergeFrom(value) + .buildPartial(); + } else { + aggregationInfo_ = value; + } + onChanged(); + } else { + aggregationInfoBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + public Builder clearAggregationInfo() { + if (aggregationInfoBuilder_ == null) { + aggregationInfo_ = null; + onChanged(); + } else { + aggregationInfo_ = null; + aggregationInfoBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + public com.google.cloud.billing.v1.AggregationInfo.Builder getAggregationInfoBuilder() { + + onChanged(); + return getAggregationInfoFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + public com.google.cloud.billing.v1.AggregationInfoOrBuilder getAggregationInfoOrBuilder() { + if (aggregationInfoBuilder_ != null) { + return aggregationInfoBuilder_.getMessageOrBuilder(); + } else { + return aggregationInfo_ == null + ? com.google.cloud.billing.v1.AggregationInfo.getDefaultInstance() + : aggregationInfo_; + } + } + /** + * + * + *
+     * Aggregation Info. This can be left unspecified if the pricing expression
+     * doesn't require aggregation.
+     * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.AggregationInfo, + com.google.cloud.billing.v1.AggregationInfo.Builder, + com.google.cloud.billing.v1.AggregationInfoOrBuilder> + getAggregationInfoFieldBuilder() { + if (aggregationInfoBuilder_ == null) { + aggregationInfoBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.AggregationInfo, + com.google.cloud.billing.v1.AggregationInfo.Builder, + com.google.cloud.billing.v1.AggregationInfoOrBuilder>( + getAggregationInfo(), getParentForChildren(), isClean()); + aggregationInfo_ = null; + } + return aggregationInfoBuilder_; + } + + private double currencyConversionRate_; + /** + * + * + *
+     * Conversion rate used for currency conversion, from USD to the currency
+     * specified in the request. This includes any surcharge collected for billing
+     * in non USD currency. If a currency is not specified in the request this
+     * defaults to 1.0.
+     * Example: USD * currency_conversion_rate = JPY
+     * 
+ * + * double currency_conversion_rate = 5; + * + * @return The currencyConversionRate. + */ + public double getCurrencyConversionRate() { + return currencyConversionRate_; + } + /** + * + * + *
+     * Conversion rate used for currency conversion, from USD to the currency
+     * specified in the request. This includes any surcharge collected for billing
+     * in non USD currency. If a currency is not specified in the request this
+     * defaults to 1.0.
+     * Example: USD * currency_conversion_rate = JPY
+     * 
+ * + * double currency_conversion_rate = 5; + * + * @param value The currencyConversionRate to set. + * @return This builder for chaining. + */ + public Builder setCurrencyConversionRate(double value) { + + currencyConversionRate_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Conversion rate used for currency conversion, from USD to the currency
+     * specified in the request. This includes any surcharge collected for billing
+     * in non USD currency. If a currency is not specified in the request this
+     * defaults to 1.0.
+     * Example: USD * currency_conversion_rate = JPY
+     * 
+ * + * double currency_conversion_rate = 5; + * + * @return This builder for chaining. + */ + public Builder clearCurrencyConversionRate() { + + currencyConversionRate_ = 0D; + 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.v1.PricingInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.PricingInfo) + private static final com.google.cloud.billing.v1.PricingInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.PricingInfo(); + } + + public static com.google.cloud.billing.v1.PricingInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PricingInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new PricingInfo(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.v1.PricingInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingInfoOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingInfoOrBuilder.java new file mode 100644 index 00000000..a4155ac2 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingInfoOrBuilder.java @@ -0,0 +1,192 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface PricingInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.PricingInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The timestamp from which this pricing was effective within the requested
+   * time range. This is guaranteed to be greater than or equal to the
+   * start_time field in the request and less than the end_time field in the
+   * request. If a time range was not specified in the request this field will
+   * be equivalent to a time within the last 12 hours, indicating the latest
+   * pricing info.
+   * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + * + * @return Whether the effectiveTime field is set. + */ + boolean hasEffectiveTime(); + /** + * + * + *
+   * The timestamp from which this pricing was effective within the requested
+   * time range. This is guaranteed to be greater than or equal to the
+   * start_time field in the request and less than the end_time field in the
+   * request. If a time range was not specified in the request this field will
+   * be equivalent to a time within the last 12 hours, indicating the latest
+   * pricing info.
+   * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + * + * @return The effectiveTime. + */ + com.google.protobuf.Timestamp getEffectiveTime(); + /** + * + * + *
+   * The timestamp from which this pricing was effective within the requested
+   * time range. This is guaranteed to be greater than or equal to the
+   * start_time field in the request and less than the end_time field in the
+   * request. If a time range was not specified in the request this field will
+   * be equivalent to a time within the last 12 hours, indicating the latest
+   * pricing info.
+   * 
+ * + * .google.protobuf.Timestamp effective_time = 1; + */ + com.google.protobuf.TimestampOrBuilder getEffectiveTimeOrBuilder(); + + /** + * + * + *
+   * An optional human readable summary of the pricing information, has a
+   * maximum length of 256 characters.
+   * 
+ * + * string summary = 2; + * + * @return The summary. + */ + java.lang.String getSummary(); + /** + * + * + *
+   * An optional human readable summary of the pricing information, has a
+   * maximum length of 256 characters.
+   * 
+ * + * string summary = 2; + * + * @return The bytes for summary. + */ + com.google.protobuf.ByteString getSummaryBytes(); + + /** + * + * + *
+   * Expresses the pricing formula. See `PricingExpression` for an example.
+   * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + * + * @return Whether the pricingExpression field is set. + */ + boolean hasPricingExpression(); + /** + * + * + *
+   * Expresses the pricing formula. See `PricingExpression` for an example.
+   * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + * + * @return The pricingExpression. + */ + com.google.cloud.billing.v1.PricingExpression getPricingExpression(); + /** + * + * + *
+   * Expresses the pricing formula. See `PricingExpression` for an example.
+   * 
+ * + * .google.cloud.billing.v1.PricingExpression pricing_expression = 3; + */ + com.google.cloud.billing.v1.PricingExpressionOrBuilder getPricingExpressionOrBuilder(); + + /** + * + * + *
+   * Aggregation Info. This can be left unspecified if the pricing expression
+   * doesn't require aggregation.
+   * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + * + * @return Whether the aggregationInfo field is set. + */ + boolean hasAggregationInfo(); + /** + * + * + *
+   * Aggregation Info. This can be left unspecified if the pricing expression
+   * doesn't require aggregation.
+   * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + * + * @return The aggregationInfo. + */ + com.google.cloud.billing.v1.AggregationInfo getAggregationInfo(); + /** + * + * + *
+   * Aggregation Info. This can be left unspecified if the pricing expression
+   * doesn't require aggregation.
+   * 
+ * + * .google.cloud.billing.v1.AggregationInfo aggregation_info = 4; + */ + com.google.cloud.billing.v1.AggregationInfoOrBuilder getAggregationInfoOrBuilder(); + + /** + * + * + *
+   * Conversion rate used for currency conversion, from USD to the currency
+   * specified in the request. This includes any surcharge collected for billing
+   * in non USD currency. If a currency is not specified in the request this
+   * defaults to 1.0.
+   * Example: USD * currency_conversion_rate = JPY
+   * 
+ * + * double currency_conversion_rate = 5; + * + * @return The currencyConversionRate. + */ + double getCurrencyConversionRate(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ProjectBillingInfo.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ProjectBillingInfo.java new file mode 100644 index 00000000..aebb9c4a --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ProjectBillingInfo.java @@ -0,0 +1,1132 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Encapsulation of billing information for a GCP Console project. A project
+ * has at most one associated billing account at a time (but a billing account
+ * can be assigned to multiple projects).
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ProjectBillingInfo} + */ +public final class ProjectBillingInfo extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.ProjectBillingInfo) + ProjectBillingInfoOrBuilder { + private static final long serialVersionUID = 0L; + // Use ProjectBillingInfo.newBuilder() to construct. + private ProjectBillingInfo(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ProjectBillingInfo() { + name_ = ""; + projectId_ = ""; + billingAccountName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ProjectBillingInfo(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ProjectBillingInfo( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + projectId_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + billingAccountName_ = s; + break; + } + case 32: + { + billingEnabled_ = input.readBool(); + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ProjectBillingInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ProjectBillingInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ProjectBillingInfo.class, + com.google.cloud.billing.v1.ProjectBillingInfo.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The resource name for the `ProjectBillingInfo`; has the form
+   * `projects/{project_id}/billingInfo`. For example, the resource name for the
+   * billing information for project `tokyo-rain-123` would be
+   * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The resource name for the `ProjectBillingInfo`; has the form
+   * `projects/{project_id}/billingInfo`. For example, the resource name for the
+   * billing information for project `tokyo-rain-123` would be
+   * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + 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 PROJECT_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object projectId_; + /** + * + * + *
+   * The ID of the project that this `ProjectBillingInfo` represents, such as
+   * `tokyo-rain-123`. This is a convenience field so that you don't need to
+   * parse the `name` field to obtain a project ID. This field is read-only.
+   * 
+ * + * string project_id = 2; + * + * @return The projectId. + */ + public java.lang.String getProjectId() { + java.lang.Object ref = projectId_; + 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(); + projectId_ = s; + return s; + } + } + /** + * + * + *
+   * The ID of the project that this `ProjectBillingInfo` represents, such as
+   * `tokyo-rain-123`. This is a convenience field so that you don't need to
+   * parse the `name` field to obtain a project ID. This field is read-only.
+   * 
+ * + * string project_id = 2; + * + * @return The bytes for projectId. + */ + public com.google.protobuf.ByteString getProjectIdBytes() { + java.lang.Object ref = projectId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + projectId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BILLING_ACCOUNT_NAME_FIELD_NUMBER = 3; + private volatile java.lang.Object billingAccountName_; + /** + * + * + *
+   * The resource name of the billing account associated with the project, if
+   * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * string billing_account_name = 3; + * + * @return The billingAccountName. + */ + public java.lang.String getBillingAccountName() { + java.lang.Object ref = billingAccountName_; + 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(); + billingAccountName_ = s; + return s; + } + } + /** + * + * + *
+   * The resource name of the billing account associated with the project, if
+   * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * string billing_account_name = 3; + * + * @return The bytes for billingAccountName. + */ + public com.google.protobuf.ByteString getBillingAccountNameBytes() { + java.lang.Object ref = billingAccountName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + billingAccountName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int BILLING_ENABLED_FIELD_NUMBER = 4; + private boolean billingEnabled_; + /** + * + * + *
+   * True if the project is associated with an open billing account, to which
+   * usage on the project is charged. False if the project is associated with a
+   * closed billing account, or no billing account at all, and therefore cannot
+   * use paid services. This field is read-only.
+   * 
+ * + * bool billing_enabled = 4; + * + * @return The billingEnabled. + */ + public boolean getBillingEnabled() { + return billingEnabled_; + } + + 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 (!getProjectIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, projectId_); + } + if (!getBillingAccountNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, billingAccountName_); + } + if (billingEnabled_ != false) { + output.writeBool(4, billingEnabled_); + } + 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 (!getProjectIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, projectId_); + } + if (!getBillingAccountNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, billingAccountName_); + } + if (billingEnabled_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(4, billingEnabled_); + } + 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.v1.ProjectBillingInfo)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.ProjectBillingInfo other = + (com.google.cloud.billing.v1.ProjectBillingInfo) obj; + + if (!getName().equals(other.getName())) return false; + if (!getProjectId().equals(other.getProjectId())) return false; + if (!getBillingAccountName().equals(other.getBillingAccountName())) return false; + if (getBillingEnabled() != other.getBillingEnabled()) 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) + PROJECT_ID_FIELD_NUMBER; + hash = (53 * hash) + getProjectId().hashCode(); + hash = (37 * hash) + BILLING_ACCOUNT_NAME_FIELD_NUMBER; + hash = (53 * hash) + getBillingAccountName().hashCode(); + hash = (37 * hash) + BILLING_ENABLED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getBillingEnabled()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo 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.v1.ProjectBillingInfo parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo 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.v1.ProjectBillingInfo parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo 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.v1.ProjectBillingInfo parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo 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.v1.ProjectBillingInfo parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo 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.v1.ProjectBillingInfo 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; + } + /** + * + * + *
+   * Encapsulation of billing information for a GCP Console project. A project
+   * has at most one associated billing account at a time (but a billing account
+   * can be assigned to multiple projects).
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.ProjectBillingInfo} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.ProjectBillingInfo) + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ProjectBillingInfo_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ProjectBillingInfo_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.ProjectBillingInfo.class, + com.google.cloud.billing.v1.ProjectBillingInfo.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.ProjectBillingInfo.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_ = ""; + + projectId_ = ""; + + billingAccountName_ = ""; + + billingEnabled_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_ProjectBillingInfo_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ProjectBillingInfo getDefaultInstanceForType() { + return com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.ProjectBillingInfo build() { + com.google.cloud.billing.v1.ProjectBillingInfo result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.ProjectBillingInfo buildPartial() { + com.google.cloud.billing.v1.ProjectBillingInfo result = + new com.google.cloud.billing.v1.ProjectBillingInfo(this); + result.name_ = name_; + result.projectId_ = projectId_; + result.billingAccountName_ = billingAccountName_; + result.billingEnabled_ = billingEnabled_; + 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.v1.ProjectBillingInfo) { + return mergeFrom((com.google.cloud.billing.v1.ProjectBillingInfo) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.ProjectBillingInfo other) { + if (other == com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getProjectId().isEmpty()) { + projectId_ = other.projectId_; + onChanged(); + } + if (!other.getBillingAccountName().isEmpty()) { + billingAccountName_ = other.billingAccountName_; + onChanged(); + } + if (other.getBillingEnabled() != false) { + setBillingEnabled(other.getBillingEnabled()); + } + 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.v1.ProjectBillingInfo parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.ProjectBillingInfo) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The resource name for the `ProjectBillingInfo`; has the form
+     * `projects/{project_id}/billingInfo`. For example, the resource name for the
+     * billing information for project `tokyo-rain-123` would be
+     * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource name for the `ProjectBillingInfo`; has the form
+     * `projects/{project_id}/billingInfo`. For example, the resource name for the
+     * billing information for project `tokyo-rain-123` would be
+     * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource name for the `ProjectBillingInfo`; has the form
+     * `projects/{project_id}/billingInfo`. For example, the resource name for the
+     * billing information for project `tokyo-rain-123` would be
+     * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+     * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name for the `ProjectBillingInfo`; has the form
+     * `projects/{project_id}/billingInfo`. For example, the resource name for the
+     * billing information for project `tokyo-rain-123` would be
+     * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name for the `ProjectBillingInfo`; has the form
+     * `projects/{project_id}/billingInfo`. For example, the resource name for the
+     * billing information for project `tokyo-rain-123` would be
+     * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+     * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object projectId_ = ""; + /** + * + * + *
+     * The ID of the project that this `ProjectBillingInfo` represents, such as
+     * `tokyo-rain-123`. This is a convenience field so that you don't need to
+     * parse the `name` field to obtain a project ID. This field is read-only.
+     * 
+ * + * string project_id = 2; + * + * @return The projectId. + */ + public java.lang.String getProjectId() { + java.lang.Object ref = projectId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + projectId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The ID of the project that this `ProjectBillingInfo` represents, such as
+     * `tokyo-rain-123`. This is a convenience field so that you don't need to
+     * parse the `name` field to obtain a project ID. This field is read-only.
+     * 
+ * + * string project_id = 2; + * + * @return The bytes for projectId. + */ + public com.google.protobuf.ByteString getProjectIdBytes() { + java.lang.Object ref = projectId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + projectId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The ID of the project that this `ProjectBillingInfo` represents, such as
+     * `tokyo-rain-123`. This is a convenience field so that you don't need to
+     * parse the `name` field to obtain a project ID. This field is read-only.
+     * 
+ * + * string project_id = 2; + * + * @param value The projectId to set. + * @return This builder for chaining. + */ + public Builder setProjectId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + projectId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The ID of the project that this `ProjectBillingInfo` represents, such as
+     * `tokyo-rain-123`. This is a convenience field so that you don't need to
+     * parse the `name` field to obtain a project ID. This field is read-only.
+     * 
+ * + * string project_id = 2; + * + * @return This builder for chaining. + */ + public Builder clearProjectId() { + + projectId_ = getDefaultInstance().getProjectId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The ID of the project that this `ProjectBillingInfo` represents, such as
+     * `tokyo-rain-123`. This is a convenience field so that you don't need to
+     * parse the `name` field to obtain a project ID. This field is read-only.
+     * 
+ * + * string project_id = 2; + * + * @param value The bytes for projectId to set. + * @return This builder for chaining. + */ + public Builder setProjectIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + projectId_ = value; + onChanged(); + return this; + } + + private java.lang.Object billingAccountName_ = ""; + /** + * + * + *
+     * The resource name of the billing account associated with the project, if
+     * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * string billing_account_name = 3; + * + * @return The billingAccountName. + */ + public java.lang.String getBillingAccountName() { + java.lang.Object ref = billingAccountName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + billingAccountName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource name of the billing account associated with the project, if
+     * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * string billing_account_name = 3; + * + * @return The bytes for billingAccountName. + */ + public com.google.protobuf.ByteString getBillingAccountNameBytes() { + java.lang.Object ref = billingAccountName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + billingAccountName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource name of the billing account associated with the project, if
+     * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * string billing_account_name = 3; + * + * @param value The billingAccountName to set. + * @return This builder for chaining. + */ + public Builder setBillingAccountName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + billingAccountName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name of the billing account associated with the project, if
+     * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * string billing_account_name = 3; + * + * @return This builder for chaining. + */ + public Builder clearBillingAccountName() { + + billingAccountName_ = getDefaultInstance().getBillingAccountName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name of the billing account associated with the project, if
+     * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+     * 
+ * + * string billing_account_name = 3; + * + * @param value The bytes for billingAccountName to set. + * @return This builder for chaining. + */ + public Builder setBillingAccountNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + billingAccountName_ = value; + onChanged(); + return this; + } + + private boolean billingEnabled_; + /** + * + * + *
+     * True if the project is associated with an open billing account, to which
+     * usage on the project is charged. False if the project is associated with a
+     * closed billing account, or no billing account at all, and therefore cannot
+     * use paid services. This field is read-only.
+     * 
+ * + * bool billing_enabled = 4; + * + * @return The billingEnabled. + */ + public boolean getBillingEnabled() { + return billingEnabled_; + } + /** + * + * + *
+     * True if the project is associated with an open billing account, to which
+     * usage on the project is charged. False if the project is associated with a
+     * closed billing account, or no billing account at all, and therefore cannot
+     * use paid services. This field is read-only.
+     * 
+ * + * bool billing_enabled = 4; + * + * @param value The billingEnabled to set. + * @return This builder for chaining. + */ + public Builder setBillingEnabled(boolean value) { + + billingEnabled_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * True if the project is associated with an open billing account, to which
+     * usage on the project is charged. False if the project is associated with a
+     * closed billing account, or no billing account at all, and therefore cannot
+     * use paid services. This field is read-only.
+     * 
+ * + * bool billing_enabled = 4; + * + * @return This builder for chaining. + */ + public Builder clearBillingEnabled() { + + billingEnabled_ = false; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.billing.v1.ProjectBillingInfo) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.ProjectBillingInfo) + private static final com.google.cloud.billing.v1.ProjectBillingInfo DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.ProjectBillingInfo(); + } + + public static com.google.cloud.billing.v1.ProjectBillingInfo getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ProjectBillingInfo parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ProjectBillingInfo(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.v1.ProjectBillingInfo getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ProjectBillingInfoOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ProjectBillingInfoOrBuilder.java new file mode 100644 index 00000000..6252c53b --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ProjectBillingInfoOrBuilder.java @@ -0,0 +1,128 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface ProjectBillingInfoOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.ProjectBillingInfo) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The resource name for the `ProjectBillingInfo`; has the form
+   * `projects/{project_id}/billingInfo`. For example, the resource name for the
+   * billing information for project `tokyo-rain-123` would be
+   * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The resource name for the `ProjectBillingInfo`; has the form
+   * `projects/{project_id}/billingInfo`. For example, the resource name for the
+   * billing information for project `tokyo-rain-123` would be
+   * `projects/tokyo-rain-123/billingInfo`. This field is read-only.
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The ID of the project that this `ProjectBillingInfo` represents, such as
+   * `tokyo-rain-123`. This is a convenience field so that you don't need to
+   * parse the `name` field to obtain a project ID. This field is read-only.
+   * 
+ * + * string project_id = 2; + * + * @return The projectId. + */ + java.lang.String getProjectId(); + /** + * + * + *
+   * The ID of the project that this `ProjectBillingInfo` represents, such as
+   * `tokyo-rain-123`. This is a convenience field so that you don't need to
+   * parse the `name` field to obtain a project ID. This field is read-only.
+   * 
+ * + * string project_id = 2; + * + * @return The bytes for projectId. + */ + com.google.protobuf.ByteString getProjectIdBytes(); + + /** + * + * + *
+   * The resource name of the billing account associated with the project, if
+   * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * string billing_account_name = 3; + * + * @return The billingAccountName. + */ + java.lang.String getBillingAccountName(); + /** + * + * + *
+   * The resource name of the billing account associated with the project, if
+   * any. For example, `billingAccounts/012345-567890-ABCDEF`.
+   * 
+ * + * string billing_account_name = 3; + * + * @return The bytes for billingAccountName. + */ + com.google.protobuf.ByteString getBillingAccountNameBytes(); + + /** + * + * + *
+   * True if the project is associated with an open billing account, to which
+   * usage on the project is charged. False if the project is associated with a
+   * closed billing account, or no billing account at all, and therefore cannot
+   * use paid services. This field is read-only.
+   * 
+ * + * bool billing_enabled = 4; + * + * @return The billingEnabled. + */ + boolean getBillingEnabled(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Service.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Service.java new file mode 100644 index 00000000..8af7513c --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Service.java @@ -0,0 +1,1181 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Encapsulates a single service in Google Cloud Platform.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.Service} + */ +public final class Service extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.Service) + ServiceOrBuilder { + private static final long serialVersionUID = 0L; + // Use Service.newBuilder() to construct. + private Service(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Service() { + name_ = ""; + serviceId_ = ""; + displayName_ = ""; + businessEntityName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Service(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Service( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + serviceId_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + displayName_ = s; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + businessEntityName_ = 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.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Service_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Service_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.Service.class, + com.google.cloud.billing.v1.Service.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The resource name for the service.
+   * Example: "services/DA34-426B-A397"
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The resource name for the service.
+   * Example: "services/DA34-426B-A397"
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + 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 SERVICE_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object serviceId_; + /** + * + * + *
+   * The identifier for the service.
+   * Example: "DA34-426B-A397"
+   * 
+ * + * string service_id = 2; + * + * @return The serviceId. + */ + public java.lang.String getServiceId() { + java.lang.Object ref = serviceId_; + 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(); + serviceId_ = s; + return s; + } + } + /** + * + * + *
+   * The identifier for the service.
+   * Example: "DA34-426B-A397"
+   * 
+ * + * string service_id = 2; + * + * @return The bytes for serviceId. + */ + public com.google.protobuf.ByteString getServiceIdBytes() { + java.lang.Object ref = serviceId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DISPLAY_NAME_FIELD_NUMBER = 3; + private volatile java.lang.Object displayName_; + /** + * + * + *
+   * A human readable display name for this service.
+   * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + 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; + } + } + /** + * + * + *
+   * A human readable display name for this service.
+   * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + 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 BUSINESS_ENTITY_NAME_FIELD_NUMBER = 4; + private volatile java.lang.Object businessEntityName_; + /** + * + * + *
+   * The business under which the service is offered.
+   * Ex. "businessEntities/GCP", "businessEntities/Maps"
+   * 
+ * + * string business_entity_name = 4; + * + * @return The businessEntityName. + */ + public java.lang.String getBusinessEntityName() { + java.lang.Object ref = businessEntityName_; + 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(); + businessEntityName_ = s; + return s; + } + } + /** + * + * + *
+   * The business under which the service is offered.
+   * Ex. "businessEntities/GCP", "businessEntities/Maps"
+   * 
+ * + * string business_entity_name = 4; + * + * @return The bytes for businessEntityName. + */ + public com.google.protobuf.ByteString getBusinessEntityNameBytes() { + java.lang.Object ref = businessEntityName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + businessEntityName_ = 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 (!getServiceIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, serviceId_); + } + if (!getDisplayNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, displayName_); + } + if (!getBusinessEntityNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, businessEntityName_); + } + 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 (!getServiceIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, serviceId_); + } + if (!getDisplayNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, displayName_); + } + if (!getBusinessEntityNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, businessEntityName_); + } + 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.v1.Service)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.Service other = (com.google.cloud.billing.v1.Service) obj; + + if (!getName().equals(other.getName())) return false; + if (!getServiceId().equals(other.getServiceId())) return false; + if (!getDisplayName().equals(other.getDisplayName())) return false; + if (!getBusinessEntityName().equals(other.getBusinessEntityName())) 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) + SERVICE_ID_FIELD_NUMBER; + hash = (53 * hash) + getServiceId().hashCode(); + hash = (37 * hash) + DISPLAY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getDisplayName().hashCode(); + hash = (37 * hash) + BUSINESS_ENTITY_NAME_FIELD_NUMBER; + hash = (53 * hash) + getBusinessEntityName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.Service parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Service 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.v1.Service parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Service 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.v1.Service parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Service parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.Service parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Service 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.v1.Service parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Service 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.v1.Service parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Service 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.v1.Service 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; + } + /** + * + * + *
+   * Encapsulates a single service in Google Cloud Platform.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.Service} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.Service) + com.google.cloud.billing.v1.ServiceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Service_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Service_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.Service.class, + com.google.cloud.billing.v1.Service.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.Service.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_ = ""; + + serviceId_ = ""; + + displayName_ = ""; + + businessEntityName_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Service_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.Service getDefaultInstanceForType() { + return com.google.cloud.billing.v1.Service.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.Service build() { + com.google.cloud.billing.v1.Service result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.Service buildPartial() { + com.google.cloud.billing.v1.Service result = new com.google.cloud.billing.v1.Service(this); + result.name_ = name_; + result.serviceId_ = serviceId_; + result.displayName_ = displayName_; + result.businessEntityName_ = businessEntityName_; + 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.v1.Service) { + return mergeFrom((com.google.cloud.billing.v1.Service) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.Service other) { + if (other == com.google.cloud.billing.v1.Service.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getServiceId().isEmpty()) { + serviceId_ = other.serviceId_; + onChanged(); + } + if (!other.getDisplayName().isEmpty()) { + displayName_ = other.displayName_; + onChanged(); + } + if (!other.getBusinessEntityName().isEmpty()) { + businessEntityName_ = other.businessEntityName_; + 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.v1.Service parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.Service) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The resource name for the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource name for the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource name for the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name for the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name for the service.
+     * Example: "services/DA34-426B-A397"
+     * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object serviceId_ = ""; + /** + * + * + *
+     * The identifier for the service.
+     * Example: "DA34-426B-A397"
+     * 
+ * + * string service_id = 2; + * + * @return The serviceId. + */ + public java.lang.String getServiceId() { + java.lang.Object ref = serviceId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The identifier for the service.
+     * Example: "DA34-426B-A397"
+     * 
+ * + * string service_id = 2; + * + * @return The bytes for serviceId. + */ + public com.google.protobuf.ByteString getServiceIdBytes() { + java.lang.Object ref = serviceId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The identifier for the service.
+     * Example: "DA34-426B-A397"
+     * 
+ * + * string service_id = 2; + * + * @param value The serviceId to set. + * @return This builder for chaining. + */ + public Builder setServiceId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The identifier for the service.
+     * Example: "DA34-426B-A397"
+     * 
+ * + * string service_id = 2; + * + * @return This builder for chaining. + */ + public Builder clearServiceId() { + + serviceId_ = getDefaultInstance().getServiceId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The identifier for the service.
+     * Example: "DA34-426B-A397"
+     * 
+ * + * string service_id = 2; + * + * @param value The bytes for serviceId to set. + * @return This builder for chaining. + */ + public Builder setServiceIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceId_ = value; + onChanged(); + return this; + } + + private java.lang.Object displayName_ = ""; + /** + * + * + *
+     * A human readable display name for this service.
+     * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + 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; + } + } + /** + * + * + *
+     * A human readable display name for this service.
+     * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + 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; + } + } + /** + * + * + *
+     * A human readable display name for this service.
+     * 
+ * + * string display_name = 3; + * + * @param value The displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + displayName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A human readable display name for this service.
+     * 
+ * + * string display_name = 3; + * + * @return This builder for chaining. + */ + public Builder clearDisplayName() { + + displayName_ = getDefaultInstance().getDisplayName(); + onChanged(); + return this; + } + /** + * + * + *
+     * A human readable display name for this service.
+     * 
+ * + * string display_name = 3; + * + * @param value The bytes for displayName to set. + * @return This builder for chaining. + */ + public Builder setDisplayNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + displayName_ = value; + onChanged(); + return this; + } + + private java.lang.Object businessEntityName_ = ""; + /** + * + * + *
+     * The business under which the service is offered.
+     * Ex. "businessEntities/GCP", "businessEntities/Maps"
+     * 
+ * + * string business_entity_name = 4; + * + * @return The businessEntityName. + */ + public java.lang.String getBusinessEntityName() { + java.lang.Object ref = businessEntityName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + businessEntityName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The business under which the service is offered.
+     * Ex. "businessEntities/GCP", "businessEntities/Maps"
+     * 
+ * + * string business_entity_name = 4; + * + * @return The bytes for businessEntityName. + */ + public com.google.protobuf.ByteString getBusinessEntityNameBytes() { + java.lang.Object ref = businessEntityName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + businessEntityName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The business under which the service is offered.
+     * Ex. "businessEntities/GCP", "businessEntities/Maps"
+     * 
+ * + * string business_entity_name = 4; + * + * @param value The businessEntityName to set. + * @return This builder for chaining. + */ + public Builder setBusinessEntityName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + businessEntityName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The business under which the service is offered.
+     * Ex. "businessEntities/GCP", "businessEntities/Maps"
+     * 
+ * + * string business_entity_name = 4; + * + * @return This builder for chaining. + */ + public Builder clearBusinessEntityName() { + + businessEntityName_ = getDefaultInstance().getBusinessEntityName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The business under which the service is offered.
+     * Ex. "businessEntities/GCP", "businessEntities/Maps"
+     * 
+ * + * string business_entity_name = 4; + * + * @param value The bytes for businessEntityName to set. + * @return This builder for chaining. + */ + public Builder setBusinessEntityNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + businessEntityName_ = 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.v1.Service) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.Service) + private static final com.google.cloud.billing.v1.Service DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.Service(); + } + + public static com.google.cloud.billing.v1.Service getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Service parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Service(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.v1.Service getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ServiceName.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ServiceName.java new file mode 100644 index 00000000..b9fed217 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ServiceName.java @@ -0,0 +1,162 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.billing.v1; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** AUTO-GENERATED DOCUMENTATION AND CLASS */ +@javax.annotation.Generated("by GAPIC protoc plugin") +public class ServiceName implements ResourceName { + + private static final PathTemplate PATH_TEMPLATE = + PathTemplate.createWithoutUrlEncoding("services/{service}"); + + private volatile Map fieldValuesMap; + + private final String service; + + public String getService() { + return service; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + private ServiceName(Builder builder) { + service = Preconditions.checkNotNull(builder.getService()); + } + + public static ServiceName of(String service) { + return newBuilder().setService(service).build(); + } + + public static String format(String service) { + return newBuilder().setService(service).build().toString(); + } + + public static ServiceName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PATH_TEMPLATE.validatedMatch( + formattedString, "ServiceName.parse: formattedString not in valid format"); + return of(matchMap.get("service")); + } + + 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 (ServiceName 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("service", service); + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PATH_TEMPLATE.instantiate("service", service); + } + + /** Builder for ServiceName. */ + public static class Builder { + + private String service; + + public String getService() { + return service; + } + + public Builder setService(String service) { + this.service = service; + return this; + } + + private Builder() {} + + private Builder(ServiceName serviceName) { + service = serviceName.service; + } + + public ServiceName build() { + return new ServiceName(this); + } + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof ServiceName) { + ServiceName that = (ServiceName) o; + return (this.service.equals(that.service)); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= service.hashCode(); + return h; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ServiceOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ServiceOrBuilder.java new file mode 100644 index 00000000..d81c0664 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ServiceOrBuilder.java @@ -0,0 +1,131 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface ServiceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.Service) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The resource name for the service.
+   * Example: "services/DA34-426B-A397"
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The resource name for the service.
+   * Example: "services/DA34-426B-A397"
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The identifier for the service.
+   * Example: "DA34-426B-A397"
+   * 
+ * + * string service_id = 2; + * + * @return The serviceId. + */ + java.lang.String getServiceId(); + /** + * + * + *
+   * The identifier for the service.
+   * Example: "DA34-426B-A397"
+   * 
+ * + * string service_id = 2; + * + * @return The bytes for serviceId. + */ + com.google.protobuf.ByteString getServiceIdBytes(); + + /** + * + * + *
+   * A human readable display name for this service.
+   * 
+ * + * string display_name = 3; + * + * @return The displayName. + */ + java.lang.String getDisplayName(); + /** + * + * + *
+   * A human readable display name for this service.
+   * 
+ * + * string display_name = 3; + * + * @return The bytes for displayName. + */ + com.google.protobuf.ByteString getDisplayNameBytes(); + + /** + * + * + *
+   * The business under which the service is offered.
+   * Ex. "businessEntities/GCP", "businessEntities/Maps"
+   * 
+ * + * string business_entity_name = 4; + * + * @return The businessEntityName. + */ + java.lang.String getBusinessEntityName(); + /** + * + * + *
+   * The business under which the service is offered.
+   * Ex. "businessEntities/GCP", "businessEntities/Maps"
+   * 
+ * + * string business_entity_name = 4; + * + * @return The bytes for businessEntityName. + */ + com.google.protobuf.ByteString getBusinessEntityNameBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Sku.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Sku.java new file mode 100644 index 00000000..a208d5dc --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Sku.java @@ -0,0 +1,2249 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Encapsulates a single SKU in Google Cloud Platform
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.Sku} + */ +public final class Sku extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.Sku) + SkuOrBuilder { + private static final long serialVersionUID = 0L; + // Use Sku.newBuilder() to construct. + private Sku(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Sku() { + name_ = ""; + skuId_ = ""; + description_ = ""; + serviceRegions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + pricingInfo_ = java.util.Collections.emptyList(); + serviceProviderName_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Sku(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Sku( + 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(); + + skuId_ = s; + break; + } + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + + description_ = s; + break; + } + case 34: + { + com.google.cloud.billing.v1.Category.Builder subBuilder = null; + if (category_ != null) { + subBuilder = category_.toBuilder(); + } + category_ = + input.readMessage( + com.google.cloud.billing.v1.Category.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(category_); + category_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + serviceRegions_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + serviceRegions_.add(s); + break; + } + case 50: + { + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + pricingInfo_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000002; + } + pricingInfo_.add( + input.readMessage( + com.google.cloud.billing.v1.PricingInfo.parser(), extensionRegistry)); + break; + } + case 58: + { + java.lang.String s = input.readStringRequireUtf8(); + + serviceProviderName_ = 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)) { + serviceRegions_ = serviceRegions_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + pricingInfo_ = java.util.Collections.unmodifiableList(pricingInfo_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Sku_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Sku_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.Sku.class, com.google.cloud.billing.v1.Sku.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * The resource name for the SKU.
+   * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The resource name for the SKU.
+   * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + 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 SKU_ID_FIELD_NUMBER = 2; + private volatile java.lang.Object skuId_; + /** + * + * + *
+   * The identifier for the SKU.
+   * Example: "AA95-CD31-42FE"
+   * 
+ * + * string sku_id = 2; + * + * @return The skuId. + */ + public java.lang.String getSkuId() { + java.lang.Object ref = skuId_; + 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(); + skuId_ = s; + return s; + } + } + /** + * + * + *
+   * The identifier for the SKU.
+   * Example: "AA95-CD31-42FE"
+   * 
+ * + * string sku_id = 2; + * + * @return The bytes for skuId. + */ + public com.google.protobuf.ByteString getSkuIdBytes() { + java.lang.Object ref = skuId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + skuId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int DESCRIPTION_FIELD_NUMBER = 3; + private volatile java.lang.Object description_; + /** + * + * + *
+   * A human readable description of the SKU, has a maximum length of 256
+   * characters.
+   * 
+ * + * string description = 3; + * + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + 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(); + description_ = s; + return s; + } + } + /** + * + * + *
+   * A human readable description of the SKU, has a maximum length of 256
+   * characters.
+   * 
+ * + * string description = 3; + * + * @return The bytes for description. + */ + public com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CATEGORY_FIELD_NUMBER = 4; + private com.google.cloud.billing.v1.Category category_; + /** + * + * + *
+   * The category hierarchy of this SKU, purely for organizational purpose.
+   * 
+ * + * .google.cloud.billing.v1.Category category = 4; + * + * @return Whether the category field is set. + */ + public boolean hasCategory() { + return category_ != null; + } + /** + * + * + *
+   * The category hierarchy of this SKU, purely for organizational purpose.
+   * 
+ * + * .google.cloud.billing.v1.Category category = 4; + * + * @return The category. + */ + public com.google.cloud.billing.v1.Category getCategory() { + return category_ == null + ? com.google.cloud.billing.v1.Category.getDefaultInstance() + : category_; + } + /** + * + * + *
+   * The category hierarchy of this SKU, purely for organizational purpose.
+   * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + public com.google.cloud.billing.v1.CategoryOrBuilder getCategoryOrBuilder() { + return getCategory(); + } + + public static final int SERVICE_REGIONS_FIELD_NUMBER = 5; + private com.google.protobuf.LazyStringList serviceRegions_; + /** + * + * + *
+   * List of service regions this SKU is offered at.
+   * Example: "asia-east1"
+   * Service regions can be found at https://cloud.google.com/about/locations/
+   * 
+ * + * repeated string service_regions = 5; + * + * @return A list containing the serviceRegions. + */ + public com.google.protobuf.ProtocolStringList getServiceRegionsList() { + return serviceRegions_; + } + /** + * + * + *
+   * List of service regions this SKU is offered at.
+   * Example: "asia-east1"
+   * Service regions can be found at https://cloud.google.com/about/locations/
+   * 
+ * + * repeated string service_regions = 5; + * + * @return The count of serviceRegions. + */ + public int getServiceRegionsCount() { + return serviceRegions_.size(); + } + /** + * + * + *
+   * List of service regions this SKU is offered at.
+   * Example: "asia-east1"
+   * Service regions can be found at https://cloud.google.com/about/locations/
+   * 
+ * + * repeated string service_regions = 5; + * + * @param index The index of the element to return. + * @return The serviceRegions at the given index. + */ + public java.lang.String getServiceRegions(int index) { + return serviceRegions_.get(index); + } + /** + * + * + *
+   * List of service regions this SKU is offered at.
+   * Example: "asia-east1"
+   * Service regions can be found at https://cloud.google.com/about/locations/
+   * 
+ * + * repeated string service_regions = 5; + * + * @param index The index of the value to return. + * @return The bytes of the serviceRegions at the given index. + */ + public com.google.protobuf.ByteString getServiceRegionsBytes(int index) { + return serviceRegions_.getByteString(index); + } + + public static final int PRICING_INFO_FIELD_NUMBER = 6; + private java.util.List pricingInfo_; + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public java.util.List getPricingInfoList() { + return pricingInfo_; + } + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public java.util.List + getPricingInfoOrBuilderList() { + return pricingInfo_; + } + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public int getPricingInfoCount() { + return pricingInfo_.size(); + } + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public com.google.cloud.billing.v1.PricingInfo getPricingInfo(int index) { + return pricingInfo_.get(index); + } + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public com.google.cloud.billing.v1.PricingInfoOrBuilder getPricingInfoOrBuilder(int index) { + return pricingInfo_.get(index); + } + + public static final int SERVICE_PROVIDER_NAME_FIELD_NUMBER = 7; + private volatile java.lang.Object serviceProviderName_; + /** + * + * + *
+   * Identifies the service provider.
+   * This is 'Google' for first party services in Google Cloud Platform.
+   * 
+ * + * string service_provider_name = 7; + * + * @return The serviceProviderName. + */ + public java.lang.String getServiceProviderName() { + java.lang.Object ref = serviceProviderName_; + 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(); + serviceProviderName_ = s; + return s; + } + } + /** + * + * + *
+   * Identifies the service provider.
+   * This is 'Google' for first party services in Google Cloud Platform.
+   * 
+ * + * string service_provider_name = 7; + * + * @return The bytes for serviceProviderName. + */ + public com.google.protobuf.ByteString getServiceProviderNameBytes() { + java.lang.Object ref = serviceProviderName_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceProviderName_ = 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 (!getSkuIdBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, skuId_); + } + if (!getDescriptionBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, description_); + } + if (category_ != null) { + output.writeMessage(4, getCategory()); + } + for (int i = 0; i < serviceRegions_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 5, serviceRegions_.getRaw(i)); + } + for (int i = 0; i < pricingInfo_.size(); i++) { + output.writeMessage(6, pricingInfo_.get(i)); + } + if (!getServiceProviderNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 7, serviceProviderName_); + } + 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 (!getSkuIdBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, skuId_); + } + if (!getDescriptionBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, description_); + } + if (category_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getCategory()); + } + { + int dataSize = 0; + for (int i = 0; i < serviceRegions_.size(); i++) { + dataSize += computeStringSizeNoTag(serviceRegions_.getRaw(i)); + } + size += dataSize; + size += 1 * getServiceRegionsList().size(); + } + for (int i = 0; i < pricingInfo_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, pricingInfo_.get(i)); + } + if (!getServiceProviderNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, serviceProviderName_); + } + 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.v1.Sku)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.Sku other = (com.google.cloud.billing.v1.Sku) obj; + + if (!getName().equals(other.getName())) return false; + if (!getSkuId().equals(other.getSkuId())) return false; + if (!getDescription().equals(other.getDescription())) return false; + if (hasCategory() != other.hasCategory()) return false; + if (hasCategory()) { + if (!getCategory().equals(other.getCategory())) return false; + } + if (!getServiceRegionsList().equals(other.getServiceRegionsList())) return false; + if (!getPricingInfoList().equals(other.getPricingInfoList())) return false; + if (!getServiceProviderName().equals(other.getServiceProviderName())) 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) + SKU_ID_FIELD_NUMBER; + hash = (53 * hash) + getSkuId().hashCode(); + hash = (37 * hash) + DESCRIPTION_FIELD_NUMBER; + hash = (53 * hash) + getDescription().hashCode(); + if (hasCategory()) { + hash = (37 * hash) + CATEGORY_FIELD_NUMBER; + hash = (53 * hash) + getCategory().hashCode(); + } + if (getServiceRegionsCount() > 0) { + hash = (37 * hash) + SERVICE_REGIONS_FIELD_NUMBER; + hash = (53 * hash) + getServiceRegionsList().hashCode(); + } + if (getPricingInfoCount() > 0) { + hash = (37 * hash) + PRICING_INFO_FIELD_NUMBER; + hash = (53 * hash) + getPricingInfoList().hashCode(); + } + hash = (37 * hash) + SERVICE_PROVIDER_NAME_FIELD_NUMBER; + hash = (53 * hash) + getServiceProviderName().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.Sku parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Sku 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.v1.Sku parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Sku 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.v1.Sku parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.Sku parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.Sku parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Sku 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.v1.Sku parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Sku 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.v1.Sku parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.Sku 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.v1.Sku 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; + } + /** + * + * + *
+   * Encapsulates a single SKU in Google Cloud Platform
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.Sku} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.Sku) + com.google.cloud.billing.v1.SkuOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Sku_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Sku_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.Sku.class, com.google.cloud.billing.v1.Sku.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.Sku.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getPricingInfoFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + name_ = ""; + + skuId_ = ""; + + description_ = ""; + + if (categoryBuilder_ == null) { + category_ = null; + } else { + category_ = null; + categoryBuilder_ = null; + } + serviceRegions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + if (pricingInfoBuilder_ == null) { + pricingInfo_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + } else { + pricingInfoBuilder_.clear(); + } + serviceProviderName_ = ""; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudCatalogProto + .internal_static_google_cloud_billing_v1_Sku_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.Sku getDefaultInstanceForType() { + return com.google.cloud.billing.v1.Sku.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.Sku build() { + com.google.cloud.billing.v1.Sku result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.Sku buildPartial() { + com.google.cloud.billing.v1.Sku result = new com.google.cloud.billing.v1.Sku(this); + int from_bitField0_ = bitField0_; + result.name_ = name_; + result.skuId_ = skuId_; + result.description_ = description_; + if (categoryBuilder_ == null) { + result.category_ = category_; + } else { + result.category_ = categoryBuilder_.build(); + } + if (((bitField0_ & 0x00000001) != 0)) { + serviceRegions_ = serviceRegions_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.serviceRegions_ = serviceRegions_; + if (pricingInfoBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0)) { + pricingInfo_ = java.util.Collections.unmodifiableList(pricingInfo_); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.pricingInfo_ = pricingInfo_; + } else { + result.pricingInfo_ = pricingInfoBuilder_.build(); + } + result.serviceProviderName_ = serviceProviderName_; + 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.v1.Sku) { + return mergeFrom((com.google.cloud.billing.v1.Sku) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.Sku other) { + if (other == com.google.cloud.billing.v1.Sku.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (!other.getSkuId().isEmpty()) { + skuId_ = other.skuId_; + onChanged(); + } + if (!other.getDescription().isEmpty()) { + description_ = other.description_; + onChanged(); + } + if (other.hasCategory()) { + mergeCategory(other.getCategory()); + } + if (!other.serviceRegions_.isEmpty()) { + if (serviceRegions_.isEmpty()) { + serviceRegions_ = other.serviceRegions_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureServiceRegionsIsMutable(); + serviceRegions_.addAll(other.serviceRegions_); + } + onChanged(); + } + if (pricingInfoBuilder_ == null) { + if (!other.pricingInfo_.isEmpty()) { + if (pricingInfo_.isEmpty()) { + pricingInfo_ = other.pricingInfo_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensurePricingInfoIsMutable(); + pricingInfo_.addAll(other.pricingInfo_); + } + onChanged(); + } + } else { + if (!other.pricingInfo_.isEmpty()) { + if (pricingInfoBuilder_.isEmpty()) { + pricingInfoBuilder_.dispose(); + pricingInfoBuilder_ = null; + pricingInfo_ = other.pricingInfo_; + bitField0_ = (bitField0_ & ~0x00000002); + pricingInfoBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getPricingInfoFieldBuilder() + : null; + } else { + pricingInfoBuilder_.addAllMessages(other.pricingInfo_); + } + } + } + if (!other.getServiceProviderName().isEmpty()) { + serviceProviderName_ = other.serviceProviderName_; + 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.v1.Sku parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.billing.v1.Sku) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The resource name for the SKU.
+     * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The resource name for the SKU.
+     * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The resource name for the SKU.
+     * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+     * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name for the SKU.
+     * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * The resource name for the SKU.
+     * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+     * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private java.lang.Object skuId_ = ""; + /** + * + * + *
+     * The identifier for the SKU.
+     * Example: "AA95-CD31-42FE"
+     * 
+ * + * string sku_id = 2; + * + * @return The skuId. + */ + public java.lang.String getSkuId() { + java.lang.Object ref = skuId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + skuId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The identifier for the SKU.
+     * Example: "AA95-CD31-42FE"
+     * 
+ * + * string sku_id = 2; + * + * @return The bytes for skuId. + */ + public com.google.protobuf.ByteString getSkuIdBytes() { + java.lang.Object ref = skuId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + skuId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The identifier for the SKU.
+     * Example: "AA95-CD31-42FE"
+     * 
+ * + * string sku_id = 2; + * + * @param value The skuId to set. + * @return This builder for chaining. + */ + public Builder setSkuId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + skuId_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The identifier for the SKU.
+     * Example: "AA95-CD31-42FE"
+     * 
+ * + * string sku_id = 2; + * + * @return This builder for chaining. + */ + public Builder clearSkuId() { + + skuId_ = getDefaultInstance().getSkuId(); + onChanged(); + return this; + } + /** + * + * + *
+     * The identifier for the SKU.
+     * Example: "AA95-CD31-42FE"
+     * 
+ * + * string sku_id = 2; + * + * @param value The bytes for skuId to set. + * @return This builder for chaining. + */ + public Builder setSkuIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + skuId_ = value; + onChanged(); + return this; + } + + private java.lang.Object description_ = ""; + /** + * + * + *
+     * A human readable description of the SKU, has a maximum length of 256
+     * characters.
+     * 
+ * + * string description = 3; + * + * @return The description. + */ + public java.lang.String getDescription() { + java.lang.Object ref = description_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + description_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * A human readable description of the SKU, has a maximum length of 256
+     * characters.
+     * 
+ * + * string description = 3; + * + * @return The bytes for description. + */ + public com.google.protobuf.ByteString getDescriptionBytes() { + java.lang.Object ref = description_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + description_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * A human readable description of the SKU, has a maximum length of 256
+     * characters.
+     * 
+ * + * string description = 3; + * + * @param value The description to set. + * @return This builder for chaining. + */ + public Builder setDescription(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + description_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * A human readable description of the SKU, has a maximum length of 256
+     * characters.
+     * 
+ * + * string description = 3; + * + * @return This builder for chaining. + */ + public Builder clearDescription() { + + description_ = getDefaultInstance().getDescription(); + onChanged(); + return this; + } + /** + * + * + *
+     * A human readable description of the SKU, has a maximum length of 256
+     * characters.
+     * 
+ * + * string description = 3; + * + * @param value The bytes for description to set. + * @return This builder for chaining. + */ + public Builder setDescriptionBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + description_ = value; + onChanged(); + return this; + } + + private com.google.cloud.billing.v1.Category category_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.Category, + com.google.cloud.billing.v1.Category.Builder, + com.google.cloud.billing.v1.CategoryOrBuilder> + categoryBuilder_; + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + * + * @return Whether the category field is set. + */ + public boolean hasCategory() { + return categoryBuilder_ != null || category_ != null; + } + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + * + * @return The category. + */ + public com.google.cloud.billing.v1.Category getCategory() { + if (categoryBuilder_ == null) { + return category_ == null + ? com.google.cloud.billing.v1.Category.getDefaultInstance() + : category_; + } else { + return categoryBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + public Builder setCategory(com.google.cloud.billing.v1.Category value) { + if (categoryBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + category_ = value; + onChanged(); + } else { + categoryBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + public Builder setCategory(com.google.cloud.billing.v1.Category.Builder builderForValue) { + if (categoryBuilder_ == null) { + category_ = builderForValue.build(); + onChanged(); + } else { + categoryBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + public Builder mergeCategory(com.google.cloud.billing.v1.Category value) { + if (categoryBuilder_ == null) { + if (category_ != null) { + category_ = + com.google.cloud.billing.v1.Category.newBuilder(category_) + .mergeFrom(value) + .buildPartial(); + } else { + category_ = value; + } + onChanged(); + } else { + categoryBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + public Builder clearCategory() { + if (categoryBuilder_ == null) { + category_ = null; + onChanged(); + } else { + category_ = null; + categoryBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + public com.google.cloud.billing.v1.Category.Builder getCategoryBuilder() { + + onChanged(); + return getCategoryFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + public com.google.cloud.billing.v1.CategoryOrBuilder getCategoryOrBuilder() { + if (categoryBuilder_ != null) { + return categoryBuilder_.getMessageOrBuilder(); + } else { + return category_ == null + ? com.google.cloud.billing.v1.Category.getDefaultInstance() + : category_; + } + } + /** + * + * + *
+     * The category hierarchy of this SKU, purely for organizational purpose.
+     * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.Category, + com.google.cloud.billing.v1.Category.Builder, + com.google.cloud.billing.v1.CategoryOrBuilder> + getCategoryFieldBuilder() { + if (categoryBuilder_ == null) { + categoryBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.Category, + com.google.cloud.billing.v1.Category.Builder, + com.google.cloud.billing.v1.CategoryOrBuilder>( + getCategory(), getParentForChildren(), isClean()); + category_ = null; + } + return categoryBuilder_; + } + + private com.google.protobuf.LazyStringList serviceRegions_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureServiceRegionsIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + serviceRegions_ = new com.google.protobuf.LazyStringArrayList(serviceRegions_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @return A list containing the serviceRegions. + */ + public com.google.protobuf.ProtocolStringList getServiceRegionsList() { + return serviceRegions_.getUnmodifiableView(); + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @return The count of serviceRegions. + */ + public int getServiceRegionsCount() { + return serviceRegions_.size(); + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @param index The index of the element to return. + * @return The serviceRegions at the given index. + */ + public java.lang.String getServiceRegions(int index) { + return serviceRegions_.get(index); + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @param value The bytes of the serviceRegions to add. + */ + public com.google.protobuf.ByteString getServiceRegionsBytes(int index) { + return serviceRegions_.getByteString(index); + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @param index The index to set the value at. + * @param value The serviceRegions to set. + * @return This builder for chaining. + */ + public Builder setServiceRegions(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureServiceRegionsIsMutable(); + serviceRegions_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @param value The serviceRegions to add. + * @return This builder for chaining. + */ + public Builder addServiceRegions(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureServiceRegionsIsMutable(); + serviceRegions_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @param values The serviceRegions to add. + * @return This builder for chaining. + */ + public Builder addAllServiceRegions(java.lang.Iterable values) { + ensureServiceRegionsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, serviceRegions_); + onChanged(); + return this; + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @return This builder for chaining. + */ + public Builder clearServiceRegions() { + serviceRegions_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * List of service regions this SKU is offered at.
+     * Example: "asia-east1"
+     * Service regions can be found at https://cloud.google.com/about/locations/
+     * 
+ * + * repeated string service_regions = 5; + * + * @param value The bytes of the serviceRegions to add. + * @return This builder for chaining. + */ + public Builder addServiceRegionsBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureServiceRegionsIsMutable(); + serviceRegions_.add(value); + onChanged(); + return this; + } + + private java.util.List pricingInfo_ = + java.util.Collections.emptyList(); + + private void ensurePricingInfoIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + pricingInfo_ = + new java.util.ArrayList(pricingInfo_); + bitField0_ |= 0x00000002; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.PricingInfo, + com.google.cloud.billing.v1.PricingInfo.Builder, + com.google.cloud.billing.v1.PricingInfoOrBuilder> + pricingInfoBuilder_; + + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public java.util.List getPricingInfoList() { + if (pricingInfoBuilder_ == null) { + return java.util.Collections.unmodifiableList(pricingInfo_); + } else { + return pricingInfoBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public int getPricingInfoCount() { + if (pricingInfoBuilder_ == null) { + return pricingInfo_.size(); + } else { + return pricingInfoBuilder_.getCount(); + } + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public com.google.cloud.billing.v1.PricingInfo getPricingInfo(int index) { + if (pricingInfoBuilder_ == null) { + return pricingInfo_.get(index); + } else { + return pricingInfoBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder setPricingInfo(int index, com.google.cloud.billing.v1.PricingInfo value) { + if (pricingInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePricingInfoIsMutable(); + pricingInfo_.set(index, value); + onChanged(); + } else { + pricingInfoBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder setPricingInfo( + int index, com.google.cloud.billing.v1.PricingInfo.Builder builderForValue) { + if (pricingInfoBuilder_ == null) { + ensurePricingInfoIsMutable(); + pricingInfo_.set(index, builderForValue.build()); + onChanged(); + } else { + pricingInfoBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder addPricingInfo(com.google.cloud.billing.v1.PricingInfo value) { + if (pricingInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePricingInfoIsMutable(); + pricingInfo_.add(value); + onChanged(); + } else { + pricingInfoBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder addPricingInfo(int index, com.google.cloud.billing.v1.PricingInfo value) { + if (pricingInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensurePricingInfoIsMutable(); + pricingInfo_.add(index, value); + onChanged(); + } else { + pricingInfoBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder addPricingInfo(com.google.cloud.billing.v1.PricingInfo.Builder builderForValue) { + if (pricingInfoBuilder_ == null) { + ensurePricingInfoIsMutable(); + pricingInfo_.add(builderForValue.build()); + onChanged(); + } else { + pricingInfoBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder addPricingInfo( + int index, com.google.cloud.billing.v1.PricingInfo.Builder builderForValue) { + if (pricingInfoBuilder_ == null) { + ensurePricingInfoIsMutable(); + pricingInfo_.add(index, builderForValue.build()); + onChanged(); + } else { + pricingInfoBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder addAllPricingInfo( + java.lang.Iterable values) { + if (pricingInfoBuilder_ == null) { + ensurePricingInfoIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, pricingInfo_); + onChanged(); + } else { + pricingInfoBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder clearPricingInfo() { + if (pricingInfoBuilder_ == null) { + pricingInfo_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + } else { + pricingInfoBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public Builder removePricingInfo(int index) { + if (pricingInfoBuilder_ == null) { + ensurePricingInfoIsMutable(); + pricingInfo_.remove(index); + onChanged(); + } else { + pricingInfoBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public com.google.cloud.billing.v1.PricingInfo.Builder getPricingInfoBuilder(int index) { + return getPricingInfoFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public com.google.cloud.billing.v1.PricingInfoOrBuilder getPricingInfoOrBuilder(int index) { + if (pricingInfoBuilder_ == null) { + return pricingInfo_.get(index); + } else { + return pricingInfoBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public java.util.List + getPricingInfoOrBuilderList() { + if (pricingInfoBuilder_ != null) { + return pricingInfoBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(pricingInfo_); + } + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public com.google.cloud.billing.v1.PricingInfo.Builder addPricingInfoBuilder() { + return getPricingInfoFieldBuilder() + .addBuilder(com.google.cloud.billing.v1.PricingInfo.getDefaultInstance()); + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public com.google.cloud.billing.v1.PricingInfo.Builder addPricingInfoBuilder(int index) { + return getPricingInfoFieldBuilder() + .addBuilder(index, com.google.cloud.billing.v1.PricingInfo.getDefaultInstance()); + } + /** + * + * + *
+     * A timeline of pricing info for this SKU in chronological order.
+     * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + public java.util.List + getPricingInfoBuilderList() { + return getPricingInfoFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.PricingInfo, + com.google.cloud.billing.v1.PricingInfo.Builder, + com.google.cloud.billing.v1.PricingInfoOrBuilder> + getPricingInfoFieldBuilder() { + if (pricingInfoBuilder_ == null) { + pricingInfoBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.billing.v1.PricingInfo, + com.google.cloud.billing.v1.PricingInfo.Builder, + com.google.cloud.billing.v1.PricingInfoOrBuilder>( + pricingInfo_, ((bitField0_ & 0x00000002) != 0), getParentForChildren(), isClean()); + pricingInfo_ = null; + } + return pricingInfoBuilder_; + } + + private java.lang.Object serviceProviderName_ = ""; + /** + * + * + *
+     * Identifies the service provider.
+     * This is 'Google' for first party services in Google Cloud Platform.
+     * 
+ * + * string service_provider_name = 7; + * + * @return The serviceProviderName. + */ + public java.lang.String getServiceProviderName() { + java.lang.Object ref = serviceProviderName_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + serviceProviderName_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Identifies the service provider.
+     * This is 'Google' for first party services in Google Cloud Platform.
+     * 
+ * + * string service_provider_name = 7; + * + * @return The bytes for serviceProviderName. + */ + public com.google.protobuf.ByteString getServiceProviderNameBytes() { + java.lang.Object ref = serviceProviderName_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + serviceProviderName_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Identifies the service provider.
+     * This is 'Google' for first party services in Google Cloud Platform.
+     * 
+ * + * string service_provider_name = 7; + * + * @param value The serviceProviderName to set. + * @return This builder for chaining. + */ + public Builder setServiceProviderName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + serviceProviderName_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Identifies the service provider.
+     * This is 'Google' for first party services in Google Cloud Platform.
+     * 
+ * + * string service_provider_name = 7; + * + * @return This builder for chaining. + */ + public Builder clearServiceProviderName() { + + serviceProviderName_ = getDefaultInstance().getServiceProviderName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Identifies the service provider.
+     * This is 'Google' for first party services in Google Cloud Platform.
+     * 
+ * + * string service_provider_name = 7; + * + * @param value The bytes for serviceProviderName to set. + * @return This builder for chaining. + */ + public Builder setServiceProviderNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + serviceProviderName_ = 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.v1.Sku) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.Sku) + private static final com.google.cloud.billing.v1.Sku DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.Sku(); + } + + public static com.google.cloud.billing.v1.Sku getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Sku parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Sku(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.v1.Sku getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/SkuOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/SkuOrBuilder.java new file mode 100644 index 00000000..9b282cd8 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/SkuOrBuilder.java @@ -0,0 +1,279 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_catalog.proto + +package com.google.cloud.billing.v1; + +public interface SkuOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.Sku) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The resource name for the SKU.
+   * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The resource name for the SKU.
+   * Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE"
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The identifier for the SKU.
+   * Example: "AA95-CD31-42FE"
+   * 
+ * + * string sku_id = 2; + * + * @return The skuId. + */ + java.lang.String getSkuId(); + /** + * + * + *
+   * The identifier for the SKU.
+   * Example: "AA95-CD31-42FE"
+   * 
+ * + * string sku_id = 2; + * + * @return The bytes for skuId. + */ + com.google.protobuf.ByteString getSkuIdBytes(); + + /** + * + * + *
+   * A human readable description of the SKU, has a maximum length of 256
+   * characters.
+   * 
+ * + * string description = 3; + * + * @return The description. + */ + java.lang.String getDescription(); + /** + * + * + *
+   * A human readable description of the SKU, has a maximum length of 256
+   * characters.
+   * 
+ * + * string description = 3; + * + * @return The bytes for description. + */ + com.google.protobuf.ByteString getDescriptionBytes(); + + /** + * + * + *
+   * The category hierarchy of this SKU, purely for organizational purpose.
+   * 
+ * + * .google.cloud.billing.v1.Category category = 4; + * + * @return Whether the category field is set. + */ + boolean hasCategory(); + /** + * + * + *
+   * The category hierarchy of this SKU, purely for organizational purpose.
+   * 
+ * + * .google.cloud.billing.v1.Category category = 4; + * + * @return The category. + */ + com.google.cloud.billing.v1.Category getCategory(); + /** + * + * + *
+   * The category hierarchy of this SKU, purely for organizational purpose.
+   * 
+ * + * .google.cloud.billing.v1.Category category = 4; + */ + com.google.cloud.billing.v1.CategoryOrBuilder getCategoryOrBuilder(); + + /** + * + * + *
+   * List of service regions this SKU is offered at.
+   * Example: "asia-east1"
+   * Service regions can be found at https://cloud.google.com/about/locations/
+   * 
+ * + * repeated string service_regions = 5; + * + * @return A list containing the serviceRegions. + */ + java.util.List getServiceRegionsList(); + /** + * + * + *
+   * List of service regions this SKU is offered at.
+   * Example: "asia-east1"
+   * Service regions can be found at https://cloud.google.com/about/locations/
+   * 
+ * + * repeated string service_regions = 5; + * + * @return The count of serviceRegions. + */ + int getServiceRegionsCount(); + /** + * + * + *
+   * List of service regions this SKU is offered at.
+   * Example: "asia-east1"
+   * Service regions can be found at https://cloud.google.com/about/locations/
+   * 
+ * + * repeated string service_regions = 5; + * + * @param index The index of the element to return. + * @return The serviceRegions at the given index. + */ + java.lang.String getServiceRegions(int index); + /** + * + * + *
+   * List of service regions this SKU is offered at.
+   * Example: "asia-east1"
+   * Service regions can be found at https://cloud.google.com/about/locations/
+   * 
+ * + * repeated string service_regions = 5; + * + * @param index The index of the value to return. + * @return The bytes of the serviceRegions at the given index. + */ + com.google.protobuf.ByteString getServiceRegionsBytes(int index); + + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + java.util.List getPricingInfoList(); + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + com.google.cloud.billing.v1.PricingInfo getPricingInfo(int index); + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + int getPricingInfoCount(); + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + java.util.List + getPricingInfoOrBuilderList(); + /** + * + * + *
+   * A timeline of pricing info for this SKU in chronological order.
+   * 
+ * + * repeated .google.cloud.billing.v1.PricingInfo pricing_info = 6; + */ + com.google.cloud.billing.v1.PricingInfoOrBuilder getPricingInfoOrBuilder(int index); + + /** + * + * + *
+   * Identifies the service provider.
+   * This is 'Google' for first party services in Google Cloud Platform.
+   * 
+ * + * string service_provider_name = 7; + * + * @return The serviceProviderName. + */ + java.lang.String getServiceProviderName(); + /** + * + * + *
+   * Identifies the service provider.
+   * This is 'Google' for first party services in Google Cloud Platform.
+   * 
+ * + * string service_provider_name = 7; + * + * @return The bytes for serviceProviderName. + */ + com.google.protobuf.ByteString getServiceProviderNameBytes(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateBillingAccountRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateBillingAccountRequest.java new file mode 100644 index 00000000..087470b3 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateBillingAccountRequest.java @@ -0,0 +1,1228 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `UpdateBillingAccount`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.UpdateBillingAccountRequest} + */ +public final class UpdateBillingAccountRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.UpdateBillingAccountRequest) + UpdateBillingAccountRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateBillingAccountRequest.newBuilder() to construct. + private UpdateBillingAccountRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateBillingAccountRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateBillingAccountRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateBillingAccountRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + com.google.cloud.billing.v1.BillingAccount.Builder subBuilder = null; + if (account_ != null) { + subBuilder = account_.toBuilder(); + } + account_ = + input.readMessage( + com.google.cloud.billing.v1.BillingAccount.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(account_); + account_ = subBuilder.buildPartial(); + } + + break; + } + case 26: + { + com.google.protobuf.FieldMask.Builder subBuilder = null; + if (updateMask_ != null) { + subBuilder = updateMask_.toBuilder(); + } + updateMask_ = + input.readMessage(com.google.protobuf.FieldMask.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateMask_); + updateMask_ = subBuilder.buildPartial(); + } + + break; + } + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.UpdateBillingAccountRequest.class, + com.google.cloud.billing.v1.UpdateBillingAccountRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The name of the billing account resource to be updated.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The name of the billing account resource to be updated.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof 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 ACCOUNT_FIELD_NUMBER = 2; + private com.google.cloud.billing.v1.BillingAccount account_; + /** + * + * + *
+   * Required. The billing account resource to replace the resource on the server.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the account field is set. + */ + public boolean hasAccount() { + return account_ != null; + } + /** + * + * + *
+   * Required. The billing account resource to replace the resource on the server.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The account. + */ + public com.google.cloud.billing.v1.BillingAccount getAccount() { + return account_ == null + ? com.google.cloud.billing.v1.BillingAccount.getDefaultInstance() + : account_; + } + /** + * + * + *
+   * Required. The billing account resource to replace the resource on the server.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.v1.BillingAccountOrBuilder getAccountOrBuilder() { + return getAccount(); + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 3; + private com.google.protobuf.FieldMask updateMask_; + /** + * + * + *
+   * The update mask applied to the resource.
+   * Only "display_name" is currently supported.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMask_ != null; + } + /** + * + * + *
+   * The update mask applied to the resource.
+   * Only "display_name" is currently supported.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + /** + * + * + *
+   * The update mask applied to the resource.
+   * Only "display_name" is currently supported.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + 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 (!getNameBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (account_ != null) { + output.writeMessage(2, getAccount()); + } + if (updateMask_ != null) { + output.writeMessage(3, getUpdateMask()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!getNameBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (account_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getAccount()); + } + if (updateMask_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getUpdateMask()); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.billing.v1.UpdateBillingAccountRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.UpdateBillingAccountRequest other = + (com.google.cloud.billing.v1.UpdateBillingAccountRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (hasAccount() != other.hasAccount()) return false; + if (hasAccount()) { + if (!getAccount().equals(other.getAccount())) 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(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + if (hasAccount()) { + hash = (37 * hash) + ACCOUNT_FIELD_NUMBER; + hash = (53 * hash) + getAccount().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.v1.UpdateBillingAccountRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.UpdateBillingAccountRequest 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.v1.UpdateBillingAccountRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.UpdateBillingAccountRequest 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.v1.UpdateBillingAccountRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.UpdateBillingAccountRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.UpdateBillingAccountRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.UpdateBillingAccountRequest 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.v1.UpdateBillingAccountRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.UpdateBillingAccountRequest 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.v1.UpdateBillingAccountRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.UpdateBillingAccountRequest 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.v1.UpdateBillingAccountRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `UpdateBillingAccount`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.UpdateBillingAccountRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.UpdateBillingAccountRequest) + com.google.cloud.billing.v1.UpdateBillingAccountRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.UpdateBillingAccountRequest.class, + com.google.cloud.billing.v1.UpdateBillingAccountRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.UpdateBillingAccountRequest.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_ = ""; + + if (accountBuilder_ == null) { + account_ = null; + } else { + account_ = null; + accountBuilder_ = 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.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateBillingAccountRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.UpdateBillingAccountRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.UpdateBillingAccountRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.UpdateBillingAccountRequest build() { + com.google.cloud.billing.v1.UpdateBillingAccountRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.UpdateBillingAccountRequest buildPartial() { + com.google.cloud.billing.v1.UpdateBillingAccountRequest result = + new com.google.cloud.billing.v1.UpdateBillingAccountRequest(this); + result.name_ = name_; + if (accountBuilder_ == null) { + result.account_ = account_; + } else { + result.account_ = accountBuilder_.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.v1.UpdateBillingAccountRequest) { + return mergeFrom((com.google.cloud.billing.v1.UpdateBillingAccountRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.UpdateBillingAccountRequest other) { + if (other == com.google.cloud.billing.v1.UpdateBillingAccountRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasAccount()) { + mergeAccount(other.getAccount()); + } + 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.v1.UpdateBillingAccountRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.UpdateBillingAccountRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The name of the billing account resource to be updated.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The name of the billing account resource to be updated.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The name of the billing account resource to be updated.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the billing account resource to be updated.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The name of the billing account resource to be updated.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.cloud.billing.v1.BillingAccount account_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder> + accountBuilder_; + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the account field is set. + */ + public boolean hasAccount() { + return accountBuilder_ != null || account_ != null; + } + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The account. + */ + public com.google.cloud.billing.v1.BillingAccount getAccount() { + if (accountBuilder_ == null) { + return account_ == null + ? com.google.cloud.billing.v1.BillingAccount.getDefaultInstance() + : account_; + } else { + return accountBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAccount(com.google.cloud.billing.v1.BillingAccount value) { + if (accountBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + account_ = value; + onChanged(); + } else { + accountBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setAccount(com.google.cloud.billing.v1.BillingAccount.Builder builderForValue) { + if (accountBuilder_ == null) { + account_ = builderForValue.build(); + onChanged(); + } else { + accountBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeAccount(com.google.cloud.billing.v1.BillingAccount value) { + if (accountBuilder_ == null) { + if (account_ != null) { + account_ = + com.google.cloud.billing.v1.BillingAccount.newBuilder(account_) + .mergeFrom(value) + .buildPartial(); + } else { + account_ = value; + } + onChanged(); + } else { + accountBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearAccount() { + if (accountBuilder_ == null) { + account_ = null; + onChanged(); + } else { + account_ = null; + accountBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.v1.BillingAccount.Builder getAccountBuilder() { + + onChanged(); + return getAccountFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.billing.v1.BillingAccountOrBuilder getAccountOrBuilder() { + if (accountBuilder_ != null) { + return accountBuilder_.getMessageOrBuilder(); + } else { + return account_ == null + ? com.google.cloud.billing.v1.BillingAccount.getDefaultInstance() + : account_; + } + } + /** + * + * + *
+     * Required. The billing account resource to replace the resource on the server.
+     * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder> + getAccountFieldBuilder() { + if (accountBuilder_ == null) { + accountBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.BillingAccount, + com.google.cloud.billing.v1.BillingAccount.Builder, + com.google.cloud.billing.v1.BillingAccountOrBuilder>( + getAccount(), getParentForChildren(), isClean()); + account_ = null; + } + return accountBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return updateMaskBuilder_ != null || updateMask_ != null; + } + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + onChanged(); + } else { + updateMaskBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + onChanged(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (updateMask_ != null) { + updateMask_ = + com.google.protobuf.FieldMask.newBuilder(updateMask_).mergeFrom(value).buildPartial(); + } else { + updateMask_ = value; + } + onChanged(); + } else { + updateMaskBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public Builder clearUpdateMask() { + if (updateMaskBuilder_ == null) { + updateMask_ = null; + onChanged(); + } else { + updateMask_ = null; + updateMaskBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } + } + /** + * + * + *
+     * The update mask applied to the resource.
+     * Only "display_name" is currently supported.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + 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.v1.UpdateBillingAccountRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.UpdateBillingAccountRequest) + private static final com.google.cloud.billing.v1.UpdateBillingAccountRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.UpdateBillingAccountRequest(); + } + + public static com.google.cloud.billing.v1.UpdateBillingAccountRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateBillingAccountRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateBillingAccountRequest(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.v1.UpdateBillingAccountRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateBillingAccountRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateBillingAccountRequestOrBuilder.java new file mode 100644 index 00000000..0300e04a --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateBillingAccountRequestOrBuilder.java @@ -0,0 +1,133 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface UpdateBillingAccountRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.UpdateBillingAccountRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The name of the billing account resource to be updated.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The name of the billing account resource to be updated.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Required. The billing account resource to replace the resource on the server.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the account field is set. + */ + boolean hasAccount(); + /** + * + * + *
+   * Required. The billing account resource to replace the resource on the server.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The account. + */ + com.google.cloud.billing.v1.BillingAccount getAccount(); + /** + * + * + *
+   * Required. The billing account resource to replace the resource on the server.
+   * 
+ * + * + * .google.cloud.billing.v1.BillingAccount account = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.billing.v1.BillingAccountOrBuilder getAccountOrBuilder(); + + /** + * + * + *
+   * The update mask applied to the resource.
+   * Only "display_name" is currently supported.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * The update mask applied to the resource.
+   * Only "display_name" is currently supported.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * The update mask applied to the resource.
+   * Only "display_name" is currently supported.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 3; + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateProjectBillingInfoRequest.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateProjectBillingInfoRequest.java new file mode 100644 index 00000000..6fccf776 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateProjectBillingInfoRequest.java @@ -0,0 +1,931 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +/** + * + * + *
+ * Request message for `UpdateProjectBillingInfo`.
+ * 
+ * + * Protobuf type {@code google.cloud.billing.v1.UpdateProjectBillingInfoRequest} + */ +public final class UpdateProjectBillingInfoRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.billing.v1.UpdateProjectBillingInfoRequest) + UpdateProjectBillingInfoRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateProjectBillingInfoRequest.newBuilder() to construct. + private UpdateProjectBillingInfoRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateProjectBillingInfoRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateProjectBillingInfoRequest(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private UpdateProjectBillingInfoRequest( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + + name_ = s; + break; + } + case 18: + { + com.google.cloud.billing.v1.ProjectBillingInfo.Builder subBuilder = null; + if (projectBillingInfo_ != null) { + subBuilder = projectBillingInfo_.toBuilder(); + } + projectBillingInfo_ = + input.readMessage( + com.google.cloud.billing.v1.ProjectBillingInfo.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(projectBillingInfo_); + projectBillingInfo_ = 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.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest.class, + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + private volatile java.lang.Object name_; + /** + * + * + *
+   * Required. The resource name of the project associated with the billing information
+   * that you want to update. For example, `projects/tokyo-rain-123`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The resource name of the project associated with the billing information
+   * that you want to update. For example, `projects/tokyo-rain-123`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof 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 PROJECT_BILLING_INFO_FIELD_NUMBER = 2; + private com.google.cloud.billing.v1.ProjectBillingInfo projectBillingInfo_; + /** + * + * + *
+   * The new billing information for the project. Read-only fields are ignored;
+   * thus, you can leave empty all fields except `billing_account_name`.
+   * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + * + * @return Whether the projectBillingInfo field is set. + */ + public boolean hasProjectBillingInfo() { + return projectBillingInfo_ != null; + } + /** + * + * + *
+   * The new billing information for the project. Read-only fields are ignored;
+   * thus, you can leave empty all fields except `billing_account_name`.
+   * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + * + * @return The projectBillingInfo. + */ + public com.google.cloud.billing.v1.ProjectBillingInfo getProjectBillingInfo() { + return projectBillingInfo_ == null + ? com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance() + : projectBillingInfo_; + } + /** + * + * + *
+   * The new billing information for the project. Read-only fields are ignored;
+   * thus, you can leave empty all fields except `billing_account_name`.
+   * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + public com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder getProjectBillingInfoOrBuilder() { + return getProjectBillingInfo(); + } + + 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 (projectBillingInfo_ != null) { + output.writeMessage(2, getProjectBillingInfo()); + } + 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 (projectBillingInfo_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getProjectBillingInfo()); + } + 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.v1.UpdateProjectBillingInfoRequest)) { + return super.equals(obj); + } + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest other = + (com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (hasProjectBillingInfo() != other.hasProjectBillingInfo()) return false; + if (hasProjectBillingInfo()) { + if (!getProjectBillingInfo().equals(other.getProjectBillingInfo())) 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(); + if (hasProjectBillingInfo()) { + hash = (37 * hash) + PROJECT_BILLING_INFO_FIELD_NUMBER; + hash = (53 * hash) + getProjectBillingInfo().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest 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.v1.UpdateProjectBillingInfoRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest 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.v1.UpdateProjectBillingInfoRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest 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.v1.UpdateProjectBillingInfoRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest 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.v1.UpdateProjectBillingInfoRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest 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.v1.UpdateProjectBillingInfoRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Request message for `UpdateProjectBillingInfo`.
+   * 
+ * + * Protobuf type {@code google.cloud.billing.v1.UpdateProjectBillingInfoRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.billing.v1.UpdateProjectBillingInfoRequest) + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest.class, + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest.Builder.class); + } + + // Construct using com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest.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_ = ""; + + if (projectBillingInfoBuilder_ == null) { + projectBillingInfo_ = null; + } else { + projectBillingInfo_ = null; + projectBillingInfoBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.billing.v1.CloudBillingProto + .internal_static_google_cloud_billing_v1_UpdateProjectBillingInfoRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest getDefaultInstanceForType() { + return com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest build() { + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest buildPartial() { + com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest result = + new com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest(this); + result.name_ = name_; + if (projectBillingInfoBuilder_ == null) { + result.projectBillingInfo_ = projectBillingInfo_; + } else { + result.projectBillingInfo_ = projectBillingInfoBuilder_.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.v1.UpdateProjectBillingInfoRequest) { + return mergeFrom((com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest other) { + if (other == com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + onChanged(); + } + if (other.hasProjectBillingInfo()) { + mergeProjectBillingInfo(other.getProjectBillingInfo()); + } + 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.v1.UpdateProjectBillingInfoRequest parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. The resource name of the project associated with the billing information
+     * that you want to update. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the project associated with the billing information
+     * that you want to update. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The resource name of the project associated with the billing information
+     * that you want to update. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + name_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the project associated with the billing information
+     * that you want to update. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + + name_ = getDefaultInstance().getName(); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The resource name of the project associated with the billing information
+     * that you want to update. For example, `projects/tokyo-rain-123`.
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + name_ = value; + onChanged(); + return this; + } + + private com.google.cloud.billing.v1.ProjectBillingInfo projectBillingInfo_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.ProjectBillingInfo, + com.google.cloud.billing.v1.ProjectBillingInfo.Builder, + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder> + projectBillingInfoBuilder_; + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + * + * @return Whether the projectBillingInfo field is set. + */ + public boolean hasProjectBillingInfo() { + return projectBillingInfoBuilder_ != null || projectBillingInfo_ != null; + } + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + * + * @return The projectBillingInfo. + */ + public com.google.cloud.billing.v1.ProjectBillingInfo getProjectBillingInfo() { + if (projectBillingInfoBuilder_ == null) { + return projectBillingInfo_ == null + ? com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance() + : projectBillingInfo_; + } else { + return projectBillingInfoBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + public Builder setProjectBillingInfo(com.google.cloud.billing.v1.ProjectBillingInfo value) { + if (projectBillingInfoBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + projectBillingInfo_ = value; + onChanged(); + } else { + projectBillingInfoBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + public Builder setProjectBillingInfo( + com.google.cloud.billing.v1.ProjectBillingInfo.Builder builderForValue) { + if (projectBillingInfoBuilder_ == null) { + projectBillingInfo_ = builderForValue.build(); + onChanged(); + } else { + projectBillingInfoBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + public Builder mergeProjectBillingInfo(com.google.cloud.billing.v1.ProjectBillingInfo value) { + if (projectBillingInfoBuilder_ == null) { + if (projectBillingInfo_ != null) { + projectBillingInfo_ = + com.google.cloud.billing.v1.ProjectBillingInfo.newBuilder(projectBillingInfo_) + .mergeFrom(value) + .buildPartial(); + } else { + projectBillingInfo_ = value; + } + onChanged(); + } else { + projectBillingInfoBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + public Builder clearProjectBillingInfo() { + if (projectBillingInfoBuilder_ == null) { + projectBillingInfo_ = null; + onChanged(); + } else { + projectBillingInfo_ = null; + projectBillingInfoBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + public com.google.cloud.billing.v1.ProjectBillingInfo.Builder getProjectBillingInfoBuilder() { + + onChanged(); + return getProjectBillingInfoFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + public com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder + getProjectBillingInfoOrBuilder() { + if (projectBillingInfoBuilder_ != null) { + return projectBillingInfoBuilder_.getMessageOrBuilder(); + } else { + return projectBillingInfo_ == null + ? com.google.cloud.billing.v1.ProjectBillingInfo.getDefaultInstance() + : projectBillingInfo_; + } + } + /** + * + * + *
+     * The new billing information for the project. Read-only fields are ignored;
+     * thus, you can leave empty all fields except `billing_account_name`.
+     * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.ProjectBillingInfo, + com.google.cloud.billing.v1.ProjectBillingInfo.Builder, + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder> + getProjectBillingInfoFieldBuilder() { + if (projectBillingInfoBuilder_ == null) { + projectBillingInfoBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.billing.v1.ProjectBillingInfo, + com.google.cloud.billing.v1.ProjectBillingInfo.Builder, + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder>( + getProjectBillingInfo(), getParentForChildren(), isClean()); + projectBillingInfo_ = null; + } + return projectBillingInfoBuilder_; + } + + @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.v1.UpdateProjectBillingInfoRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.billing.v1.UpdateProjectBillingInfoRequest) + private static final com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest(); + } + + public static com.google.cloud.billing.v1.UpdateProjectBillingInfoRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateProjectBillingInfoRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new UpdateProjectBillingInfoRequest(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.v1.UpdateProjectBillingInfoRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateProjectBillingInfoRequestOrBuilder.java b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateProjectBillingInfoRequestOrBuilder.java new file mode 100644 index 00000000..bda32cfd --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateProjectBillingInfoRequestOrBuilder.java @@ -0,0 +1,90 @@ +/* + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/billing/v1/cloud_billing.proto + +package com.google.cloud.billing.v1; + +public interface UpdateProjectBillingInfoRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.billing.v1.UpdateProjectBillingInfoRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The resource name of the project associated with the billing information
+   * that you want to update. For example, `projects/tokyo-rain-123`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. The resource name of the project associated with the billing information
+   * that you want to update. For example, `projects/tokyo-rain-123`.
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The new billing information for the project. Read-only fields are ignored;
+   * thus, you can leave empty all fields except `billing_account_name`.
+   * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + * + * @return Whether the projectBillingInfo field is set. + */ + boolean hasProjectBillingInfo(); + /** + * + * + *
+   * The new billing information for the project. Read-only fields are ignored;
+   * thus, you can leave empty all fields except `billing_account_name`.
+   * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + * + * @return The projectBillingInfo. + */ + com.google.cloud.billing.v1.ProjectBillingInfo getProjectBillingInfo(); + /** + * + * + *
+   * The new billing information for the project. Read-only fields are ignored;
+   * thus, you can leave empty all fields except `billing_account_name`.
+   * 
+ * + * .google.cloud.billing.v1.ProjectBillingInfo project_billing_info = 2; + */ + com.google.cloud.billing.v1.ProjectBillingInfoOrBuilder getProjectBillingInfoOrBuilder(); +} diff --git a/proto-google-cloud-billing-v1/src/main/proto/google/cloud/billing/v1/cloud_billing.proto b/proto-google-cloud-billing-v1/src/main/proto/google/cloud/billing/v1/cloud_billing.proto new file mode 100644 index 00000000..f0b19d14 --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/proto/google/cloud/billing/v1/cloud_billing.proto @@ -0,0 +1,360 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.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.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/v1;billing"; +option java_multiple_files = true; +option java_outer_classname = "CloudBillingProto"; +option java_package = "com.google.cloud.billing.v1"; + +// Retrieves GCP Console billing accounts and associates them with projects. +service CloudBilling { + option (google.api.default_host) = "cloudbilling.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Gets information about a billing account. The current authenticated user + // must be a [viewer of the billing + // account](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc GetBillingAccount(GetBillingAccountRequest) returns (BillingAccount) { + option (google.api.http) = { + get: "/v1/{name=billingAccounts/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists the billing accounts that the current authenticated user has + // permission to + // [view](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc ListBillingAccounts(ListBillingAccountsRequest) returns (ListBillingAccountsResponse) { + option (google.api.http) = { + get: "/v1/billingAccounts" + }; + option (google.api.method_signature) = ""; + } + + // Updates a billing account's fields. + // Currently the only field that can be edited is `display_name`. + // The current authenticated user must have the `billing.accounts.update` + // IAM permission, which is typically given to the + // [administrator](https://cloud.google.com/billing/docs/how-to/billing-access) + // of the billing account. + rpc UpdateBillingAccount(UpdateBillingAccountRequest) returns (BillingAccount) { + option (google.api.http) = { + patch: "/v1/{name=billingAccounts/*}" + body: "account" + }; + option (google.api.method_signature) = "name,account"; + } + + // Creates a billing account. + // This method can only be used to create + // [billing subaccounts](https://cloud.google.com/billing/docs/concepts) + // by GCP resellers. + // When creating a subaccount, the current authenticated user must have the + // `billing.accounts.update` IAM permission on the master account, which is + // typically given to billing account + // [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + // This method will return an error if the master account has not been + // provisioned as a reseller account. + rpc CreateBillingAccount(CreateBillingAccountRequest) returns (BillingAccount) { + option (google.api.http) = { + post: "/v1/billingAccounts" + body: "billing_account" + }; + option (google.api.method_signature) = "billing_account"; + } + + // Lists the projects associated with a billing account. The current + // authenticated user must have the `billing.resourceAssociations.list` IAM + // permission, which is often given to billing account + // [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc ListProjectBillingInfo(ListProjectBillingInfoRequest) returns (ListProjectBillingInfoResponse) { + option (google.api.http) = { + get: "/v1/{name=billingAccounts/*}/projects" + }; + option (google.api.method_signature) = "name"; + } + + // Gets the billing information for a project. The current authenticated user + // must have [permission to view the + // project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + // ). + rpc GetProjectBillingInfo(GetProjectBillingInfoRequest) returns (ProjectBillingInfo) { + option (google.api.http) = { + get: "/v1/{name=projects/*}/billingInfo" + }; + option (google.api.method_signature) = "name"; + } + + // Sets or updates the billing account associated with a project. You specify + // the new billing account by setting the `billing_account_name` in the + // `ProjectBillingInfo` resource to the resource name of a billing account. + // Associating a project with an open billing account enables billing on the + // project and allows charges for resource usage. If the project already had a + // billing account, this method changes the billing account used for resource + // usage charges. + // + // *Note:* Incurred charges that have not yet been reported in the transaction + // history of the GCP Console might be billed to the new billing + // account, even if the charge occurred before the new billing account was + // assigned to the project. + // + // The current authenticated user must have ownership privileges for both the + // [project](https://cloud.google.com/docs/permissions-overview#h.bgs0oxofvnoo + // ) and the [billing + // account](https://cloud.google.com/billing/docs/how-to/billing-access). + // + // You can disable billing on the project by setting the + // `billing_account_name` field to empty. This action disassociates the + // current billing account from the project. Any billable activity of your + // in-use services will stop, and your application could stop functioning as + // expected. Any unbilled charges to date will be billed to the previously + // associated account. The current authenticated user must be either an owner + // of the project or an owner of the billing account for the project. + // + // Note that associating a project with a *closed* billing account will have + // much the same effect as disabling billing on the project: any paid + // resources used by the project will be shut down. Thus, unless you wish to + // disable billing, you should always call this method with the name of an + // *open* billing account. + rpc UpdateProjectBillingInfo(UpdateProjectBillingInfoRequest) returns (ProjectBillingInfo) { + option (google.api.http) = { + put: "/v1/{name=projects/*}/billingInfo" + body: "project_billing_info" + }; + option (google.api.method_signature) = "name,project_billing_info"; + } + + // Gets the access control policy for a billing account. + // The caller must have the `billing.accounts.getIamPolicy` permission on the + // account, which is often given to billing account + // [viewers](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + get: "/v1/{resource=billingAccounts/*}:getIamPolicy" + }; + option (google.api.method_signature) = "resource"; + } + + // Sets the access control policy for a billing account. Replaces any existing + // policy. + // The caller must have the `billing.accounts.setIamPolicy` permission on the + // account, which is often given to billing account + // [administrators](https://cloud.google.com/billing/docs/how-to/billing-access). + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=billingAccounts/*}:setIamPolicy" + body: "*" + }; + option (google.api.method_signature) = "resource,policy"; + } + + // Tests the access control policy for a billing account. This method takes + // the resource and a set of permissions as input and returns the subset of + // the input permissions that the caller is allowed for that resource. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=billingAccounts/*}:testIamPermissions" + body: "*" + }; + option (google.api.method_signature) = "resource,permissions"; + } +} + +// A billing account in [GCP Console](https://console.cloud.google.com/). +// You can assign a billing account to one or more projects. +message BillingAccount { + // The resource name of the billing account. The resource name has the form + // `billingAccounts/{billing_account_id}`. For example, + // `billingAccounts/012345-567890-ABCDEF` would be the resource name for + // billing account `012345-567890-ABCDEF`. + string name = 1 [(google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + }]; + + // Output only. True if the billing account is open, and will therefore be charged for any + // usage on associated projects. False if the billing account is closed, and + // therefore projects associated with it will be unable to use paid services. + bool open = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The display name given to the billing account, such as `My Billing + // Account`. This name is displayed in the GCP Console. + string display_name = 3; + + // If this account is a + // [subaccount](https://cloud.google.com/billing/docs/concepts), then this + // will be the resource name of the master billing account that it is being + // resold through. + // Otherwise this will be empty. + string master_billing_account = 4; +} + +// Encapsulation of billing information for a GCP Console project. A project +// has at most one associated billing account at a time (but a billing account +// can be assigned to multiple projects). +message ProjectBillingInfo { + // The resource name for the `ProjectBillingInfo`; has the form + // `projects/{project_id}/billingInfo`. For example, the resource name for the + // billing information for project `tokyo-rain-123` would be + // `projects/tokyo-rain-123/billingInfo`. This field is read-only. + string name = 1; + + // The ID of the project that this `ProjectBillingInfo` represents, such as + // `tokyo-rain-123`. This is a convenience field so that you don't need to + // parse the `name` field to obtain a project ID. This field is read-only. + string project_id = 2; + + // The resource name of the billing account associated with the project, if + // any. For example, `billingAccounts/012345-567890-ABCDEF`. + string billing_account_name = 3; + + // True if the project is associated with an open billing account, to which + // usage on the project is charged. False if the project is associated with a + // closed billing account, or no billing account at all, and therefore cannot + // use paid services. This field is read-only. + bool billing_enabled = 4; +} + +// Request message for `GetBillingAccount`. +message GetBillingAccountRequest { + // Required. The resource name of the billing account to retrieve. For example, + // `billingAccounts/012345-567890-ABCDEF`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + } + ]; +} + +// Request message for `ListBillingAccounts`. +message ListBillingAccountsRequest { + // Requested page size. The maximum page size is 100; this is also the + // default. + int32 page_size = 1; + + // A token identifying a page of results to return. This should be a + // `next_page_token` value returned from a previous `ListBillingAccounts` + // call. If unspecified, the first page of results is returned. + string page_token = 2; + + // Options for how to filter the returned billing accounts. + // Currently this only supports filtering for + // [subaccounts](https://cloud.google.com/billing/docs/concepts) under a + // single provided reseller billing account. + // (e.g. "master_billing_account=billingAccounts/012345-678901-ABCDEF"). + // Boolean algebra and other fields are not currently supported. + string filter = 3; +} + +// Response message for `ListBillingAccounts`. +message ListBillingAccountsResponse { + // A list of billing accounts. + repeated BillingAccount billing_accounts = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListBillingAccounts` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} + +// Request message for `CreateBillingAccount`. +message CreateBillingAccountRequest { + // Required. The billing account resource to create. + // Currently CreateBillingAccount only supports subaccount creation, so + // any created billing accounts must be under a provided master billing + // account. + BillingAccount billing_account = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `UpdateBillingAccount`. +message UpdateBillingAccountRequest { + // Required. The name of the billing account resource to be updated. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + } + ]; + + // Required. The billing account resource to replace the resource on the server. + BillingAccount account = 2 [(google.api.field_behavior) = REQUIRED]; + + // The update mask applied to the resource. + // Only "display_name" is currently supported. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for `ListProjectBillingInfo`. +message ListProjectBillingInfoRequest { + // Required. The resource name of the billing account associated with the projects that + // you want to list. For example, `billingAccounts/012345-567890-ABCDEF`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/BillingAccount" + } + ]; + + // Requested page size. The maximum page size is 100; this is also the + // default. + int32 page_size = 2; + + // A token identifying a page of results to be returned. This should be a + // `next_page_token` value returned from a previous `ListProjectBillingInfo` + // call. If unspecified, the first page of results is returned. + string page_token = 3; +} + +// Request message for `ListProjectBillingInfoResponse`. +message ListProjectBillingInfoResponse { + // A list of `ProjectBillingInfo` resources representing the projects + // associated with the billing account. + repeated ProjectBillingInfo project_billing_info = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListProjectBillingInfo` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} + +// Request message for `GetProjectBillingInfo`. +message GetProjectBillingInfoRequest { + // Required. The resource name of the project for which billing information is + // retrieved. For example, `projects/tokyo-rain-123`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for `UpdateProjectBillingInfo`. +message UpdateProjectBillingInfoRequest { + // Required. The resource name of the project associated with the billing information + // that you want to update. For example, `projects/tokyo-rain-123`. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The new billing information for the project. Read-only fields are ignored; + // thus, you can leave empty all fields except `billing_account_name`. + ProjectBillingInfo project_billing_info = 2; +} diff --git a/proto-google-cloud-billing-v1/src/main/proto/google/cloud/billing/v1/cloud_catalog.proto b/proto-google-cloud-billing-v1/src/main/proto/google/cloud/billing/v1/cloud_catalog.proto new file mode 100644 index 00000000..7bc2f14e --- /dev/null +++ b/proto-google-cloud-billing-v1/src/main/proto/google/cloud/billing/v1/cloud_catalog.proto @@ -0,0 +1,331 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.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.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/timestamp.proto"; +import "google/type/money.proto"; + +option csharp_namespace = "Google.Cloud.Billing.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/billing/v1;billing"; +option java_multiple_files = true; +option java_outer_classname = "CloudCatalogProto"; +option java_package = "com.google.cloud.billing.v1"; +option objc_class_prefix = "CLDCTLG"; + +// A catalog of Google Cloud Platform services and SKUs. +// Provides pricing information and metadata on Google Cloud Platform services +// and SKUs. +service CloudCatalog { + option (google.api.default_host) = "cloudbilling.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists all public cloud services. + rpc ListServices(ListServicesRequest) returns (ListServicesResponse) { + option (google.api.http) = { + get: "/v1/services" + }; + option (google.api.method_signature) = ""; + } + + // Lists all publicly available SKUs for a given cloud service. + rpc ListSkus(ListSkusRequest) returns (ListSkusResponse) { + option (google.api.http) = { + get: "/v1/{parent=services/*}/skus" + }; + option (google.api.method_signature) = "parent"; + } +} + +// Encapsulates a single service in Google Cloud Platform. +message Service { + option (google.api.resource) = { + type: "cloudbilling.googleapis.com/Service" + pattern: "services/{service}" + }; + + // The resource name for the service. + // Example: "services/DA34-426B-A397" + string name = 1; + + // The identifier for the service. + // Example: "DA34-426B-A397" + string service_id = 2; + + // A human readable display name for this service. + string display_name = 3; + + // The business under which the service is offered. + // Ex. "businessEntities/GCP", "businessEntities/Maps" + string business_entity_name = 4; +} + +// Encapsulates a single SKU in Google Cloud Platform +message Sku { + option (google.api.resource) = { + type: "cloudbilling.googleapis.com/Sku" + pattern: "services/{service}/skus/{sku}" + }; + + // The resource name for the SKU. + // Example: "services/DA34-426B-A397/skus/AA95-CD31-42FE" + string name = 1; + + // The identifier for the SKU. + // Example: "AA95-CD31-42FE" + string sku_id = 2; + + // A human readable description of the SKU, has a maximum length of 256 + // characters. + string description = 3; + + // The category hierarchy of this SKU, purely for organizational purpose. + Category category = 4; + + // List of service regions this SKU is offered at. + // Example: "asia-east1" + // Service regions can be found at https://cloud.google.com/about/locations/ + repeated string service_regions = 5; + + // A timeline of pricing info for this SKU in chronological order. + repeated PricingInfo pricing_info = 6; + + // Identifies the service provider. + // This is 'Google' for first party services in Google Cloud Platform. + string service_provider_name = 7; +} + +// Represents the category hierarchy of a SKU. +message Category { + // The display name of the service this SKU belongs to. + string service_display_name = 1; + + // The type of product the SKU refers to. + // Example: "Compute", "Storage", "Network", "ApplicationServices" etc. + string resource_family = 2; + + // A group classification for related SKUs. + // Example: "RAM", "GPU", "Prediction", "Ops", "GoogleEgress" etc. + string resource_group = 3; + + // Represents how the SKU is consumed. + // Example: "OnDemand", "Preemptible", "Commit1Mo", "Commit1Yr" etc. + string usage_type = 4; +} + +// Represents the pricing information for a SKU at a single point of time. +message PricingInfo { + // The timestamp from which this pricing was effective within the requested + // time range. This is guaranteed to be greater than or equal to the + // start_time field in the request and less than the end_time field in the + // request. If a time range was not specified in the request this field will + // be equivalent to a time within the last 12 hours, indicating the latest + // pricing info. + google.protobuf.Timestamp effective_time = 1; + + // An optional human readable summary of the pricing information, has a + // maximum length of 256 characters. + string summary = 2; + + // Expresses the pricing formula. See `PricingExpression` for an example. + PricingExpression pricing_expression = 3; + + // Aggregation Info. This can be left unspecified if the pricing expression + // doesn't require aggregation. + AggregationInfo aggregation_info = 4; + + // Conversion rate used for currency conversion, from USD to the currency + // specified in the request. This includes any surcharge collected for billing + // in non USD currency. If a currency is not specified in the request this + // defaults to 1.0. + // Example: USD * currency_conversion_rate = JPY + double currency_conversion_rate = 5; +} + +// Expresses a mathematical pricing formula. For Example:- +// +// `usage_unit: GBy` +// `tiered_rates:` +// `[start_usage_amount: 20, unit_price: $10]` +// `[start_usage_amount: 100, unit_price: $5]` +// +// The above expresses a pricing formula where the first 20GB is free, the +// next 80GB is priced at $10 per GB followed by $5 per GB for additional +// usage. +message PricingExpression { + // The price rate indicating starting usage and its corresponding price. + message TierRate { + // Usage is priced at this rate only after this amount. + // Example: start_usage_amount of 10 indicates that the usage will be priced + // at the unit_price after the first 10 usage_units. + double start_usage_amount = 1; + + // The price per unit of usage. + // Example: unit_price of amount $10 indicates that each unit will cost $10. + google.type.Money unit_price = 2; + } + + // The short hand for unit of usage this pricing is specified in. + // Example: usage_unit of "GiBy" means that usage is specified in "Gibi Byte". + string usage_unit = 1; + + // The unit of usage in human readable form. + // Example: "gibi byte". + string usage_unit_description = 4; + + // The base unit for the SKU which is the unit used in usage exports. + // Example: "By" + string base_unit = 5; + + // The base unit in human readable form. + // Example: "byte". + string base_unit_description = 6; + + // Conversion factor for converting from price per usage_unit to price per + // base_unit, and start_usage_amount to start_usage_amount in base_unit. + // unit_price / base_unit_conversion_factor = price per base_unit. + // start_usage_amount * base_unit_conversion_factor = start_usage_amount in + // base_unit. + double base_unit_conversion_factor = 7; + + // The recommended quantity of units for displaying pricing info. When + // displaying pricing info it is recommended to display: + // (unit_price * display_quantity) per display_quantity usage_unit. + // This field does not affect the pricing formula and is for display purposes + // only. + // Example: If the unit_price is "0.0001 USD", the usage_unit is "GB" and + // the display_quantity is "1000" then the recommended way of displaying the + // pricing info is "0.10 USD per 1000 GB" + double display_quantity = 2; + + // The list of tiered rates for this pricing. The total cost is computed by + // applying each of the tiered rates on usage. This repeated list is sorted + // by ascending order of start_usage_amount. + repeated TierRate tiered_rates = 3; +} + +// Represents the aggregation level and interval for pricing of a single SKU. +message AggregationInfo { + // The level at which usage is aggregated to compute cost. + // Example: "ACCOUNT" aggregation level indicates that usage for tiered + // pricing is aggregated across all projects in a single account. + enum AggregationLevel { + AGGREGATION_LEVEL_UNSPECIFIED = 0; + + ACCOUNT = 1; + + PROJECT = 2; + } + + // The interval at which usage is aggregated to compute cost. + // Example: "MONTHLY" aggregation interval indicates that usage for tiered + // pricing is aggregated every month. + enum AggregationInterval { + AGGREGATION_INTERVAL_UNSPECIFIED = 0; + + DAILY = 1; + + MONTHLY = 2; + } + + AggregationLevel aggregation_level = 1; + + AggregationInterval aggregation_interval = 2; + + // The number of intervals to aggregate over. + // Example: If aggregation_level is "DAILY" and aggregation_count is 14, + // aggregation will be over 14 days. + int32 aggregation_count = 3; +} + +// Request message for `ListServices`. +message ListServicesRequest { + // Requested page size. Defaults to 5000. + int32 page_size = 1; + + // A token identifying a page of results to return. This should be a + // `next_page_token` value returned from a previous `ListServices` + // call. If unspecified, the first page of results is returned. + string page_token = 2; +} + +// Response message for `ListServices`. +message ListServicesResponse { + // A list of services. + repeated Service services = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListServices` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} + +// Request message for `ListSkus`. +message ListSkusRequest { + // Required. The name of the service. + // Example: "services/DA34-426B-A397" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudbilling.googleapis.com/Service" + } + ]; + + // Optional inclusive start time of the time range for which the pricing + // versions will be returned. Timestamps in the future are not allowed. + // The time range has to be within a single calendar month in + // America/Los_Angeles timezone. Time range as a whole is optional. If not + // specified, the latest pricing will be returned (up to 12 hours old at + // most). + google.protobuf.Timestamp start_time = 2; + + // Optional exclusive end time of the time range for which the pricing + // versions will be returned. Timestamps in the future are not allowed. + // The time range has to be within a single calendar month in + // America/Los_Angeles timezone. Time range as a whole is optional. If not + // specified, the latest pricing will be returned (up to 12 hours old at + // most). + google.protobuf.Timestamp end_time = 3; + + // The ISO 4217 currency code for the pricing info in the response proto. + // Will use the conversion rate as of start_time. + // Optional. If not specified USD will be used. + string currency_code = 4; + + // Requested page size. Defaults to 5000. + int32 page_size = 5; + + // A token identifying a page of results to return. This should be a + // `next_page_token` value returned from a previous `ListSkus` + // call. If unspecified, the first page of results is returned. + string page_token = 6; +} + +// Response message for `ListSkus`. +message ListSkusResponse { + // The list of public SKUs of the given service. + repeated Sku skus = 1; + + // A token to retrieve the next page of results. To retrieve the next page, + // call `ListSkus` again with the `page_token` field set to this + // value. This field is empty if there are no more results to retrieve. + string next_page_token = 2; +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 00000000..a5cdff45 --- /dev/null +++ b/renovate.json @@ -0,0 +1,70 @@ +{ + "extends": [ + ":separateMajorReleases", + ":combinePatchMinorReleases", + ":ignoreUnstable", + ":prImmediately", + ":updateNotScheduled", + ":automergeDisabled", + ":ignoreModulesAndTests", + ":maintainLockFilesDisabled", + ":autodetectPinVersions" + ], + "packageRules": [ + { + "packagePatterns": [ + "^com.google.guava:" + ], + "versionScheme": "docker" + }, + { + "packagePatterns": [ + "^com.google.api:gax", + "^com.google.auth:", + "^com.google.cloud:google-cloud-core", + "^io.grpc:" + ], + "groupName": "core dependencies" + }, + { + "packagePatterns": [ + "^com.google.http-client:", + "^com.google.oauth-client:", + "^com.google.api-client:" + ], + "groupName": "core transport dependencies" + }, + { + "packagePatterns": [ + "*" + ], + "semanticCommitType": "deps", + "semanticCommitScope": null + }, + { + "packagePatterns": [ + "^org.apache.maven", + "^org.jacoco:", + "^org.codehaus.mojo:", + "^org.sonatype.plugins:", + "^com.coveo:", + "^com.google.cloud:google-cloud-shared-config" + ], + "semanticCommitType": "build", + "semanticCommitScope": "deps" + }, + { + "packagePatterns": [ + "^com.google.cloud:google-cloud-" + ], + "ignoreUnstable": false + }, + { + "packagePatterns": [ + "^com.fasterxml.jackson.core" + ], + "groupName": "jackson dependencies" + } + ], + "semanticCommits": true +} diff --git a/synth.metadata b/synth.metadata new file mode 100644 index 00000000..435dd7ad --- /dev/null +++ b/synth.metadata @@ -0,0 +1,398 @@ +{ + "updateTime": "2020-01-25T00:07:23.679785Z", + "sources": [ + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "3febac09e0bf5f813de64a8d3cb69641af92584f" + } + }, + { + "template": { + "name": "java_library", + "origin": "synthtool.gcp", + "version": "2019.10.17" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "billing", + "apiVersion": "v1", + "language": "java", + "generator": "bazel" + } + } + ], + "newFiles": [ + { + "path": ".github/ISSUE_TEMPLATE/bug_report.md" + }, + { + "path": ".github/ISSUE_TEMPLATE/feature_request.md" + }, + { + "path": ".github/ISSUE_TEMPLATE/support_request.md" + }, + { + "path": ".github/PULL_REQUEST_TEMPLATE.md" + }, + { + "path": ".github/release-please.yml" + }, + { + "path": ".kokoro/build.bat" + }, + { + "path": ".kokoro/build.sh" + }, + { + "path": ".kokoro/coerce_logs.sh" + }, + { + "path": ".kokoro/common.cfg" + }, + { + "path": ".kokoro/continuous/common.cfg" + }, + { + "path": ".kokoro/continuous/dependencies.cfg" + }, + { + "path": ".kokoro/continuous/integration.cfg" + }, + { + "path": ".kokoro/continuous/java11.cfg" + }, + { + "path": ".kokoro/continuous/java7.cfg" + }, + { + "path": ".kokoro/continuous/java8-osx.cfg" + }, + { + "path": ".kokoro/continuous/java8-win.cfg" + }, + { + "path": ".kokoro/continuous/java8.cfg" + }, + { + "path": ".kokoro/continuous/lint.cfg" + }, + { + "path": ".kokoro/continuous/propose_release.cfg" + }, + { + "path": ".kokoro/continuous/propose_release.sh" + }, + { + "path": ".kokoro/continuous/samples.cfg" + }, + { + "path": ".kokoro/dependencies.sh" + }, + { + "path": ".kokoro/linkage-monitor.sh" + }, + { + "path": ".kokoro/nightly/common.cfg" + }, + { + "path": ".kokoro/nightly/dependencies.cfg" + }, + { + "path": ".kokoro/nightly/integration.cfg" + }, + { + "path": ".kokoro/nightly/java11.cfg" + }, + { + "path": ".kokoro/nightly/java7.cfg" + }, + { + "path": ".kokoro/nightly/java8-osx.cfg" + }, + { + "path": ".kokoro/nightly/java8-win.cfg" + }, + { + "path": ".kokoro/nightly/java8.cfg" + }, + { + "path": ".kokoro/nightly/lint.cfg" + }, + { + "path": ".kokoro/nightly/samples.cfg" + }, + { + "path": ".kokoro/presubmit/clirr.cfg" + }, + { + "path": ".kokoro/presubmit/common.cfg" + }, + { + "path": ".kokoro/presubmit/dependencies.cfg" + }, + { + "path": ".kokoro/presubmit/integration.cfg" + }, + { + "path": ".kokoro/presubmit/java11.cfg" + }, + { + "path": ".kokoro/presubmit/java7.cfg" + }, + { + "path": ".kokoro/presubmit/java8-osx.cfg" + }, + { + "path": ".kokoro/presubmit/java8-win.cfg" + }, + { + "path": ".kokoro/presubmit/java8.cfg" + }, + { + "path": ".kokoro/presubmit/linkage-monitor.cfg" + }, + { + "path": ".kokoro/presubmit/lint.cfg" + }, + { + "path": ".kokoro/presubmit/samples.cfg" + }, + { + "path": ".kokoro/release/bump_snapshot.cfg" + }, + { + "path": ".kokoro/release/bump_snapshot.sh" + }, + { + "path": ".kokoro/release/common.cfg" + }, + { + "path": ".kokoro/release/common.sh" + }, + { + "path": ".kokoro/release/drop.cfg" + }, + { + "path": ".kokoro/release/drop.sh" + }, + { + "path": ".kokoro/release/promote.cfg" + }, + { + "path": ".kokoro/release/promote.sh" + }, + { + "path": ".kokoro/release/publish_javadoc.cfg" + }, + { + "path": ".kokoro/release/publish_javadoc.sh" + }, + { + "path": ".kokoro/release/snapshot.cfg" + }, + { + "path": ".kokoro/release/snapshot.sh" + }, + { + "path": ".kokoro/release/stage.cfg" + }, + { + "path": ".kokoro/release/stage.sh" + }, + { + "path": ".kokoro/trampoline.sh" + }, + { + "path": "CODE_OF_CONDUCT.md" + }, + { + "path": "CONTRIBUTING.md" + }, + { + "path": "LICENSE" + }, + { + "path": "README.md" + }, + { + "path": "codecov.yaml" + }, + { + "path": "google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudBillingClient.java" + }, + { + "path": "google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudBillingSettings.java" + }, + { + "path": "google-cloud-billing/src/main/java/com/google/cloud/billing/v1/CloudCatalogClient.java" + }, + { + "path": "google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/CloudBillingStubSettings.java" + }, + { + "path": "google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudBillingCallableFactory.java" + }, + { + "path": "google-cloud-billing/src/main/java/com/google/cloud/billing/v1/stub/GrpcCloudCatalogCallableFactory.java" + }, + { + "path": "grpc-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudBillingGrpc.java" + }, + { + "path": "grpc-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudCatalogGrpc.java" + }, + { + "path": "java.header" + }, + { + "path": "license-checks.xml" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/AggregationInfo.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/AggregationInfoOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccount.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccountName.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/BillingAccountOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Category.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CategoryOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudBillingProto.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CloudCatalogProto.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CreateBillingAccountRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/CreateBillingAccountRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetBillingAccountRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetBillingAccountRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetProjectBillingInfoRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/GetProjectBillingInfoRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsResponse.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListBillingAccountsResponseOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoResponse.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListProjectBillingInfoResponseOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesResponse.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListServicesResponseOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusResponse.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ListSkusResponseOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingExpression.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingExpressionOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingInfo.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/PricingInfoOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ProjectBillingInfo.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ProjectBillingInfoOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Service.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ServiceName.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/ServiceOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/Sku.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/SkuOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateBillingAccountRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateBillingAccountRequestOrBuilder.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateProjectBillingInfoRequest.java" + }, + { + "path": "proto-google-cloud-billing-v1/src/main/java/com/google/cloud/billing/v1/UpdateProjectBillingInfoRequestOrBuilder.java" + }, + { + "path": "renovate.json" + } + ] +} \ No newline at end of file diff --git a/synth.py b/synth.py new file mode 100644 index 00000000..93e8d065 --- /dev/null +++ b/synth.py @@ -0,0 +1,33 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.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 + +service = 'billing' +versions = ['v1'] + +for version in versions: + java.bazel_library( + service=service, + version=version, + package_pattern='com.google.cloud.{service}.{version}', + proto_path=f'google/cloud/{service}/{version}', + bazel_target=f'//google/cloud/{service}/{version}:google-cloud-{service}-{version}-java', + ) + +java.common_templates()