diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..a1433e4 --- /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-orgpolicy/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. orgpolicy 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 0000000..754e30c --- /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 0000000..9958690 --- /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 0000000..b7befd1 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,7 @@ +Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: +- [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-orgpolicy/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea +- [ ] Ensure the tests and linter pass +- [ ] Code coverage does not decrease (if any source code was changed) +- [ ] Appropriate docs were updated (if necessary) + +Fixes # ☕️ diff --git a/.github/release-please.yml b/.github/release-please.yml new file mode 100644 index 0000000..dce2c84 --- /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/.github/trusted-contribution.yml b/.github/trusted-contribution.yml new file mode 100644 index 0000000..f247d5c --- /dev/null +++ b/.github/trusted-contribution.yml @@ -0,0 +1,2 @@ +trustedContributors: +- renovate-bot \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fadd6af --- /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 0000000..63d6b4c --- /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-orgpolicy/.kokoro/build.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh new file mode 100755 index 0000000..a179094 --- /dev/null +++ b/.kokoro/build.sh @@ -0,0 +1,108 @@ +#!/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 + +RETURN_CODE=0 +set +e + +case ${JOB_TYPE} in +test) + mvn test -B -Dclirr.skip=true -Denforcer.skip=true + RETURN_CODE=$? + ;; +lint) + mvn \ + -Penable-samples \ + com.coveo:fmt-maven-plugin:check + RETURN_CODE=$? + ;; +javadoc) + mvn javadoc:javadoc javadoc:test-javadoc + RETURN_CODE=$? + ;; +integration) + mvn -B ${INTEGRATION_TEST_ARGS} \ + -Penable-integration-tests \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + ;; +samples) + if [[ -f samples/pom.xml ]] + then + pushd samples + mvn -B \ + -Penable-samples \ + -DtrimStackTrace=false \ + -Dclirr.skip=true \ + -Denforcer.skip=true \ + -fae \ + verify + RETURN_CODE=$? + popd + else + echo "no sample pom.xml found - skipping sample tests" + fi + ;; +clirr) + mvn -B -Denforcer.skip=true clirr:check + RETURN_CODE=$? + ;; +*) + ;; +esac + +if [ "${REPORT_COVERAGE}" == "true" ] +then + bash ${KOKORO_GFILE_DIR}/codecov.sh +fi + +# fix output location of logs +bash .kokoro/coerce_logs.sh + +if [[ "${ENABLE_BUILD_COP}" == "true" ]] +then + chmod +x ${KOKORO_GFILE_DIR}/linux_amd64/buildcop + ${KOKORO_GFILE_DIR}/linux_amd64/buildcop -repo=googleapis/java-orgpolicy +fi + +echo "exiting with ${RETURN_CODE}" +exit ${RETURN_CODE} diff --git a/.kokoro/coerce_logs.sh b/.kokoro/coerce_logs.sh new file mode 100755 index 0000000..5cf7ba4 --- /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 0000000..1b6e2b7 --- /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-orgpolicy/.kokoro/trampoline.sh" + +# Tell the trampoline which build file to use. +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-orgpolicy/.kokoro/build.sh" +} diff --git a/.kokoro/continuous/common.cfg b/.kokoro/continuous/common.cfg new file mode 100644 index 0000000..2837241 --- /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-orgpolicy/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-orgpolicy/.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 0000000..125c43c --- /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-orgpolicy/.kokoro/dependencies.sh" +} diff --git a/.kokoro/continuous/integration.cfg b/.kokoro/continuous/integration.cfg new file mode 100644 index 0000000..3b017fc --- /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 0000000..709f2b4 --- /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 0000000..cb24f44 --- /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 0000000..6d571b8 --- /dev/null +++ b/.kokoro/continuous/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-orgpolicy/.kokoro/build.sh" diff --git a/.kokoro/continuous/java8-win.cfg b/.kokoro/continuous/java8-win.cfg new file mode 100644 index 0000000..5534257 --- /dev/null +++ b/.kokoro/continuous/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-orgpolicy/.kokoro/build.bat" diff --git a/.kokoro/continuous/java8.cfg b/.kokoro/continuous/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/continuous/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/continuous/lint.cfg b/.kokoro/continuous/lint.cfg new file mode 100644 index 0000000..6d323c8 --- /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 0000000..48eba8c --- /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-orgpolicy/.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-orgpolicy/.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 0000000..779543e --- /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-orgpolicy \ + --package-name="orgpolicy" \ + --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 0000000..fa7b493 --- /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 0000000..cb7e548 --- /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-orgpolicy/ + +# 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 0000000..375bbed --- /dev/null +++ b/.kokoro/linkage-monitor.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. + +set -eo pipefail +# Display commands being run. +set -x + +cd github/java-orgpolicy/ + +# 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 + +# 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 0000000..2837241 --- /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-orgpolicy/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-orgpolicy/.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 0000000..125c43c --- /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-orgpolicy/.kokoro/dependencies.sh" +} diff --git a/.kokoro/nightly/integration.cfg b/.kokoro/nightly/integration.cfg new file mode 100644 index 0000000..8bf59c0 --- /dev/null +++ b/.kokoro/nightly/integration.cfg @@ -0,0 +1,21 @@ +# 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: "ENABLE_BUILD_COP" + value: "true" +} + +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "java_it_service_account" + } + } +} diff --git a/.kokoro/nightly/java11.cfg b/.kokoro/nightly/java11.cfg new file mode 100644 index 0000000..709f2b4 --- /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 0000000..cb24f44 --- /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 0000000..6d571b8 --- /dev/null +++ b/.kokoro/nightly/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-orgpolicy/.kokoro/build.sh" diff --git a/.kokoro/nightly/java8-win.cfg b/.kokoro/nightly/java8-win.cfg new file mode 100644 index 0000000..5534257 --- /dev/null +++ b/.kokoro/nightly/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-orgpolicy/.kokoro/build.bat" diff --git a/.kokoro/nightly/java8.cfg b/.kokoro/nightly/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/nightly/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/nightly/lint.cfg b/.kokoro/nightly/lint.cfg new file mode 100644 index 0000000..6d323c8 --- /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 0000000..b4b051c --- /dev/null +++ b/.kokoro/nightly/samples.cfg @@ -0,0 +1,36 @@ +# 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" +} + +env_vars: { + key: "ENABLE_BUILD_COP" + value: "true" +} + +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 0000000..ec57244 --- /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 0000000..ff07fa9 --- /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-orgpolicy/.kokoro/trampoline.sh" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/java-orgpolicy/.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 0000000..125c43c --- /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-orgpolicy/.kokoro/dependencies.sh" +} diff --git a/.kokoro/presubmit/integration.cfg b/.kokoro/presubmit/integration.cfg new file mode 100644 index 0000000..141f90c --- /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 0000000..709f2b4 --- /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 0000000..cb24f44 --- /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 0000000..6d571b8 --- /dev/null +++ b/.kokoro/presubmit/java8-osx.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-orgpolicy/.kokoro/build.sh" diff --git a/.kokoro/presubmit/java8-win.cfg b/.kokoro/presubmit/java8-win.cfg new file mode 100644 index 0000000..5534257 --- /dev/null +++ b/.kokoro/presubmit/java8-win.cfg @@ -0,0 +1,3 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +build_file: "java-orgpolicy/.kokoro/build.bat" diff --git a/.kokoro/presubmit/java8.cfg b/.kokoro/presubmit/java8.cfg new file mode 100644 index 0000000..495cc7b --- /dev/null +++ b/.kokoro/presubmit/java8.cfg @@ -0,0 +1,12 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +# Configure the docker image for kokoro-trampoline. +env_vars: { + key: "TRAMPOLINE_IMAGE" + value: "gcr.io/cloud-devrel-kokoro-resources/java8" +} + +env_vars: { + key: "REPORT_COVERAGE" + value: "true" +} diff --git a/.kokoro/presubmit/linkage-monitor.cfg b/.kokoro/presubmit/linkage-monitor.cfg new file mode 100644 index 0000000..c3be477 --- /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-orgpolicy/.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 0000000..6d323c8 --- /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 0000000..fa7b493 --- /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 0000000..322f3c4 --- /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-orgpolicy/.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-orgpolicy/.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 0000000..c00c868 --- /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-orgpolicy \ + --package-name="orgpolicy" \ + --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 0000000..85cf06d --- /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-orgpolicy/.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 0000000..6e3f659 --- /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 0000000..11c059a --- /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-orgpolicy/.kokoro/release/drop.sh" +} diff --git a/.kokoro/release/drop.sh b/.kokoro/release/drop.sh new file mode 100755 index 0000000..5c4551e --- /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 0000000..bd4b735 --- /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-orgpolicy/.kokoro/release/promote.sh" +} diff --git a/.kokoro/release/promote.sh b/.kokoro/release/promote.sh new file mode 100755 index 0000000..1fa95fa --- /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 0000000..f6c4dee --- /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-orgpolicy/.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 0000000..0450176 --- /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=proto-google-cloud-orgpolicy-v1 +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 0000000..c9f8cf5 --- /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-orgpolicy/.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 0000000..098168a --- /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 0000000..b8af28b --- /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-orgpolicy/.kokoro/release/stage.sh" +} + +# Need to save the properties file +action { + define_artifacts { + regex: "github/java-orgpolicy/target/nexus-staging/staging/*.properties" + strip_prefix: "github/java-orgpolicy" + } +} + +# 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 0000000..3c482cb --- /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 0000000..ba17ce0 --- /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 0000000..eb84679 --- /dev/null +++ b/.repo-metadata.json @@ -0,0 +1,14 @@ +{ + "name": "orgpolicy", + "name_pretty": "Cloud Organization Policy", + "product_documentation": "n/a", + "api_description": "n/a", + "client_documentation": "https://googleapis.dev/java/proto-google-cloud-orgpolicy-v1/latest/index.html", + "release_level": "beta", + "transport": "grpc", + "requires_billing": true, + "language": "java", + "repo": "googleapis/java-orgpolicy", + "repo_short": "java-orgpolicy", + "distribution_name": "com.google.api.grpc:proto-google-cloud-orgpolicy-v1" +} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..6b2238b --- /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 0000000..085021d --- /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 0000000..d645695 --- /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 0000000..2742e5d --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +# Google Cloud Organization Policy Client for Java + +Java protobuf classes for [Cloud Organization Policy][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. + +## 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]: TODO +[javadocs]: https://googleapis.dev/java/google-cloud-orgpolicy/latest/index.html +[kokoro-badge-image-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java7.svg +[kokoro-badge-link-1]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java7.html +[kokoro-badge-image-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java8.svg +[kokoro-badge-link-2]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java8.html +[kokoro-badge-image-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java8-osx.svg +[kokoro-badge-link-3]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java8-osx.html +[kokoro-badge-image-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java8-win.svg +[kokoro-badge-link-4]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java8-win.html +[kokoro-badge-image-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/java11.svg +[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-orgpolicy/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-orgpolicy.svg +[maven-version-link]: https://search.maven.org/search?q=g:com.google.cloud%20AND%20a:google-cloud-orgpolicy&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-orgpolicy/blob/master/CONTRIBUTING.md +[code-of-conduct]: https://github.com/googleapis/java-orgpolicy/blob/master/CODE_OF_CONDUCT.md#contributor-code-of-conduct +[license]: https://github.com/googleapis/java-orgpolicy/blob/master/LICENSE +[enable-billing]: https://cloud.google.com/apis/docs/getting-started#enabling_billing + +[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 0000000..5724ea9 --- /dev/null +++ b/codecov.yaml @@ -0,0 +1,4 @@ +--- +codecov: + ci: + - source.cloud.google.com diff --git a/java.header b/java.header new file mode 100644 index 0000000..3a9b503 --- /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 0000000..6597fce --- /dev/null +++ b/license-checks.xml @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..bfed9f9 --- /dev/null +++ b/pom.xml @@ -0,0 +1,166 @@ + + + 4.0.0 + com.google.cloud + google-cloud-orgpolicy-parent + pom + 0.0.1-SNAPSHOT + Google Cloud Org Policy Parent + https://github.com/googleapis/java-orgpolicy + + 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-orgpolicy.git + scm:git:git@github.com:googleapis/java-orgpolicy.git + https://github.com/googleapis/java-orgpolicy + HEAD + + + https://github.com/googleapis/java-orgpolicy/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-orgpolicy-parent + 1.17.0 + 3.11.4 + 4.13 + + + + + + com.google.protobuf + protobuf-java + ${protobuf.version} + + + com.google.api.grpc + proto-google-common-protos + ${google.common-protos.version} + + + + junit + junit + ${junit.version} + test + + + + + + proto-google-cloud-orgpolicy-v1 + + + + + + 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.2.0 + + + html + + aggregate + javadoc + + + + + none + protected + true + ${project.build.directory}/javadoc + + + Test helpers packages + com.google.cloud.testing + + + SPI packages + com.google.cloud.spi* + + + + + https://grpc.io/grpc-java/javadoc/ + https://developers.google.com/protocol-buffers/docs/reference/java/ + https://googleapis.dev/java/google-auth-library/latest/ + https://googleapis.dev/java/gax/latest/ + https://googleapis.github.io/api-common-java/${google.api-common.version}/apidocs/ + + + + + + diff --git a/proto-google-cloud-orgpolicy-v1/pom.xml b/proto-google-cloud-orgpolicy-v1/pom.xml new file mode 100644 index 0000000..efd09dc --- /dev/null +++ b/proto-google-cloud-orgpolicy-v1/pom.xml @@ -0,0 +1,25 @@ + + 4.0.0 + com.google.api.grpc + proto-google-cloud-orgpolicy-v1 + 0.0.1-SNAPSHOT + proto-google-cloud-orgpolicy-v1 + PROTO library for proto-google-cloud-orgpolicy-v1 + + com.google.cloud + google-cloud-orgpolicy-parent + 0.0.1-SNAPSHOT + + + + com.google.protobuf + protobuf-java + + + com.google.api.grpc + proto-google-common-protos + + + \ No newline at end of file diff --git a/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/OrgPolicyProto.java b/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/OrgPolicyProto.java new file mode 100644 index 0000000..f0ee5da --- /dev/null +++ b/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/OrgPolicyProto.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/orgpolicy/v1/orgpolicy.proto + +package com.google.cloud.orgpolicy.v1; + +public final class OrgPolicyProto { + private OrgPolicyProto() {} + + 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_orgpolicy_v1_Policy_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_orgpolicy_v1_Policy_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_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/orgpolicy/v1/orgpolicy.pr" + + "oto\022\031google.cloud.orgpolicy.v1\032\033google/p" + + "rotobuf/empty.proto\032\037google/protobuf/tim" + + "estamp.proto\032\034google/api/annotations.pro" + + "to\"\213\005\n\006Policy\022\017\n\007version\030\001 \001(\005\022\022\n\nconstr" + + "aint\030\002 \001(\t\022\014\n\004etag\030\003 \001(\014\022/\n\013update_time\030" + + "\004 \001(\0132\032.google.protobuf.Timestamp\022C\n\013lis" + + "t_policy\030\005 \001(\0132,.google.cloud.orgpolicy." + + "v1.Policy.ListPolicyH\000\022I\n\016boolean_policy" + + "\030\006 \001(\0132/.google.cloud.orgpolicy.v1.Polic" + + "y.BooleanPolicyH\000\022K\n\017restore_default\030\007 \001" + + "(\01320.google.cloud.orgpolicy.v1.Policy.Re" + + "storeDefaultH\000\032\373\001\n\nListPolicy\022\026\n\016allowed" + + "_values\030\001 \003(\t\022\025\n\rdenied_values\030\002 \003(\t\022J\n\n" + + "all_values\030\003 \001(\01626.google.cloud.orgpolic" + + "y.v1.Policy.ListPolicy.AllValues\022\027\n\017sugg" + + "ested_value\030\004 \001(\t\022\033\n\023inherit_from_parent" + + "\030\005 \001(\010\"<\n\tAllValues\022\032\n\026ALL_VALUES_UNSPEC" + + "IFIED\020\000\022\t\n\005ALLOW\020\001\022\010\n\004DENY\020\002\032!\n\rBooleanP" + + "olicy\022\020\n\010enforced\030\001 \001(\010\032\020\n\016RestoreDefaul" + + "tB\r\n\013policy_typeB\314\001\n\035com.google.cloud.or" + + "gpolicy.v1B\016OrgPolicyProtoP\001ZBgoogle.gol" + + "ang.org/genproto/googleapis/cloud/orgpol" + + "icy/v1;orgpolicy\252\002\031Google.Cloud.OrgPolic" + + "y.V1\312\002\031Google\\Cloud\\OrgPolicy\\V1\352\002\034Googl" + + "e::Cloud::OrgPolicy::V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.TimestampProto.getDescriptor(), + com.google.api.AnnotationsProto.getDescriptor(), + }); + internal_static_google_cloud_orgpolicy_v1_Policy_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_orgpolicy_v1_Policy_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_orgpolicy_v1_Policy_descriptor, + new java.lang.String[] { + "Version", + "Constraint", + "Etag", + "UpdateTime", + "ListPolicy", + "BooleanPolicy", + "RestoreDefault", + "PolicyType", + }); + internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_descriptor = + internal_static_google_cloud_orgpolicy_v1_Policy_descriptor.getNestedTypes().get(0); + internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_descriptor, + new java.lang.String[] { + "AllowedValues", "DeniedValues", "AllValues", "SuggestedValue", "InheritFromParent", + }); + internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_descriptor = + internal_static_google_cloud_orgpolicy_v1_Policy_descriptor.getNestedTypes().get(1); + internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_descriptor, + new java.lang.String[] { + "Enforced", + }); + internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_descriptor = + internal_static_google_cloud_orgpolicy_v1_Policy_descriptor.getNestedTypes().get(2); + internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_descriptor, + new java.lang.String[] {}); + com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.TimestampProto.getDescriptor(); + com.google.api.AnnotationsProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/Policy.java b/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/Policy.java new file mode 100644 index 0000000..55d183d --- /dev/null +++ b/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/Policy.java @@ -0,0 +1,5645 @@ +/* + * 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/orgpolicy/v1/orgpolicy.proto + +package com.google.cloud.orgpolicy.v1; + +/** + * + * + *
+ * Defines a Cloud Organization `Policy` which is used to specify `Constraints`
+ * for configurations of Cloud Platform resources.
+ * 
+ * + * Protobuf type {@code google.cloud.orgpolicy.v1.Policy} + */ +public final class Policy extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.orgpolicy.v1.Policy) + PolicyOrBuilder { + private static final long serialVersionUID = 0L; + // Use Policy.newBuilder() to construct. + private Policy(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Policy() { + constraint_ = ""; + etag_ = com.google.protobuf.ByteString.EMPTY; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Policy(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private Policy( + 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: + { + version_ = input.readInt32(); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + + constraint_ = s; + break; + } + case 26: + { + etag_ = input.readBytes(); + break; + } + case 34: + { + com.google.protobuf.Timestamp.Builder subBuilder = null; + if (updateTime_ != null) { + subBuilder = updateTime_.toBuilder(); + } + updateTime_ = + input.readMessage(com.google.protobuf.Timestamp.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(updateTime_); + updateTime_ = subBuilder.buildPartial(); + } + + break; + } + case 42: + { + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.Builder subBuilder = null; + if (policyTypeCase_ == 5) { + subBuilder = + ((com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_).toBuilder(); + } + policyType_ = + input.readMessage( + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom((com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_); + policyType_ = subBuilder.buildPartial(); + } + policyTypeCase_ = 5; + break; + } + case 50: + { + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.Builder subBuilder = null; + if (policyTypeCase_ == 6) { + subBuilder = + ((com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_).toBuilder(); + } + policyType_ = + input.readMessage( + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_); + policyType_ = subBuilder.buildPartial(); + } + policyTypeCase_ = 6; + break; + } + case 58: + { + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.Builder subBuilder = null; + if (policyTypeCase_ == 7) { + subBuilder = + ((com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_).toBuilder(); + } + policyType_ = + input.readMessage( + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.parser(), + extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom( + (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_); + policyType_ = subBuilder.buildPartial(); + } + policyTypeCase_ = 7; + 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.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.orgpolicy.v1.Policy.class, + com.google.cloud.orgpolicy.v1.Policy.Builder.class); + } + + public interface ListPolicyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.orgpolicy.v1.Policy.ListPolicy) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * List of values allowed  at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string allowed_values = 1; + * + * @return A list containing the allowedValues. + */ + java.util.List getAllowedValuesList(); + /** + * + * + *
+     * List of values allowed  at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string allowed_values = 1; + * + * @return The count of allowedValues. + */ + int getAllowedValuesCount(); + /** + * + * + *
+     * List of values allowed  at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string allowed_values = 1; + * + * @param index The index of the element to return. + * @return The allowedValues at the given index. + */ + java.lang.String getAllowedValues(int index); + /** + * + * + *
+     * List of values allowed  at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string allowed_values = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedValues at the given index. + */ + com.google.protobuf.ByteString getAllowedValuesBytes(int index); + + /** + * + * + *
+     * List of values denied at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string denied_values = 2; + * + * @return A list containing the deniedValues. + */ + java.util.List getDeniedValuesList(); + /** + * + * + *
+     * List of values denied at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string denied_values = 2; + * + * @return The count of deniedValues. + */ + int getDeniedValuesCount(); + /** + * + * + *
+     * List of values denied at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string denied_values = 2; + * + * @param index The index of the element to return. + * @return The deniedValues at the given index. + */ + java.lang.String getDeniedValues(int index); + /** + * + * + *
+     * List of values denied at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string denied_values = 2; + * + * @param index The index of the value to return. + * @return The bytes of the deniedValues at the given index. + */ + com.google.protobuf.ByteString getDeniedValuesBytes(int index); + + /** + * + * + *
+     * The policy all_values state.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @return The enum numeric value on the wire for allValues. + */ + int getAllValuesValue(); + /** + * + * + *
+     * The policy all_values state.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @return The allValues. + */ + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues getAllValues(); + + /** + * + * + *
+     * Optional. The Google Cloud Console will try to default to a configuration
+     * that matches the value specified in this `Policy`. If `suggested_value`
+     * is not set, it will inherit the value specified higher in the hierarchy,
+     * unless `inherit_from_parent` is `false`.
+     * 
+ * + * string suggested_value = 4; + * + * @return The suggestedValue. + */ + java.lang.String getSuggestedValue(); + /** + * + * + *
+     * Optional. The Google Cloud Console will try to default to a configuration
+     * that matches the value specified in this `Policy`. If `suggested_value`
+     * is not set, it will inherit the value specified higher in the hierarchy,
+     * unless `inherit_from_parent` is `false`.
+     * 
+ * + * string suggested_value = 4; + * + * @return The bytes for suggestedValue. + */ + com.google.protobuf.ByteString getSuggestedValueBytes(); + + /** + * + * + *
+     * Determines the inheritance behavior for this `Policy`.
+     * By default, a `ListPolicy` set at a resource supercedes any `Policy` set
+     * anywhere up the resource hierarchy. However, if `inherit_from_parent` is
+     * set to `true`, then the values from the effective `Policy` of the parent
+     * resource are inherited, meaning the values set in this `Policy` are
+     * added to the values inherited up the hierarchy.
+     * Setting `Policy` hierarchies that inherit both allowed values and denied
+     * values isn't recommended in most circumstances to keep the configuration
+     * simple and understandable. However, it is possible to set a `Policy` with
+     * `allowed_values` set that inherits a `Policy` with `denied_values` set.
+     * In this case, the values that are allowed must be in `allowed_values` and
+     * not present in `denied_values`.
+     * For example, suppose you have a `Constraint`
+     * `constraints/serviceuser.services`, which has a `constraint_type` of
+     * `list_constraint`, and with `constraint_default` set to `ALLOW`.
+     * Suppose that at the Organization level, a `Policy` is applied that
+     * restricts the allowed API activations to {`E1`, `E2`}. Then, if a
+     * `Policy` is applied to a project below the Organization that has
+     * `inherit_from_parent` set to `false` and field all_values set to DENY,
+     * then an attempt to activate any API will be denied.
+     * The following examples demonstrate different possible layerings for
+     * `projects/bar` parented by `organizations/foo`:
+     * Example 1 (no inherited values):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values:"E2"}
+     *   `projects/bar` has `inherit_from_parent` `false` and values:
+     *     {allowed_values: "E3" allowed_values: "E4"}
+     * The accepted values at `organizations/foo` are `E1`, `E2`.
+     * The accepted values at `projects/bar` are `E3`, and `E4`.
+     * Example 2 (inherited values):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values:"E2"}
+     *   `projects/bar` has a `Policy` with values:
+     *     {value: "E3" value: "E4" inherit_from_parent: true}
+     * The accepted values at `organizations/foo` are `E1`, `E2`.
+     * The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`.
+     * Example 3 (inheriting both allowed and denied values):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values: "E2"}
+     *   `projects/bar` has a `Policy` with:
+     *     {denied_values: "E1"}
+     * The accepted values at `organizations/foo` are `E1`, `E2`.
+     * The value accepted at `projects/bar` is `E2`.
+     * Example 4 (RestoreDefault):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values:"E2"}
+     *   `projects/bar` has a `Policy` with values:
+     *     {RestoreDefault: {}}
+     * The accepted values at `organizations/foo` are `E1`, `E2`.
+     * The accepted values at `projects/bar` are either all or none depending on
+     * the value of `constraint_default` (if `ALLOW`, all; if
+     * `DENY`, none).
+     * Example 5 (no policy inherits parent policy):
+     *   `organizations/foo` has no `Policy` set.
+     *   `projects/bar` has no `Policy` set.
+     * The accepted values at both levels are either all or none depending on
+     * the value of `constraint_default` (if `ALLOW`, all; if
+     * `DENY`, none).
+     * Example 6 (ListConstraint allowing all):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values: "E2"}
+     *   `projects/bar` has a `Policy` with:
+     *     {all: ALLOW}
+     * The accepted values at `organizations/foo` are `E1`, E2`.
+     * Any value is accepted at `projects/bar`.
+     * Example 7 (ListConstraint allowing none):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values: "E2"}
+     *   `projects/bar` has a `Policy` with:
+     *     {all: DENY}
+     * The accepted values at `organizations/foo` are `E1`, E2`.
+     * No value is accepted at `projects/bar`.
+     * Example 10 (allowed and denied subtrees of Resource Manager hierarchy):
+     * Given the following resource hierarchy
+     *   O1->{F1, F2}; F1->{P1}; F2->{P2, P3},
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "under:organizations/O1"}
+     *   `projects/bar` has a `Policy` with:
+     *     {allowed_values: "under:projects/P3"}
+     *     {denied_values: "under:folders/F2"}
+     * The accepted values at `organizations/foo` are `organizations/O1`,
+     *   `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`,
+     *   `projects/P3`.
+     * The accepted values at `projects/bar` are `organizations/O1`,
+     *   `folders/F1`, `projects/P1`.
+     * 
+ * + * bool inherit_from_parent = 5; + * + * @return The inheritFromParent. + */ + boolean getInheritFromParent(); + } + /** + * + * + *
+   * Used in `policy_type` to specify how `list_policy` behaves at this
+   * resource.
+   * `ListPolicy` can define specific values and subtrees of Cloud Resource
+   * Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that
+   * are allowed or denied by setting the `allowed_values` and `denied_values`
+   * fields. This is achieved by using the `under:` and optional `is:` prefixes.
+   * The `under:` prefix is used to denote resource subtree values.
+   * The `is:` prefix is used to denote specific values, and is required only
+   * if the value contains a ":". Values prefixed with "is:" are treated the
+   * same as values with no prefix.
+   * Ancestry subtrees must be in one of the following formats:
+   *     - "projects/<project-id>", e.g. "projects/tokyo-rain-123"
+   *     - "folders/<folder-id>", e.g. "folders/1234"
+   *     - "organizations/<organization-id>", e.g. "organizations/1234"
+   * The `supports_under` field of the associated `Constraint`  defines whether
+   * ancestry prefixes can be used. You can set `allowed_values` and
+   * `denied_values` in the same `Policy` if `all_values` is
+   * `ALL_VALUES_UNSPECIFIED`. `ALLOW` or `DENY` are used to allow or deny all
+   * values. If `all_values` is set to either `ALLOW` or `DENY`,
+   * `allowed_values` and `denied_values` must be unset.
+   * 
+ * + * Protobuf type {@code google.cloud.orgpolicy.v1.Policy.ListPolicy} + */ + public static final class ListPolicy extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.orgpolicy.v1.Policy.ListPolicy) + ListPolicyOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListPolicy.newBuilder() to construct. + private ListPolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListPolicy() { + allowedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY; + deniedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY; + allValues_ = 0; + suggestedValue_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListPolicy(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private ListPolicy( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + allowedValues_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000001; + } + allowedValues_.add(s); + break; + } + case 18: + { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + deniedValues_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + deniedValues_.add(s); + break; + } + case 24: + { + int rawValue = input.readEnum(); + + allValues_ = rawValue; + break; + } + case 34: + { + java.lang.String s = input.readStringRequireUtf8(); + + suggestedValue_ = s; + break; + } + case 40: + { + inheritFromParent_ = 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 { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + allowedValues_ = allowedValues_.getUnmodifiableView(); + } + if (((mutable_bitField0_ & 0x00000002) != 0)) { + deniedValues_ = deniedValues_.getUnmodifiableView(); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.class, + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.Builder.class); + } + + /** + * + * + *
+     * This enum can be used to set `Policies` that apply to all possible
+     * configuration values rather than specific values in `allowed_values` or
+     * `denied_values`.
+     * Settting this to `ALLOW` will mean this `Policy` allows all values.
+     * Similarly, setting it to `DENY` will mean no values are allowed. If
+     * set to either `ALLOW` or `DENY,  `allowed_values` and `denied_values`
+     * must be unset. Setting this to `ALL_VALUES_UNSPECIFIED` allows for
+     * setting `allowed_values` and `denied_values`.
+     * 
+ * + * Protobuf enum {@code google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues} + */ + public enum AllValues implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+       * Indicates that allowed_values or denied_values must be set.
+       * 
+ * + * ALL_VALUES_UNSPECIFIED = 0; + */ + ALL_VALUES_UNSPECIFIED(0), + /** + * + * + *
+       * A policy with this set allows all values.
+       * 
+ * + * ALLOW = 1; + */ + ALLOW(1), + /** + * + * + *
+       * A policy with this set denies all values.
+       * 
+ * + * DENY = 2; + */ + DENY(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+       * Indicates that allowed_values or denied_values must be set.
+       * 
+ * + * ALL_VALUES_UNSPECIFIED = 0; + */ + public static final int ALL_VALUES_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+       * A policy with this set allows all values.
+       * 
+ * + * ALLOW = 1; + */ + public static final int ALLOW_VALUE = 1; + /** + * + * + *
+       * A policy with this set denies all values.
+       * 
+ * + * DENY = 2; + */ + public static final int DENY_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 AllValues 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 AllValues forNumber(int value) { + switch (value) { + case 0: + return ALL_VALUES_UNSPECIFIED; + case 1: + return ALLOW; + case 2: + return DENY; + 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 AllValues findValueByNumber(int number) { + return AllValues.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.orgpolicy.v1.Policy.ListPolicy.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final AllValues[] VALUES = values(); + + public static AllValues 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 AllValues(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues) + } + + public static final int ALLOWED_VALUES_FIELD_NUMBER = 1; + private com.google.protobuf.LazyStringList allowedValues_; + /** + * + * + *
+     * List of values allowed  at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string allowed_values = 1; + * + * @return A list containing the allowedValues. + */ + public com.google.protobuf.ProtocolStringList getAllowedValuesList() { + return allowedValues_; + } + /** + * + * + *
+     * List of values allowed  at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string allowed_values = 1; + * + * @return The count of allowedValues. + */ + public int getAllowedValuesCount() { + return allowedValues_.size(); + } + /** + * + * + *
+     * List of values allowed  at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string allowed_values = 1; + * + * @param index The index of the element to return. + * @return The allowedValues at the given index. + */ + public java.lang.String getAllowedValues(int index) { + return allowedValues_.get(index); + } + /** + * + * + *
+     * List of values allowed  at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string allowed_values = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedValues at the given index. + */ + public com.google.protobuf.ByteString getAllowedValuesBytes(int index) { + return allowedValues_.getByteString(index); + } + + public static final int DENIED_VALUES_FIELD_NUMBER = 2; + private com.google.protobuf.LazyStringList deniedValues_; + /** + * + * + *
+     * List of values denied at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string denied_values = 2; + * + * @return A list containing the deniedValues. + */ + public com.google.protobuf.ProtocolStringList getDeniedValuesList() { + return deniedValues_; + } + /** + * + * + *
+     * List of values denied at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string denied_values = 2; + * + * @return The count of deniedValues. + */ + public int getDeniedValuesCount() { + return deniedValues_.size(); + } + /** + * + * + *
+     * List of values denied at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string denied_values = 2; + * + * @param index The index of the element to return. + * @return The deniedValues at the given index. + */ + public java.lang.String getDeniedValues(int index) { + return deniedValues_.get(index); + } + /** + * + * + *
+     * List of values denied at this resource. Can only be set if `all_values`
+     * is set to `ALL_VALUES_UNSPECIFIED`.
+     * 
+ * + * repeated string denied_values = 2; + * + * @param index The index of the value to return. + * @return The bytes of the deniedValues at the given index. + */ + public com.google.protobuf.ByteString getDeniedValuesBytes(int index) { + return deniedValues_.getByteString(index); + } + + public static final int ALL_VALUES_FIELD_NUMBER = 3; + private int allValues_; + /** + * + * + *
+     * The policy all_values state.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @return The enum numeric value on the wire for allValues. + */ + public int getAllValuesValue() { + return allValues_; + } + /** + * + * + *
+     * The policy all_values state.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @return The allValues. + */ + public com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues getAllValues() { + @SuppressWarnings("deprecation") + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues result = + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues.valueOf(allValues_); + return result == null + ? com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues.UNRECOGNIZED + : result; + } + + public static final int SUGGESTED_VALUE_FIELD_NUMBER = 4; + private volatile java.lang.Object suggestedValue_; + /** + * + * + *
+     * Optional. The Google Cloud Console will try to default to a configuration
+     * that matches the value specified in this `Policy`. If `suggested_value`
+     * is not set, it will inherit the value specified higher in the hierarchy,
+     * unless `inherit_from_parent` is `false`.
+     * 
+ * + * string suggested_value = 4; + * + * @return The suggestedValue. + */ + public java.lang.String getSuggestedValue() { + java.lang.Object ref = suggestedValue_; + 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(); + suggestedValue_ = s; + return s; + } + } + /** + * + * + *
+     * Optional. The Google Cloud Console will try to default to a configuration
+     * that matches the value specified in this `Policy`. If `suggested_value`
+     * is not set, it will inherit the value specified higher in the hierarchy,
+     * unless `inherit_from_parent` is `false`.
+     * 
+ * + * string suggested_value = 4; + * + * @return The bytes for suggestedValue. + */ + public com.google.protobuf.ByteString getSuggestedValueBytes() { + java.lang.Object ref = suggestedValue_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + suggestedValue_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int INHERIT_FROM_PARENT_FIELD_NUMBER = 5; + private boolean inheritFromParent_; + /** + * + * + *
+     * Determines the inheritance behavior for this `Policy`.
+     * By default, a `ListPolicy` set at a resource supercedes any `Policy` set
+     * anywhere up the resource hierarchy. However, if `inherit_from_parent` is
+     * set to `true`, then the values from the effective `Policy` of the parent
+     * resource are inherited, meaning the values set in this `Policy` are
+     * added to the values inherited up the hierarchy.
+     * Setting `Policy` hierarchies that inherit both allowed values and denied
+     * values isn't recommended in most circumstances to keep the configuration
+     * simple and understandable. However, it is possible to set a `Policy` with
+     * `allowed_values` set that inherits a `Policy` with `denied_values` set.
+     * In this case, the values that are allowed must be in `allowed_values` and
+     * not present in `denied_values`.
+     * For example, suppose you have a `Constraint`
+     * `constraints/serviceuser.services`, which has a `constraint_type` of
+     * `list_constraint`, and with `constraint_default` set to `ALLOW`.
+     * Suppose that at the Organization level, a `Policy` is applied that
+     * restricts the allowed API activations to {`E1`, `E2`}. Then, if a
+     * `Policy` is applied to a project below the Organization that has
+     * `inherit_from_parent` set to `false` and field all_values set to DENY,
+     * then an attempt to activate any API will be denied.
+     * The following examples demonstrate different possible layerings for
+     * `projects/bar` parented by `organizations/foo`:
+     * Example 1 (no inherited values):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values:"E2"}
+     *   `projects/bar` has `inherit_from_parent` `false` and values:
+     *     {allowed_values: "E3" allowed_values: "E4"}
+     * The accepted values at `organizations/foo` are `E1`, `E2`.
+     * The accepted values at `projects/bar` are `E3`, and `E4`.
+     * Example 2 (inherited values):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values:"E2"}
+     *   `projects/bar` has a `Policy` with values:
+     *     {value: "E3" value: "E4" inherit_from_parent: true}
+     * The accepted values at `organizations/foo` are `E1`, `E2`.
+     * The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`.
+     * Example 3 (inheriting both allowed and denied values):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values: "E2"}
+     *   `projects/bar` has a `Policy` with:
+     *     {denied_values: "E1"}
+     * The accepted values at `organizations/foo` are `E1`, `E2`.
+     * The value accepted at `projects/bar` is `E2`.
+     * Example 4 (RestoreDefault):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values:"E2"}
+     *   `projects/bar` has a `Policy` with values:
+     *     {RestoreDefault: {}}
+     * The accepted values at `organizations/foo` are `E1`, `E2`.
+     * The accepted values at `projects/bar` are either all or none depending on
+     * the value of `constraint_default` (if `ALLOW`, all; if
+     * `DENY`, none).
+     * Example 5 (no policy inherits parent policy):
+     *   `organizations/foo` has no `Policy` set.
+     *   `projects/bar` has no `Policy` set.
+     * The accepted values at both levels are either all or none depending on
+     * the value of `constraint_default` (if `ALLOW`, all; if
+     * `DENY`, none).
+     * Example 6 (ListConstraint allowing all):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values: "E2"}
+     *   `projects/bar` has a `Policy` with:
+     *     {all: ALLOW}
+     * The accepted values at `organizations/foo` are `E1`, E2`.
+     * Any value is accepted at `projects/bar`.
+     * Example 7 (ListConstraint allowing none):
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "E1" allowed_values: "E2"}
+     *   `projects/bar` has a `Policy` with:
+     *     {all: DENY}
+     * The accepted values at `organizations/foo` are `E1`, E2`.
+     * No value is accepted at `projects/bar`.
+     * Example 10 (allowed and denied subtrees of Resource Manager hierarchy):
+     * Given the following resource hierarchy
+     *   O1->{F1, F2}; F1->{P1}; F2->{P2, P3},
+     *   `organizations/foo` has a `Policy` with values:
+     *     {allowed_values: "under:organizations/O1"}
+     *   `projects/bar` has a `Policy` with:
+     *     {allowed_values: "under:projects/P3"}
+     *     {denied_values: "under:folders/F2"}
+     * The accepted values at `organizations/foo` are `organizations/O1`,
+     *   `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`,
+     *   `projects/P3`.
+     * The accepted values at `projects/bar` are `organizations/O1`,
+     *   `folders/F1`, `projects/P1`.
+     * 
+ * + * bool inherit_from_parent = 5; + * + * @return The inheritFromParent. + */ + public boolean getInheritFromParent() { + return inheritFromParent_; + } + + 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 < allowedValues_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, allowedValues_.getRaw(i)); + } + for (int i = 0; i < deniedValues_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, deniedValues_.getRaw(i)); + } + if (allValues_ + != com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues.ALL_VALUES_UNSPECIFIED + .getNumber()) { + output.writeEnum(3, allValues_); + } + if (!getSuggestedValueBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, suggestedValue_); + } + if (inheritFromParent_ != false) { + output.writeBool(5, inheritFromParent_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < allowedValues_.size(); i++) { + dataSize += computeStringSizeNoTag(allowedValues_.getRaw(i)); + } + size += dataSize; + size += 1 * getAllowedValuesList().size(); + } + { + int dataSize = 0; + for (int i = 0; i < deniedValues_.size(); i++) { + dataSize += computeStringSizeNoTag(deniedValues_.getRaw(i)); + } + size += dataSize; + size += 1 * getDeniedValuesList().size(); + } + if (allValues_ + != com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues.ALL_VALUES_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(3, allValues_); + } + if (!getSuggestedValueBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, suggestedValue_); + } + if (inheritFromParent_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(5, inheritFromParent_); + } + 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.orgpolicy.v1.Policy.ListPolicy)) { + return super.equals(obj); + } + com.google.cloud.orgpolicy.v1.Policy.ListPolicy other = + (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) obj; + + if (!getAllowedValuesList().equals(other.getAllowedValuesList())) return false; + if (!getDeniedValuesList().equals(other.getDeniedValuesList())) return false; + if (allValues_ != other.allValues_) return false; + if (!getSuggestedValue().equals(other.getSuggestedValue())) return false; + if (getInheritFromParent() != other.getInheritFromParent()) 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 (getAllowedValuesCount() > 0) { + hash = (37 * hash) + ALLOWED_VALUES_FIELD_NUMBER; + hash = (53 * hash) + getAllowedValuesList().hashCode(); + } + if (getDeniedValuesCount() > 0) { + hash = (37 * hash) + DENIED_VALUES_FIELD_NUMBER; + hash = (53 * hash) + getDeniedValuesList().hashCode(); + } + hash = (37 * hash) + ALL_VALUES_FIELD_NUMBER; + hash = (53 * hash) + allValues_; + hash = (37 * hash) + SUGGESTED_VALUE_FIELD_NUMBER; + hash = (53 * hash) + getSuggestedValue().hashCode(); + hash = (37 * hash) + INHERIT_FROM_PARENT_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getInheritFromParent()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy 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.orgpolicy.v1.Policy.ListPolicy parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy 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.orgpolicy.v1.Policy.ListPolicy parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy 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.orgpolicy.v1.Policy.ListPolicy parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy 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.orgpolicy.v1.Policy.ListPolicy parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy 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.orgpolicy.v1.Policy.ListPolicy 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; + } + /** + * + * + *
+     * Used in `policy_type` to specify how `list_policy` behaves at this
+     * resource.
+     * `ListPolicy` can define specific values and subtrees of Cloud Resource
+     * Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that
+     * are allowed or denied by setting the `allowed_values` and `denied_values`
+     * fields. This is achieved by using the `under:` and optional `is:` prefixes.
+     * The `under:` prefix is used to denote resource subtree values.
+     * The `is:` prefix is used to denote specific values, and is required only
+     * if the value contains a ":". Values prefixed with "is:" are treated the
+     * same as values with no prefix.
+     * Ancestry subtrees must be in one of the following formats:
+     *     - "projects/<project-id>", e.g. "projects/tokyo-rain-123"
+     *     - "folders/<folder-id>", e.g. "folders/1234"
+     *     - "organizations/<organization-id>", e.g. "organizations/1234"
+     * The `supports_under` field of the associated `Constraint`  defines whether
+     * ancestry prefixes can be used. You can set `allowed_values` and
+     * `denied_values` in the same `Policy` if `all_values` is
+     * `ALL_VALUES_UNSPECIFIED`. `ALLOW` or `DENY` are used to allow or deny all
+     * values. If `all_values` is set to either `ALLOW` or `DENY`,
+     * `allowed_values` and `denied_values` must be unset.
+     * 
+ * + * Protobuf type {@code google.cloud.orgpolicy.v1.Policy.ListPolicy} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.orgpolicy.v1.Policy.ListPolicy) + com.google.cloud.orgpolicy.v1.Policy.ListPolicyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.class, + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.Builder.class); + } + + // Construct using com.google.cloud.orgpolicy.v1.Policy.ListPolicy.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(); + allowedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + deniedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + allValues_ = 0; + + suggestedValue_ = ""; + + inheritFromParent_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_ListPolicy_descriptor; + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.ListPolicy getDefaultInstanceForType() { + return com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.ListPolicy build() { + com.google.cloud.orgpolicy.v1.Policy.ListPolicy result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.ListPolicy buildPartial() { + com.google.cloud.orgpolicy.v1.Policy.ListPolicy result = + new com.google.cloud.orgpolicy.v1.Policy.ListPolicy(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + allowedValues_ = allowedValues_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.allowedValues_ = allowedValues_; + if (((bitField0_ & 0x00000002) != 0)) { + deniedValues_ = deniedValues_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.deniedValues_ = deniedValues_; + result.allValues_ = allValues_; + result.suggestedValue_ = suggestedValue_; + result.inheritFromParent_ = inheritFromParent_; + 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.orgpolicy.v1.Policy.ListPolicy) { + return mergeFrom((com.google.cloud.orgpolicy.v1.Policy.ListPolicy) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.orgpolicy.v1.Policy.ListPolicy other) { + if (other == com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance()) + return this; + if (!other.allowedValues_.isEmpty()) { + if (allowedValues_.isEmpty()) { + allowedValues_ = other.allowedValues_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAllowedValuesIsMutable(); + allowedValues_.addAll(other.allowedValues_); + } + onChanged(); + } + if (!other.deniedValues_.isEmpty()) { + if (deniedValues_.isEmpty()) { + deniedValues_ = other.deniedValues_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureDeniedValuesIsMutable(); + deniedValues_.addAll(other.deniedValues_); + } + onChanged(); + } + if (other.allValues_ != 0) { + setAllValuesValue(other.getAllValuesValue()); + } + if (!other.getSuggestedValue().isEmpty()) { + suggestedValue_ = other.suggestedValue_; + onChanged(); + } + if (other.getInheritFromParent() != false) { + setInheritFromParent(other.getInheritFromParent()); + } + 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.orgpolicy.v1.Policy.ListPolicy parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int bitField0_; + + private com.google.protobuf.LazyStringList allowedValues_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureAllowedValuesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + allowedValues_ = new com.google.protobuf.LazyStringArrayList(allowedValues_); + bitField0_ |= 0x00000001; + } + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @return A list containing the allowedValues. + */ + public com.google.protobuf.ProtocolStringList getAllowedValuesList() { + return allowedValues_.getUnmodifiableView(); + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @return The count of allowedValues. + */ + public int getAllowedValuesCount() { + return allowedValues_.size(); + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @param index The index of the element to return. + * @return The allowedValues at the given index. + */ + public java.lang.String getAllowedValues(int index) { + return allowedValues_.get(index); + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @param index The index of the value to return. + * @return The bytes of the allowedValues at the given index. + */ + public com.google.protobuf.ByteString getAllowedValuesBytes(int index) { + return allowedValues_.getByteString(index); + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @param index The index to set the value at. + * @param value The allowedValues to set. + * @return This builder for chaining. + */ + public Builder setAllowedValues(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedValuesIsMutable(); + allowedValues_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @param value The allowedValues to add. + * @return This builder for chaining. + */ + public Builder addAllowedValues(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureAllowedValuesIsMutable(); + allowedValues_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @param values The allowedValues to add. + * @return This builder for chaining. + */ + public Builder addAllAllowedValues(java.lang.Iterable values) { + ensureAllowedValuesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, allowedValues_); + onChanged(); + return this; + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @return This builder for chaining. + */ + public Builder clearAllowedValues() { + allowedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+       * List of values allowed  at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string allowed_values = 1; + * + * @param value The bytes of the allowedValues to add. + * @return This builder for chaining. + */ + public Builder addAllowedValuesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureAllowedValuesIsMutable(); + allowedValues_.add(value); + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringList deniedValues_ = + com.google.protobuf.LazyStringArrayList.EMPTY; + + private void ensureDeniedValuesIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + deniedValues_ = new com.google.protobuf.LazyStringArrayList(deniedValues_); + bitField0_ |= 0x00000002; + } + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @return A list containing the deniedValues. + */ + public com.google.protobuf.ProtocolStringList getDeniedValuesList() { + return deniedValues_.getUnmodifiableView(); + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @return The count of deniedValues. + */ + public int getDeniedValuesCount() { + return deniedValues_.size(); + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @param index The index of the element to return. + * @return The deniedValues at the given index. + */ + public java.lang.String getDeniedValues(int index) { + return deniedValues_.get(index); + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @param index The index of the value to return. + * @return The bytes of the deniedValues at the given index. + */ + public com.google.protobuf.ByteString getDeniedValuesBytes(int index) { + return deniedValues_.getByteString(index); + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @param index The index to set the value at. + * @param value The deniedValues to set. + * @return This builder for chaining. + */ + public Builder setDeniedValues(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDeniedValuesIsMutable(); + deniedValues_.set(index, value); + onChanged(); + return this; + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @param value The deniedValues to add. + * @return This builder for chaining. + */ + public Builder addDeniedValues(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureDeniedValuesIsMutable(); + deniedValues_.add(value); + onChanged(); + return this; + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @param values The deniedValues to add. + * @return This builder for chaining. + */ + public Builder addAllDeniedValues(java.lang.Iterable values) { + ensureDeniedValuesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, deniedValues_); + onChanged(); + return this; + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @return This builder for chaining. + */ + public Builder clearDeniedValues() { + deniedValues_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+       * List of values denied at this resource. Can only be set if `all_values`
+       * is set to `ALL_VALUES_UNSPECIFIED`.
+       * 
+ * + * repeated string denied_values = 2; + * + * @param value The bytes of the deniedValues to add. + * @return This builder for chaining. + */ + public Builder addDeniedValuesBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureDeniedValuesIsMutable(); + deniedValues_.add(value); + onChanged(); + return this; + } + + private int allValues_ = 0; + /** + * + * + *
+       * The policy all_values state.
+       * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @return The enum numeric value on the wire for allValues. + */ + public int getAllValuesValue() { + return allValues_; + } + /** + * + * + *
+       * The policy all_values state.
+       * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @param value The enum numeric value on the wire for allValues to set. + * @return This builder for chaining. + */ + public Builder setAllValuesValue(int value) { + allValues_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * The policy all_values state.
+       * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @return The allValues. + */ + public com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues getAllValues() { + @SuppressWarnings("deprecation") + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues result = + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues.valueOf(allValues_); + return result == null + ? com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues.UNRECOGNIZED + : result; + } + /** + * + * + *
+       * The policy all_values state.
+       * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @param value The allValues to set. + * @return This builder for chaining. + */ + public Builder setAllValues(com.google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues value) { + if (value == null) { + throw new NullPointerException(); + } + + allValues_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+       * The policy all_values state.
+       * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy.AllValues all_values = 3; + * + * @return This builder for chaining. + */ + public Builder clearAllValues() { + + allValues_ = 0; + onChanged(); + return this; + } + + private java.lang.Object suggestedValue_ = ""; + /** + * + * + *
+       * Optional. The Google Cloud Console will try to default to a configuration
+       * that matches the value specified in this `Policy`. If `suggested_value`
+       * is not set, it will inherit the value specified higher in the hierarchy,
+       * unless `inherit_from_parent` is `false`.
+       * 
+ * + * string suggested_value = 4; + * + * @return The suggestedValue. + */ + public java.lang.String getSuggestedValue() { + java.lang.Object ref = suggestedValue_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + suggestedValue_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+       * Optional. The Google Cloud Console will try to default to a configuration
+       * that matches the value specified in this `Policy`. If `suggested_value`
+       * is not set, it will inherit the value specified higher in the hierarchy,
+       * unless `inherit_from_parent` is `false`.
+       * 
+ * + * string suggested_value = 4; + * + * @return The bytes for suggestedValue. + */ + public com.google.protobuf.ByteString getSuggestedValueBytes() { + java.lang.Object ref = suggestedValue_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + suggestedValue_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+       * Optional. The Google Cloud Console will try to default to a configuration
+       * that matches the value specified in this `Policy`. If `suggested_value`
+       * is not set, it will inherit the value specified higher in the hierarchy,
+       * unless `inherit_from_parent` is `false`.
+       * 
+ * + * string suggested_value = 4; + * + * @param value The suggestedValue to set. + * @return This builder for chaining. + */ + public Builder setSuggestedValue(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + suggestedValue_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Optional. The Google Cloud Console will try to default to a configuration
+       * that matches the value specified in this `Policy`. If `suggested_value`
+       * is not set, it will inherit the value specified higher in the hierarchy,
+       * unless `inherit_from_parent` is `false`.
+       * 
+ * + * string suggested_value = 4; + * + * @return This builder for chaining. + */ + public Builder clearSuggestedValue() { + + suggestedValue_ = getDefaultInstance().getSuggestedValue(); + onChanged(); + return this; + } + /** + * + * + *
+       * Optional. The Google Cloud Console will try to default to a configuration
+       * that matches the value specified in this `Policy`. If `suggested_value`
+       * is not set, it will inherit the value specified higher in the hierarchy,
+       * unless `inherit_from_parent` is `false`.
+       * 
+ * + * string suggested_value = 4; + * + * @param value The bytes for suggestedValue to set. + * @return This builder for chaining. + */ + public Builder setSuggestedValueBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + suggestedValue_ = value; + onChanged(); + return this; + } + + private boolean inheritFromParent_; + /** + * + * + *
+       * Determines the inheritance behavior for this `Policy`.
+       * By default, a `ListPolicy` set at a resource supercedes any `Policy` set
+       * anywhere up the resource hierarchy. However, if `inherit_from_parent` is
+       * set to `true`, then the values from the effective `Policy` of the parent
+       * resource are inherited, meaning the values set in this `Policy` are
+       * added to the values inherited up the hierarchy.
+       * Setting `Policy` hierarchies that inherit both allowed values and denied
+       * values isn't recommended in most circumstances to keep the configuration
+       * simple and understandable. However, it is possible to set a `Policy` with
+       * `allowed_values` set that inherits a `Policy` with `denied_values` set.
+       * In this case, the values that are allowed must be in `allowed_values` and
+       * not present in `denied_values`.
+       * For example, suppose you have a `Constraint`
+       * `constraints/serviceuser.services`, which has a `constraint_type` of
+       * `list_constraint`, and with `constraint_default` set to `ALLOW`.
+       * Suppose that at the Organization level, a `Policy` is applied that
+       * restricts the allowed API activations to {`E1`, `E2`}. Then, if a
+       * `Policy` is applied to a project below the Organization that has
+       * `inherit_from_parent` set to `false` and field all_values set to DENY,
+       * then an attempt to activate any API will be denied.
+       * The following examples demonstrate different possible layerings for
+       * `projects/bar` parented by `organizations/foo`:
+       * Example 1 (no inherited values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has `inherit_from_parent` `false` and values:
+       *     {allowed_values: "E3" allowed_values: "E4"}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are `E3`, and `E4`.
+       * Example 2 (inherited values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has a `Policy` with values:
+       *     {value: "E3" value: "E4" inherit_from_parent: true}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`.
+       * Example 3 (inheriting both allowed and denied values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {denied_values: "E1"}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The value accepted at `projects/bar` is `E2`.
+       * Example 4 (RestoreDefault):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has a `Policy` with values:
+       *     {RestoreDefault: {}}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are either all or none depending on
+       * the value of `constraint_default` (if `ALLOW`, all; if
+       * `DENY`, none).
+       * Example 5 (no policy inherits parent policy):
+       *   `organizations/foo` has no `Policy` set.
+       *   `projects/bar` has no `Policy` set.
+       * The accepted values at both levels are either all or none depending on
+       * the value of `constraint_default` (if `ALLOW`, all; if
+       * `DENY`, none).
+       * Example 6 (ListConstraint allowing all):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {all: ALLOW}
+       * The accepted values at `organizations/foo` are `E1`, E2`.
+       * Any value is accepted at `projects/bar`.
+       * Example 7 (ListConstraint allowing none):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {all: DENY}
+       * The accepted values at `organizations/foo` are `E1`, E2`.
+       * No value is accepted at `projects/bar`.
+       * Example 10 (allowed and denied subtrees of Resource Manager hierarchy):
+       * Given the following resource hierarchy
+       *   O1->{F1, F2}; F1->{P1}; F2->{P2, P3},
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "under:organizations/O1"}
+       *   `projects/bar` has a `Policy` with:
+       *     {allowed_values: "under:projects/P3"}
+       *     {denied_values: "under:folders/F2"}
+       * The accepted values at `organizations/foo` are `organizations/O1`,
+       *   `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`,
+       *   `projects/P3`.
+       * The accepted values at `projects/bar` are `organizations/O1`,
+       *   `folders/F1`, `projects/P1`.
+       * 
+ * + * bool inherit_from_parent = 5; + * + * @return The inheritFromParent. + */ + public boolean getInheritFromParent() { + return inheritFromParent_; + } + /** + * + * + *
+       * Determines the inheritance behavior for this `Policy`.
+       * By default, a `ListPolicy` set at a resource supercedes any `Policy` set
+       * anywhere up the resource hierarchy. However, if `inherit_from_parent` is
+       * set to `true`, then the values from the effective `Policy` of the parent
+       * resource are inherited, meaning the values set in this `Policy` are
+       * added to the values inherited up the hierarchy.
+       * Setting `Policy` hierarchies that inherit both allowed values and denied
+       * values isn't recommended in most circumstances to keep the configuration
+       * simple and understandable. However, it is possible to set a `Policy` with
+       * `allowed_values` set that inherits a `Policy` with `denied_values` set.
+       * In this case, the values that are allowed must be in `allowed_values` and
+       * not present in `denied_values`.
+       * For example, suppose you have a `Constraint`
+       * `constraints/serviceuser.services`, which has a `constraint_type` of
+       * `list_constraint`, and with `constraint_default` set to `ALLOW`.
+       * Suppose that at the Organization level, a `Policy` is applied that
+       * restricts the allowed API activations to {`E1`, `E2`}. Then, if a
+       * `Policy` is applied to a project below the Organization that has
+       * `inherit_from_parent` set to `false` and field all_values set to DENY,
+       * then an attempt to activate any API will be denied.
+       * The following examples demonstrate different possible layerings for
+       * `projects/bar` parented by `organizations/foo`:
+       * Example 1 (no inherited values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has `inherit_from_parent` `false` and values:
+       *     {allowed_values: "E3" allowed_values: "E4"}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are `E3`, and `E4`.
+       * Example 2 (inherited values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has a `Policy` with values:
+       *     {value: "E3" value: "E4" inherit_from_parent: true}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`.
+       * Example 3 (inheriting both allowed and denied values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {denied_values: "E1"}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The value accepted at `projects/bar` is `E2`.
+       * Example 4 (RestoreDefault):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has a `Policy` with values:
+       *     {RestoreDefault: {}}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are either all or none depending on
+       * the value of `constraint_default` (if `ALLOW`, all; if
+       * `DENY`, none).
+       * Example 5 (no policy inherits parent policy):
+       *   `organizations/foo` has no `Policy` set.
+       *   `projects/bar` has no `Policy` set.
+       * The accepted values at both levels are either all or none depending on
+       * the value of `constraint_default` (if `ALLOW`, all; if
+       * `DENY`, none).
+       * Example 6 (ListConstraint allowing all):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {all: ALLOW}
+       * The accepted values at `organizations/foo` are `E1`, E2`.
+       * Any value is accepted at `projects/bar`.
+       * Example 7 (ListConstraint allowing none):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {all: DENY}
+       * The accepted values at `organizations/foo` are `E1`, E2`.
+       * No value is accepted at `projects/bar`.
+       * Example 10 (allowed and denied subtrees of Resource Manager hierarchy):
+       * Given the following resource hierarchy
+       *   O1->{F1, F2}; F1->{P1}; F2->{P2, P3},
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "under:organizations/O1"}
+       *   `projects/bar` has a `Policy` with:
+       *     {allowed_values: "under:projects/P3"}
+       *     {denied_values: "under:folders/F2"}
+       * The accepted values at `organizations/foo` are `organizations/O1`,
+       *   `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`,
+       *   `projects/P3`.
+       * The accepted values at `projects/bar` are `organizations/O1`,
+       *   `folders/F1`, `projects/P1`.
+       * 
+ * + * bool inherit_from_parent = 5; + * + * @param value The inheritFromParent to set. + * @return This builder for chaining. + */ + public Builder setInheritFromParent(boolean value) { + + inheritFromParent_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Determines the inheritance behavior for this `Policy`.
+       * By default, a `ListPolicy` set at a resource supercedes any `Policy` set
+       * anywhere up the resource hierarchy. However, if `inherit_from_parent` is
+       * set to `true`, then the values from the effective `Policy` of the parent
+       * resource are inherited, meaning the values set in this `Policy` are
+       * added to the values inherited up the hierarchy.
+       * Setting `Policy` hierarchies that inherit both allowed values and denied
+       * values isn't recommended in most circumstances to keep the configuration
+       * simple and understandable. However, it is possible to set a `Policy` with
+       * `allowed_values` set that inherits a `Policy` with `denied_values` set.
+       * In this case, the values that are allowed must be in `allowed_values` and
+       * not present in `denied_values`.
+       * For example, suppose you have a `Constraint`
+       * `constraints/serviceuser.services`, which has a `constraint_type` of
+       * `list_constraint`, and with `constraint_default` set to `ALLOW`.
+       * Suppose that at the Organization level, a `Policy` is applied that
+       * restricts the allowed API activations to {`E1`, `E2`}. Then, if a
+       * `Policy` is applied to a project below the Organization that has
+       * `inherit_from_parent` set to `false` and field all_values set to DENY,
+       * then an attempt to activate any API will be denied.
+       * The following examples demonstrate different possible layerings for
+       * `projects/bar` parented by `organizations/foo`:
+       * Example 1 (no inherited values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has `inherit_from_parent` `false` and values:
+       *     {allowed_values: "E3" allowed_values: "E4"}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are `E3`, and `E4`.
+       * Example 2 (inherited values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has a `Policy` with values:
+       *     {value: "E3" value: "E4" inherit_from_parent: true}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`.
+       * Example 3 (inheriting both allowed and denied values):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {denied_values: "E1"}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The value accepted at `projects/bar` is `E2`.
+       * Example 4 (RestoreDefault):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values:"E2"}
+       *   `projects/bar` has a `Policy` with values:
+       *     {RestoreDefault: {}}
+       * The accepted values at `organizations/foo` are `E1`, `E2`.
+       * The accepted values at `projects/bar` are either all or none depending on
+       * the value of `constraint_default` (if `ALLOW`, all; if
+       * `DENY`, none).
+       * Example 5 (no policy inherits parent policy):
+       *   `organizations/foo` has no `Policy` set.
+       *   `projects/bar` has no `Policy` set.
+       * The accepted values at both levels are either all or none depending on
+       * the value of `constraint_default` (if `ALLOW`, all; if
+       * `DENY`, none).
+       * Example 6 (ListConstraint allowing all):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {all: ALLOW}
+       * The accepted values at `organizations/foo` are `E1`, E2`.
+       * Any value is accepted at `projects/bar`.
+       * Example 7 (ListConstraint allowing none):
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "E1" allowed_values: "E2"}
+       *   `projects/bar` has a `Policy` with:
+       *     {all: DENY}
+       * The accepted values at `organizations/foo` are `E1`, E2`.
+       * No value is accepted at `projects/bar`.
+       * Example 10 (allowed and denied subtrees of Resource Manager hierarchy):
+       * Given the following resource hierarchy
+       *   O1->{F1, F2}; F1->{P1}; F2->{P2, P3},
+       *   `organizations/foo` has a `Policy` with values:
+       *     {allowed_values: "under:organizations/O1"}
+       *   `projects/bar` has a `Policy` with:
+       *     {allowed_values: "under:projects/P3"}
+       *     {denied_values: "under:folders/F2"}
+       * The accepted values at `organizations/foo` are `organizations/O1`,
+       *   `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`,
+       *   `projects/P3`.
+       * The accepted values at `projects/bar` are `organizations/O1`,
+       *   `folders/F1`, `projects/P1`.
+       * 
+ * + * bool inherit_from_parent = 5; + * + * @return This builder for chaining. + */ + public Builder clearInheritFromParent() { + + inheritFromParent_ = 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.orgpolicy.v1.Policy.ListPolicy) + } + + // @@protoc_insertion_point(class_scope:google.cloud.orgpolicy.v1.Policy.ListPolicy) + private static final com.google.cloud.orgpolicy.v1.Policy.ListPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.orgpolicy.v1.Policy.ListPolicy(); + } + + public static com.google.cloud.orgpolicy.v1.Policy.ListPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListPolicy parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new ListPolicy(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.orgpolicy.v1.Policy.ListPolicy getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface BooleanPolicyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.orgpolicy.v1.Policy.BooleanPolicy) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * If `true`, then the `Policy` is enforced. If `false`, then any
+     * configuration is acceptable.
+     * Suppose you have a `Constraint`
+     * `constraints/compute.disableSerialPortAccess` with `constraint_default`
+     * set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following
+     * behavior:
+     *   - If the `Policy` at this resource has enforced set to `false`, serial
+     *     port connection attempts will be allowed.
+     *   - If the `Policy` at this resource has enforced set to `true`, serial
+     *     port connection attempts will be refused.
+     *   - If the `Policy` at this resource is `RestoreDefault`, serial port
+     *     connection attempts will be allowed.
+     *   - If no `Policy` is set at this resource or anywhere higher in the
+     *     resource hierarchy, serial port connection attempts will be allowed.
+     *   - If no `Policy` is set at this resource, but one exists higher in the
+     *     resource hierarchy, the behavior is as if the`Policy` were set at
+     *     this resource.
+     * The following examples demonstrate the different possible layerings:
+     * Example 1 (nearest `Constraint` wins):
+     *   `organizations/foo` has a `Policy` with:
+     *     {enforced: false}
+     *   `projects/bar` has no `Policy` set.
+     * The constraint at `projects/bar` and `organizations/foo` will not be
+     * enforced.
+     * Example 2 (enforcement gets replaced):
+     *   `organizations/foo` has a `Policy` with:
+     *     {enforced: false}
+     *   `projects/bar` has a `Policy` with:
+     *     {enforced: true}
+     * The constraint at `organizations/foo` is not enforced.
+     * The constraint at `projects/bar` is enforced.
+     * Example 3 (RestoreDefault):
+     *   `organizations/foo` has a `Policy` with:
+     *     {enforced: true}
+     *   `projects/bar` has a `Policy` with:
+     *     {RestoreDefault: {}}
+     * The constraint at `organizations/foo` is enforced.
+     * The constraint at `projects/bar` is not enforced, because
+     * `constraint_default` for the `Constraint` is `ALLOW`.
+     * 
+ * + * bool enforced = 1; + * + * @return The enforced. + */ + boolean getEnforced(); + } + /** + * + * + *
+   * Used in `policy_type` to specify how `boolean_policy` will behave at this
+   * resource.
+   * 
+ * + * Protobuf type {@code google.cloud.orgpolicy.v1.Policy.BooleanPolicy} + */ + public static final class BooleanPolicy extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.orgpolicy.v1.Policy.BooleanPolicy) + BooleanPolicyOrBuilder { + private static final long serialVersionUID = 0L; + // Use BooleanPolicy.newBuilder() to construct. + private BooleanPolicy(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private BooleanPolicy() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new BooleanPolicy(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private BooleanPolicy( + 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: + { + enforced_ = 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.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.class, + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.Builder.class); + } + + public static final int ENFORCED_FIELD_NUMBER = 1; + private boolean enforced_; + /** + * + * + *
+     * If `true`, then the `Policy` is enforced. If `false`, then any
+     * configuration is acceptable.
+     * Suppose you have a `Constraint`
+     * `constraints/compute.disableSerialPortAccess` with `constraint_default`
+     * set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following
+     * behavior:
+     *   - If the `Policy` at this resource has enforced set to `false`, serial
+     *     port connection attempts will be allowed.
+     *   - If the `Policy` at this resource has enforced set to `true`, serial
+     *     port connection attempts will be refused.
+     *   - If the `Policy` at this resource is `RestoreDefault`, serial port
+     *     connection attempts will be allowed.
+     *   - If no `Policy` is set at this resource or anywhere higher in the
+     *     resource hierarchy, serial port connection attempts will be allowed.
+     *   - If no `Policy` is set at this resource, but one exists higher in the
+     *     resource hierarchy, the behavior is as if the`Policy` were set at
+     *     this resource.
+     * The following examples demonstrate the different possible layerings:
+     * Example 1 (nearest `Constraint` wins):
+     *   `organizations/foo` has a `Policy` with:
+     *     {enforced: false}
+     *   `projects/bar` has no `Policy` set.
+     * The constraint at `projects/bar` and `organizations/foo` will not be
+     * enforced.
+     * Example 2 (enforcement gets replaced):
+     *   `organizations/foo` has a `Policy` with:
+     *     {enforced: false}
+     *   `projects/bar` has a `Policy` with:
+     *     {enforced: true}
+     * The constraint at `organizations/foo` is not enforced.
+     * The constraint at `projects/bar` is enforced.
+     * Example 3 (RestoreDefault):
+     *   `organizations/foo` has a `Policy` with:
+     *     {enforced: true}
+     *   `projects/bar` has a `Policy` with:
+     *     {RestoreDefault: {}}
+     * The constraint at `organizations/foo` is enforced.
+     * The constraint at `projects/bar` is not enforced, because
+     * `constraint_default` for the `Constraint` is `ALLOW`.
+     * 
+ * + * bool enforced = 1; + * + * @return The enforced. + */ + public boolean getEnforced() { + return enforced_; + } + + 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 (enforced_ != false) { + output.writeBool(1, enforced_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (enforced_ != false) { + size += com.google.protobuf.CodedOutputStream.computeBoolSize(1, enforced_); + } + 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.orgpolicy.v1.Policy.BooleanPolicy)) { + return super.equals(obj); + } + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy other = + (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) obj; + + if (getEnforced() != other.getEnforced()) 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) + ENFORCED_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getEnforced()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy 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.orgpolicy.v1.Policy.BooleanPolicy parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy 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.orgpolicy.v1.Policy.BooleanPolicy parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy 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.orgpolicy.v1.Policy.BooleanPolicy parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy 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.orgpolicy.v1.Policy.BooleanPolicy parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy 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.orgpolicy.v1.Policy.BooleanPolicy 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; + } + /** + * + * + *
+     * Used in `policy_type` to specify how `boolean_policy` will behave at this
+     * resource.
+     * 
+ * + * Protobuf type {@code google.cloud.orgpolicy.v1.Policy.BooleanPolicy} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.orgpolicy.v1.Policy.BooleanPolicy) + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.class, + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.Builder.class); + } + + // Construct using com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.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(); + enforced_ = false; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_BooleanPolicy_descriptor; + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy getDefaultInstanceForType() { + return com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy build() { + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy buildPartial() { + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy result = + new com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy(this); + result.enforced_ = enforced_; + 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.orgpolicy.v1.Policy.BooleanPolicy) { + return mergeFrom((com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy other) { + if (other == com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance()) + return this; + if (other.getEnforced() != false) { + setEnforced(other.getEnforced()); + } + 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.orgpolicy.v1.Policy.BooleanPolicy parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private boolean enforced_; + /** + * + * + *
+       * If `true`, then the `Policy` is enforced. If `false`, then any
+       * configuration is acceptable.
+       * Suppose you have a `Constraint`
+       * `constraints/compute.disableSerialPortAccess` with `constraint_default`
+       * set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following
+       * behavior:
+       *   - If the `Policy` at this resource has enforced set to `false`, serial
+       *     port connection attempts will be allowed.
+       *   - If the `Policy` at this resource has enforced set to `true`, serial
+       *     port connection attempts will be refused.
+       *   - If the `Policy` at this resource is `RestoreDefault`, serial port
+       *     connection attempts will be allowed.
+       *   - If no `Policy` is set at this resource or anywhere higher in the
+       *     resource hierarchy, serial port connection attempts will be allowed.
+       *   - If no `Policy` is set at this resource, but one exists higher in the
+       *     resource hierarchy, the behavior is as if the`Policy` were set at
+       *     this resource.
+       * The following examples demonstrate the different possible layerings:
+       * Example 1 (nearest `Constraint` wins):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: false}
+       *   `projects/bar` has no `Policy` set.
+       * The constraint at `projects/bar` and `organizations/foo` will not be
+       * enforced.
+       * Example 2 (enforcement gets replaced):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: false}
+       *   `projects/bar` has a `Policy` with:
+       *     {enforced: true}
+       * The constraint at `organizations/foo` is not enforced.
+       * The constraint at `projects/bar` is enforced.
+       * Example 3 (RestoreDefault):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: true}
+       *   `projects/bar` has a `Policy` with:
+       *     {RestoreDefault: {}}
+       * The constraint at `organizations/foo` is enforced.
+       * The constraint at `projects/bar` is not enforced, because
+       * `constraint_default` for the `Constraint` is `ALLOW`.
+       * 
+ * + * bool enforced = 1; + * + * @return The enforced. + */ + public boolean getEnforced() { + return enforced_; + } + /** + * + * + *
+       * If `true`, then the `Policy` is enforced. If `false`, then any
+       * configuration is acceptable.
+       * Suppose you have a `Constraint`
+       * `constraints/compute.disableSerialPortAccess` with `constraint_default`
+       * set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following
+       * behavior:
+       *   - If the `Policy` at this resource has enforced set to `false`, serial
+       *     port connection attempts will be allowed.
+       *   - If the `Policy` at this resource has enforced set to `true`, serial
+       *     port connection attempts will be refused.
+       *   - If the `Policy` at this resource is `RestoreDefault`, serial port
+       *     connection attempts will be allowed.
+       *   - If no `Policy` is set at this resource or anywhere higher in the
+       *     resource hierarchy, serial port connection attempts will be allowed.
+       *   - If no `Policy` is set at this resource, but one exists higher in the
+       *     resource hierarchy, the behavior is as if the`Policy` were set at
+       *     this resource.
+       * The following examples demonstrate the different possible layerings:
+       * Example 1 (nearest `Constraint` wins):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: false}
+       *   `projects/bar` has no `Policy` set.
+       * The constraint at `projects/bar` and `organizations/foo` will not be
+       * enforced.
+       * Example 2 (enforcement gets replaced):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: false}
+       *   `projects/bar` has a `Policy` with:
+       *     {enforced: true}
+       * The constraint at `organizations/foo` is not enforced.
+       * The constraint at `projects/bar` is enforced.
+       * Example 3 (RestoreDefault):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: true}
+       *   `projects/bar` has a `Policy` with:
+       *     {RestoreDefault: {}}
+       * The constraint at `organizations/foo` is enforced.
+       * The constraint at `projects/bar` is not enforced, because
+       * `constraint_default` for the `Constraint` is `ALLOW`.
+       * 
+ * + * bool enforced = 1; + * + * @param value The enforced to set. + * @return This builder for chaining. + */ + public Builder setEnforced(boolean value) { + + enforced_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * If `true`, then the `Policy` is enforced. If `false`, then any
+       * configuration is acceptable.
+       * Suppose you have a `Constraint`
+       * `constraints/compute.disableSerialPortAccess` with `constraint_default`
+       * set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following
+       * behavior:
+       *   - If the `Policy` at this resource has enforced set to `false`, serial
+       *     port connection attempts will be allowed.
+       *   - If the `Policy` at this resource has enforced set to `true`, serial
+       *     port connection attempts will be refused.
+       *   - If the `Policy` at this resource is `RestoreDefault`, serial port
+       *     connection attempts will be allowed.
+       *   - If no `Policy` is set at this resource or anywhere higher in the
+       *     resource hierarchy, serial port connection attempts will be allowed.
+       *   - If no `Policy` is set at this resource, but one exists higher in the
+       *     resource hierarchy, the behavior is as if the`Policy` were set at
+       *     this resource.
+       * The following examples demonstrate the different possible layerings:
+       * Example 1 (nearest `Constraint` wins):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: false}
+       *   `projects/bar` has no `Policy` set.
+       * The constraint at `projects/bar` and `organizations/foo` will not be
+       * enforced.
+       * Example 2 (enforcement gets replaced):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: false}
+       *   `projects/bar` has a `Policy` with:
+       *     {enforced: true}
+       * The constraint at `organizations/foo` is not enforced.
+       * The constraint at `projects/bar` is enforced.
+       * Example 3 (RestoreDefault):
+       *   `organizations/foo` has a `Policy` with:
+       *     {enforced: true}
+       *   `projects/bar` has a `Policy` with:
+       *     {RestoreDefault: {}}
+       * The constraint at `organizations/foo` is enforced.
+       * The constraint at `projects/bar` is not enforced, because
+       * `constraint_default` for the `Constraint` is `ALLOW`.
+       * 
+ * + * bool enforced = 1; + * + * @return This builder for chaining. + */ + public Builder clearEnforced() { + + enforced_ = 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.orgpolicy.v1.Policy.BooleanPolicy) + } + + // @@protoc_insertion_point(class_scope:google.cloud.orgpolicy.v1.Policy.BooleanPolicy) + private static final com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy(); + } + + public static com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public BooleanPolicy parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new BooleanPolicy(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.orgpolicy.v1.Policy.BooleanPolicy getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface RestoreDefaultOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.orgpolicy.v1.Policy.RestoreDefault) + com.google.protobuf.MessageOrBuilder {} + /** + * + * + *
+   * Ignores policies set above this resource and restores the
+   * `constraint_default` enforcement behavior of the specific `Constraint` at
+   * this resource.
+   * Suppose that `constraint_default` is set to `ALLOW` for the
+   * `Constraint` `constraints/serviceuser.services`. Suppose that organization
+   * foo.com sets a `Policy` at their Organization resource node that restricts
+   * the allowed service activations to deny all service activations. They
+   * could then set a `Policy` with the `policy_type` `restore_default` on
+   * several experimental projects, restoring the `constraint_default`
+   * enforcement of the `Constraint` for only those projects, allowing those
+   * projects to have all services activated.
+   * 
+ * + * Protobuf type {@code google.cloud.orgpolicy.v1.Policy.RestoreDefault} + */ + public static final class RestoreDefault extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.orgpolicy.v1.Policy.RestoreDefault) + RestoreDefaultOrBuilder { + private static final long serialVersionUID = 0L; + // Use RestoreDefault.newBuilder() to construct. + private RestoreDefault(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private RestoreDefault() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new RestoreDefault(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet getUnknownFields() { + return this.unknownFields; + } + + private RestoreDefault( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: + { + if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.class, + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.Builder.class); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.orgpolicy.v1.Policy.RestoreDefault)) { + return super.equals(obj); + } + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault other = + (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) obj; + + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault 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.orgpolicy.v1.Policy.RestoreDefault parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault 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.orgpolicy.v1.Policy.RestoreDefault parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault 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.orgpolicy.v1.Policy.RestoreDefault parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault 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.orgpolicy.v1.Policy.RestoreDefault parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault 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.orgpolicy.v1.Policy.RestoreDefault 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; + } + /** + * + * + *
+     * Ignores policies set above this resource and restores the
+     * `constraint_default` enforcement behavior of the specific `Constraint` at
+     * this resource.
+     * Suppose that `constraint_default` is set to `ALLOW` for the
+     * `Constraint` `constraints/serviceuser.services`. Suppose that organization
+     * foo.com sets a `Policy` at their Organization resource node that restricts
+     * the allowed service activations to deny all service activations. They
+     * could then set a `Policy` with the `policy_type` `restore_default` on
+     * several experimental projects, restoring the `constraint_default`
+     * enforcement of the `Constraint` for only those projects, allowing those
+     * projects to have all services activated.
+     * 
+ * + * Protobuf type {@code google.cloud.orgpolicy.v1.Policy.RestoreDefault} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.orgpolicy.v1.Policy.RestoreDefault) + com.google.cloud.orgpolicy.v1.Policy.RestoreDefaultOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.class, + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.Builder.class); + } + + // Construct using com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} + } + + @java.lang.Override + public Builder clear() { + super.clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_RestoreDefault_descriptor; + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.RestoreDefault getDefaultInstanceForType() { + return com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.RestoreDefault build() { + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy.RestoreDefault buildPartial() { + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault result = + new com.google.cloud.orgpolicy.v1.Policy.RestoreDefault(this); + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) { + return mergeFrom((com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.orgpolicy.v1.Policy.RestoreDefault other) { + if (other == com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance()) + return this; + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = + (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.orgpolicy.v1.Policy.RestoreDefault) + } + + // @@protoc_insertion_point(class_scope:google.cloud.orgpolicy.v1.Policy.RestoreDefault) + private static final com.google.cloud.orgpolicy.v1.Policy.RestoreDefault DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.orgpolicy.v1.Policy.RestoreDefault(); + } + + public static com.google.cloud.orgpolicy.v1.Policy.RestoreDefault getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public RestoreDefault parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new RestoreDefault(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.orgpolicy.v1.Policy.RestoreDefault getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int policyTypeCase_ = 0; + private java.lang.Object policyType_; + + public enum PolicyTypeCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + LIST_POLICY(5), + BOOLEAN_POLICY(6), + RESTORE_DEFAULT(7), + POLICYTYPE_NOT_SET(0); + private final int value; + + private PolicyTypeCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static PolicyTypeCase valueOf(int value) { + return forNumber(value); + } + + public static PolicyTypeCase forNumber(int value) { + switch (value) { + case 5: + return LIST_POLICY; + case 6: + return BOOLEAN_POLICY; + case 7: + return RESTORE_DEFAULT; + case 0: + return POLICYTYPE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public PolicyTypeCase getPolicyTypeCase() { + return PolicyTypeCase.forNumber(policyTypeCase_); + } + + public static final int VERSION_FIELD_NUMBER = 1; + private int version_; + /** + * + * + *
+   * Version of the `Policy`. Default version is 0;
+   * 
+ * + * int32 version = 1; + * + * @return The version. + */ + public int getVersion() { + return version_; + } + + public static final int CONSTRAINT_FIELD_NUMBER = 2; + private volatile java.lang.Object constraint_; + /** + * + * + *
+   * The name of the `Constraint` the `Policy` is configuring, for example,
+   * `constraints/serviceuser.services`.
+   * Immutable after creation.
+   * 
+ * + * string constraint = 2; + * + * @return The constraint. + */ + public java.lang.String getConstraint() { + java.lang.Object ref = constraint_; + 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(); + constraint_ = s; + return s; + } + } + /** + * + * + *
+   * The name of the `Constraint` the `Policy` is configuring, for example,
+   * `constraints/serviceuser.services`.
+   * Immutable after creation.
+   * 
+ * + * string constraint = 2; + * + * @return The bytes for constraint. + */ + public com.google.protobuf.ByteString getConstraintBytes() { + java.lang.Object ref = constraint_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + constraint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int ETAG_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString etag_; + /** + * + * + *
+   * An opaque tag indicating the current version of the `Policy`, used for
+   * concurrency control.
+   * When the `Policy` is returned from either a `GetPolicy` or a
+   * `ListOrgPolicy` request, this `etag` indicates the version of the current
+   * `Policy` to use when executing a read-modify-write loop.
+   * When the `Policy` is returned from a `GetEffectivePolicy` request, the
+   * `etag` will be unset.
+   * When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value
+   * that was returned from a `GetOrgPolicy` request as part of a
+   * read-modify-write loop for concurrency control. Not setting the `etag`in a
+   * `SetOrgPolicy` request will result in an unconditional write of the
+   * `Policy`.
+   * 
+ * + * bytes etag = 3; + * + * @return The etag. + */ + public com.google.protobuf.ByteString getEtag() { + return etag_; + } + + public static final int UPDATE_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp updateTime_; + /** + * + * + *
+   * The time stamp the `Policy` was previously updated. This is set by the
+   * server, not specified by the caller, and represents the last time a call to
+   * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+   * be ignored.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTime_ != null; + } + /** + * + * + *
+   * The time stamp the `Policy` was previously updated. This is set by the
+   * server, not specified by the caller, and represents the last time a call to
+   * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+   * be ignored.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + return updateTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : updateTime_; + } + /** + * + * + *
+   * The time stamp the `Policy` was previously updated. This is set by the
+   * server, not specified by the caller, and represents the last time a call to
+   * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+   * be ignored.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + return getUpdateTime(); + } + + public static final int LIST_POLICY_FIELD_NUMBER = 5; + /** + * + * + *
+   * List of values either allowed or disallowed.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + * + * @return Whether the listPolicy field is set. + */ + public boolean hasListPolicy() { + return policyTypeCase_ == 5; + } + /** + * + * + *
+   * List of values either allowed or disallowed.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + * + * @return The listPolicy. + */ + public com.google.cloud.orgpolicy.v1.Policy.ListPolicy getListPolicy() { + if (policyTypeCase_ == 5) { + return (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance(); + } + /** + * + * + *
+   * List of values either allowed or disallowed.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + public com.google.cloud.orgpolicy.v1.Policy.ListPolicyOrBuilder getListPolicyOrBuilder() { + if (policyTypeCase_ == 5) { + return (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance(); + } + + public static final int BOOLEAN_POLICY_FIELD_NUMBER = 6; + /** + * + * + *
+   * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + * + * @return Whether the booleanPolicy field is set. + */ + public boolean hasBooleanPolicy() { + return policyTypeCase_ == 6; + } + /** + * + * + *
+   * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + * + * @return The booleanPolicy. + */ + public com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy getBooleanPolicy() { + if (policyTypeCase_ == 6) { + return (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance(); + } + /** + * + * + *
+   * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + public com.google.cloud.orgpolicy.v1.Policy.BooleanPolicyOrBuilder getBooleanPolicyOrBuilder() { + if (policyTypeCase_ == 6) { + return (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance(); + } + + public static final int RESTORE_DEFAULT_FIELD_NUMBER = 7; + /** + * + * + *
+   * Restores the default behavior of the constraint; independent of
+   * `Constraint` type.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + * + * @return Whether the restoreDefault field is set. + */ + public boolean hasRestoreDefault() { + return policyTypeCase_ == 7; + } + /** + * + * + *
+   * Restores the default behavior of the constraint; independent of
+   * `Constraint` type.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + * + * @return The restoreDefault. + */ + public com.google.cloud.orgpolicy.v1.Policy.RestoreDefault getRestoreDefault() { + if (policyTypeCase_ == 7) { + return (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance(); + } + /** + * + * + *
+   * Restores the default behavior of the constraint; independent of
+   * `Constraint` type.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + public com.google.cloud.orgpolicy.v1.Policy.RestoreDefaultOrBuilder getRestoreDefaultOrBuilder() { + if (policyTypeCase_ == 7) { + return (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance(); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (version_ != 0) { + output.writeInt32(1, version_); + } + if (!getConstraintBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, constraint_); + } + if (!etag_.isEmpty()) { + output.writeBytes(3, etag_); + } + if (updateTime_ != null) { + output.writeMessage(4, getUpdateTime()); + } + if (policyTypeCase_ == 5) { + output.writeMessage(5, (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_); + } + if (policyTypeCase_ == 6) { + output.writeMessage(6, (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_); + } + if (policyTypeCase_ == 7) { + output.writeMessage(7, (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (version_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(1, version_); + } + if (!getConstraintBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, constraint_); + } + if (!etag_.isEmpty()) { + size += com.google.protobuf.CodedOutputStream.computeBytesSize(3, etag_); + } + if (updateTime_ != null) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getUpdateTime()); + } + if (policyTypeCase_ == 5) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 5, (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_); + } + if (policyTypeCase_ == 6) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 6, (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_); + } + if (policyTypeCase_ == 7) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 7, (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_); + } + 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.orgpolicy.v1.Policy)) { + return super.equals(obj); + } + com.google.cloud.orgpolicy.v1.Policy other = (com.google.cloud.orgpolicy.v1.Policy) obj; + + if (getVersion() != other.getVersion()) return false; + if (!getConstraint().equals(other.getConstraint())) return false; + if (!getEtag().equals(other.getEtag())) return false; + if (hasUpdateTime() != other.hasUpdateTime()) return false; + if (hasUpdateTime()) { + if (!getUpdateTime().equals(other.getUpdateTime())) return false; + } + if (!getPolicyTypeCase().equals(other.getPolicyTypeCase())) return false; + switch (policyTypeCase_) { + case 5: + if (!getListPolicy().equals(other.getListPolicy())) return false; + break; + case 6: + if (!getBooleanPolicy().equals(other.getBooleanPolicy())) return false; + break; + case 7: + if (!getRestoreDefault().equals(other.getRestoreDefault())) return false; + break; + case 0: + default: + } + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + VERSION_FIELD_NUMBER; + hash = (53 * hash) + getVersion(); + hash = (37 * hash) + CONSTRAINT_FIELD_NUMBER; + hash = (53 * hash) + getConstraint().hashCode(); + hash = (37 * hash) + ETAG_FIELD_NUMBER; + hash = (53 * hash) + getEtag().hashCode(); + if (hasUpdateTime()) { + hash = (37 * hash) + UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getUpdateTime().hashCode(); + } + switch (policyTypeCase_) { + case 5: + hash = (37 * hash) + LIST_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getListPolicy().hashCode(); + break; + case 6: + hash = (37 * hash) + BOOLEAN_POLICY_FIELD_NUMBER; + hash = (53 * hash) + getBooleanPolicy().hashCode(); + break; + case 7: + hash = (37 * hash) + RESTORE_DEFAULT_FIELD_NUMBER; + hash = (53 * hash) + getRestoreDefault().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.orgpolicy.v1.Policy parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy 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.orgpolicy.v1.Policy parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy 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.orgpolicy.v1.Policy parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.orgpolicy.v1.Policy parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.orgpolicy.v1.Policy parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy 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.orgpolicy.v1.Policy parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy 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.orgpolicy.v1.Policy parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.orgpolicy.v1.Policy 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.orgpolicy.v1.Policy 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; + } + /** + * + * + *
+   * Defines a Cloud Organization `Policy` which is used to specify `Constraints`
+   * for configurations of Cloud Platform resources.
+   * 
+ * + * Protobuf type {@code google.cloud.orgpolicy.v1.Policy} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.orgpolicy.v1.Policy) + com.google.cloud.orgpolicy.v1.PolicyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.orgpolicy.v1.Policy.class, + com.google.cloud.orgpolicy.v1.Policy.Builder.class); + } + + // Construct using com.google.cloud.orgpolicy.v1.Policy.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(); + version_ = 0; + + constraint_ = ""; + + etag_ = com.google.protobuf.ByteString.EMPTY; + + if (updateTimeBuilder_ == null) { + updateTime_ = null; + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + policyTypeCase_ = 0; + policyType_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.orgpolicy.v1.OrgPolicyProto + .internal_static_google_cloud_orgpolicy_v1_Policy_descriptor; + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy getDefaultInstanceForType() { + return com.google.cloud.orgpolicy.v1.Policy.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy build() { + com.google.cloud.orgpolicy.v1.Policy result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.orgpolicy.v1.Policy buildPartial() { + com.google.cloud.orgpolicy.v1.Policy result = new com.google.cloud.orgpolicy.v1.Policy(this); + result.version_ = version_; + result.constraint_ = constraint_; + result.etag_ = etag_; + if (updateTimeBuilder_ == null) { + result.updateTime_ = updateTime_; + } else { + result.updateTime_ = updateTimeBuilder_.build(); + } + if (policyTypeCase_ == 5) { + if (listPolicyBuilder_ == null) { + result.policyType_ = policyType_; + } else { + result.policyType_ = listPolicyBuilder_.build(); + } + } + if (policyTypeCase_ == 6) { + if (booleanPolicyBuilder_ == null) { + result.policyType_ = policyType_; + } else { + result.policyType_ = booleanPolicyBuilder_.build(); + } + } + if (policyTypeCase_ == 7) { + if (restoreDefaultBuilder_ == null) { + result.policyType_ = policyType_; + } else { + result.policyType_ = restoreDefaultBuilder_.build(); + } + } + result.policyTypeCase_ = policyTypeCase_; + 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.orgpolicy.v1.Policy) { + return mergeFrom((com.google.cloud.orgpolicy.v1.Policy) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.orgpolicy.v1.Policy other) { + if (other == com.google.cloud.orgpolicy.v1.Policy.getDefaultInstance()) return this; + if (other.getVersion() != 0) { + setVersion(other.getVersion()); + } + if (!other.getConstraint().isEmpty()) { + constraint_ = other.constraint_; + onChanged(); + } + if (other.getEtag() != com.google.protobuf.ByteString.EMPTY) { + setEtag(other.getEtag()); + } + if (other.hasUpdateTime()) { + mergeUpdateTime(other.getUpdateTime()); + } + switch (other.getPolicyTypeCase()) { + case LIST_POLICY: + { + mergeListPolicy(other.getListPolicy()); + break; + } + case BOOLEAN_POLICY: + { + mergeBooleanPolicy(other.getBooleanPolicy()); + break; + } + case RESTORE_DEFAULT: + { + mergeRestoreDefault(other.getRestoreDefault()); + break; + } + case POLICYTYPE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.cloud.orgpolicy.v1.Policy parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (com.google.cloud.orgpolicy.v1.Policy) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int policyTypeCase_ = 0; + private java.lang.Object policyType_; + + public PolicyTypeCase getPolicyTypeCase() { + return PolicyTypeCase.forNumber(policyTypeCase_); + } + + public Builder clearPolicyType() { + policyTypeCase_ = 0; + policyType_ = null; + onChanged(); + return this; + } + + private int version_; + /** + * + * + *
+     * Version of the `Policy`. Default version is 0;
+     * 
+ * + * int32 version = 1; + * + * @return The version. + */ + public int getVersion() { + return version_; + } + /** + * + * + *
+     * Version of the `Policy`. Default version is 0;
+     * 
+ * + * int32 version = 1; + * + * @param value The version to set. + * @return This builder for chaining. + */ + public Builder setVersion(int value) { + + version_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * Version of the `Policy`. Default version is 0;
+     * 
+ * + * int32 version = 1; + * + * @return This builder for chaining. + */ + public Builder clearVersion() { + + version_ = 0; + onChanged(); + return this; + } + + private java.lang.Object constraint_ = ""; + /** + * + * + *
+     * The name of the `Constraint` the `Policy` is configuring, for example,
+     * `constraints/serviceuser.services`.
+     * Immutable after creation.
+     * 
+ * + * string constraint = 2; + * + * @return The constraint. + */ + public java.lang.String getConstraint() { + java.lang.Object ref = constraint_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + constraint_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The name of the `Constraint` the `Policy` is configuring, for example,
+     * `constraints/serviceuser.services`.
+     * Immutable after creation.
+     * 
+ * + * string constraint = 2; + * + * @return The bytes for constraint. + */ + public com.google.protobuf.ByteString getConstraintBytes() { + java.lang.Object ref = constraint_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + constraint_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The name of the `Constraint` the `Policy` is configuring, for example,
+     * `constraints/serviceuser.services`.
+     * Immutable after creation.
+     * 
+ * + * string constraint = 2; + * + * @param value The constraint to set. + * @return This builder for chaining. + */ + public Builder setConstraint(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + constraint_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the `Constraint` the `Policy` is configuring, for example,
+     * `constraints/serviceuser.services`.
+     * Immutable after creation.
+     * 
+ * + * string constraint = 2; + * + * @return This builder for chaining. + */ + public Builder clearConstraint() { + + constraint_ = getDefaultInstance().getConstraint(); + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the `Constraint` the `Policy` is configuring, for example,
+     * `constraints/serviceuser.services`.
+     * Immutable after creation.
+     * 
+ * + * string constraint = 2; + * + * @param value The bytes for constraint to set. + * @return This builder for chaining. + */ + public Builder setConstraintBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + constraint_ = value; + onChanged(); + return this; + } + + private com.google.protobuf.ByteString etag_ = com.google.protobuf.ByteString.EMPTY; + /** + * + * + *
+     * An opaque tag indicating the current version of the `Policy`, used for
+     * concurrency control.
+     * When the `Policy` is returned from either a `GetPolicy` or a
+     * `ListOrgPolicy` request, this `etag` indicates the version of the current
+     * `Policy` to use when executing a read-modify-write loop.
+     * When the `Policy` is returned from a `GetEffectivePolicy` request, the
+     * `etag` will be unset.
+     * When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value
+     * that was returned from a `GetOrgPolicy` request as part of a
+     * read-modify-write loop for concurrency control. Not setting the `etag`in a
+     * `SetOrgPolicy` request will result in an unconditional write of the
+     * `Policy`.
+     * 
+ * + * bytes etag = 3; + * + * @return The etag. + */ + public com.google.protobuf.ByteString getEtag() { + return etag_; + } + /** + * + * + *
+     * An opaque tag indicating the current version of the `Policy`, used for
+     * concurrency control.
+     * When the `Policy` is returned from either a `GetPolicy` or a
+     * `ListOrgPolicy` request, this `etag` indicates the version of the current
+     * `Policy` to use when executing a read-modify-write loop.
+     * When the `Policy` is returned from a `GetEffectivePolicy` request, the
+     * `etag` will be unset.
+     * When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value
+     * that was returned from a `GetOrgPolicy` request as part of a
+     * read-modify-write loop for concurrency control. Not setting the `etag`in a
+     * `SetOrgPolicy` request will result in an unconditional write of the
+     * `Policy`.
+     * 
+ * + * bytes etag = 3; + * + * @param value The etag to set. + * @return This builder for chaining. + */ + public Builder setEtag(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + + etag_ = value; + onChanged(); + return this; + } + /** + * + * + *
+     * An opaque tag indicating the current version of the `Policy`, used for
+     * concurrency control.
+     * When the `Policy` is returned from either a `GetPolicy` or a
+     * `ListOrgPolicy` request, this `etag` indicates the version of the current
+     * `Policy` to use when executing a read-modify-write loop.
+     * When the `Policy` is returned from a `GetEffectivePolicy` request, the
+     * `etag` will be unset.
+     * When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value
+     * that was returned from a `GetOrgPolicy` request as part of a
+     * read-modify-write loop for concurrency control. Not setting the `etag`in a
+     * `SetOrgPolicy` request will result in an unconditional write of the
+     * `Policy`.
+     * 
+ * + * bytes etag = 3; + * + * @return This builder for chaining. + */ + public Builder clearEtag() { + + etag_ = getDefaultInstance().getEtag(); + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp updateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + updateTimeBuilder_; + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return Whether the updateTime field is set. + */ + public boolean hasUpdateTime() { + return updateTimeBuilder_ != null || updateTime_ != null; + } + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return The updateTime. + */ + public com.google.protobuf.Timestamp getUpdateTime() { + if (updateTimeBuilder_ == null) { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } else { + return updateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateTime_ = value; + onChanged(); + } else { + updateTimeBuilder_.setMessage(value); + } + + return this; + } + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public Builder setUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (updateTimeBuilder_ == null) { + updateTime_ = builderForValue.build(); + onChanged(); + } else { + updateTimeBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public Builder mergeUpdateTime(com.google.protobuf.Timestamp value) { + if (updateTimeBuilder_ == null) { + if (updateTime_ != null) { + updateTime_ = + com.google.protobuf.Timestamp.newBuilder(updateTime_).mergeFrom(value).buildPartial(); + } else { + updateTime_ = value; + } + onChanged(); + } else { + updateTimeBuilder_.mergeFrom(value); + } + + return this; + } + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public Builder clearUpdateTime() { + if (updateTimeBuilder_ == null) { + updateTime_ = null; + onChanged(); + } else { + updateTime_ = null; + updateTimeBuilder_ = null; + } + + return this; + } + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public com.google.protobuf.Timestamp.Builder getUpdateTimeBuilder() { + + onChanged(); + return getUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder() { + if (updateTimeBuilder_ != null) { + return updateTimeBuilder_.getMessageOrBuilder(); + } else { + return updateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : updateTime_; + } + } + /** + * + * + *
+     * The time stamp the `Policy` was previously updated. This is set by the
+     * server, not specified by the caller, and represents the last time a call to
+     * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+     * be ignored.
+     * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getUpdateTimeFieldBuilder() { + if (updateTimeBuilder_ == null) { + updateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getUpdateTime(), getParentForChildren(), isClean()); + updateTime_ = null; + } + return updateTimeBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.ListPolicy, + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.Builder, + com.google.cloud.orgpolicy.v1.Policy.ListPolicyOrBuilder> + listPolicyBuilder_; + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + * + * @return Whether the listPolicy field is set. + */ + public boolean hasListPolicy() { + return policyTypeCase_ == 5; + } + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + * + * @return The listPolicy. + */ + public com.google.cloud.orgpolicy.v1.Policy.ListPolicy getListPolicy() { + if (listPolicyBuilder_ == null) { + if (policyTypeCase_ == 5) { + return (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance(); + } else { + if (policyTypeCase_ == 5) { + return listPolicyBuilder_.getMessage(); + } + return com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance(); + } + } + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + public Builder setListPolicy(com.google.cloud.orgpolicy.v1.Policy.ListPolicy value) { + if (listPolicyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + policyType_ = value; + onChanged(); + } else { + listPolicyBuilder_.setMessage(value); + } + policyTypeCase_ = 5; + return this; + } + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + public Builder setListPolicy( + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.Builder builderForValue) { + if (listPolicyBuilder_ == null) { + policyType_ = builderForValue.build(); + onChanged(); + } else { + listPolicyBuilder_.setMessage(builderForValue.build()); + } + policyTypeCase_ = 5; + return this; + } + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + public Builder mergeListPolicy(com.google.cloud.orgpolicy.v1.Policy.ListPolicy value) { + if (listPolicyBuilder_ == null) { + if (policyTypeCase_ == 5 + && policyType_ + != com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance()) { + policyType_ = + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.newBuilder( + (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_) + .mergeFrom(value) + .buildPartial(); + } else { + policyType_ = value; + } + onChanged(); + } else { + if (policyTypeCase_ == 5) { + listPolicyBuilder_.mergeFrom(value); + } + listPolicyBuilder_.setMessage(value); + } + policyTypeCase_ = 5; + return this; + } + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + public Builder clearListPolicy() { + if (listPolicyBuilder_ == null) { + if (policyTypeCase_ == 5) { + policyTypeCase_ = 0; + policyType_ = null; + onChanged(); + } + } else { + if (policyTypeCase_ == 5) { + policyTypeCase_ = 0; + policyType_ = null; + } + listPolicyBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + public com.google.cloud.orgpolicy.v1.Policy.ListPolicy.Builder getListPolicyBuilder() { + return getListPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + public com.google.cloud.orgpolicy.v1.Policy.ListPolicyOrBuilder getListPolicyOrBuilder() { + if ((policyTypeCase_ == 5) && (listPolicyBuilder_ != null)) { + return listPolicyBuilder_.getMessageOrBuilder(); + } else { + if (policyTypeCase_ == 5) { + return (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance(); + } + } + /** + * + * + *
+     * List of values either allowed or disallowed.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.ListPolicy, + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.Builder, + com.google.cloud.orgpolicy.v1.Policy.ListPolicyOrBuilder> + getListPolicyFieldBuilder() { + if (listPolicyBuilder_ == null) { + if (!(policyTypeCase_ == 5)) { + policyType_ = com.google.cloud.orgpolicy.v1.Policy.ListPolicy.getDefaultInstance(); + } + listPolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.ListPolicy, + com.google.cloud.orgpolicy.v1.Policy.ListPolicy.Builder, + com.google.cloud.orgpolicy.v1.Policy.ListPolicyOrBuilder>( + (com.google.cloud.orgpolicy.v1.Policy.ListPolicy) policyType_, + getParentForChildren(), + isClean()); + policyType_ = null; + } + policyTypeCase_ = 5; + onChanged(); + ; + return listPolicyBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy, + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.Builder, + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicyOrBuilder> + booleanPolicyBuilder_; + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + * + * @return Whether the booleanPolicy field is set. + */ + public boolean hasBooleanPolicy() { + return policyTypeCase_ == 6; + } + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + * + * @return The booleanPolicy. + */ + public com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy getBooleanPolicy() { + if (booleanPolicyBuilder_ == null) { + if (policyTypeCase_ == 6) { + return (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance(); + } else { + if (policyTypeCase_ == 6) { + return booleanPolicyBuilder_.getMessage(); + } + return com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance(); + } + } + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + public Builder setBooleanPolicy(com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy value) { + if (booleanPolicyBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + policyType_ = value; + onChanged(); + } else { + booleanPolicyBuilder_.setMessage(value); + } + policyTypeCase_ = 6; + return this; + } + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + public Builder setBooleanPolicy( + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.Builder builderForValue) { + if (booleanPolicyBuilder_ == null) { + policyType_ = builderForValue.build(); + onChanged(); + } else { + booleanPolicyBuilder_.setMessage(builderForValue.build()); + } + policyTypeCase_ = 6; + return this; + } + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + public Builder mergeBooleanPolicy(com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy value) { + if (booleanPolicyBuilder_ == null) { + if (policyTypeCase_ == 6 + && policyType_ + != com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance()) { + policyType_ = + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.newBuilder( + (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_) + .mergeFrom(value) + .buildPartial(); + } else { + policyType_ = value; + } + onChanged(); + } else { + if (policyTypeCase_ == 6) { + booleanPolicyBuilder_.mergeFrom(value); + } + booleanPolicyBuilder_.setMessage(value); + } + policyTypeCase_ = 6; + return this; + } + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + public Builder clearBooleanPolicy() { + if (booleanPolicyBuilder_ == null) { + if (policyTypeCase_ == 6) { + policyTypeCase_ = 0; + policyType_ = null; + onChanged(); + } + } else { + if (policyTypeCase_ == 6) { + policyTypeCase_ = 0; + policyType_ = null; + } + booleanPolicyBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + public com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.Builder getBooleanPolicyBuilder() { + return getBooleanPolicyFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + public com.google.cloud.orgpolicy.v1.Policy.BooleanPolicyOrBuilder getBooleanPolicyOrBuilder() { + if ((policyTypeCase_ == 6) && (booleanPolicyBuilder_ != null)) { + return booleanPolicyBuilder_.getMessageOrBuilder(); + } else { + if (policyTypeCase_ == 6) { + return (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance(); + } + } + /** + * + * + *
+     * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy, + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.Builder, + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicyOrBuilder> + getBooleanPolicyFieldBuilder() { + if (booleanPolicyBuilder_ == null) { + if (!(policyTypeCase_ == 6)) { + policyType_ = com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.getDefaultInstance(); + } + booleanPolicyBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy, + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy.Builder, + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicyOrBuilder>( + (com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy) policyType_, + getParentForChildren(), + isClean()); + policyType_ = null; + } + policyTypeCase_ = 6; + onChanged(); + ; + return booleanPolicyBuilder_; + } + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault, + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.Builder, + com.google.cloud.orgpolicy.v1.Policy.RestoreDefaultOrBuilder> + restoreDefaultBuilder_; + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + * + * @return Whether the restoreDefault field is set. + */ + public boolean hasRestoreDefault() { + return policyTypeCase_ == 7; + } + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + * + * @return The restoreDefault. + */ + public com.google.cloud.orgpolicy.v1.Policy.RestoreDefault getRestoreDefault() { + if (restoreDefaultBuilder_ == null) { + if (policyTypeCase_ == 7) { + return (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance(); + } else { + if (policyTypeCase_ == 7) { + return restoreDefaultBuilder_.getMessage(); + } + return com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance(); + } + } + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + public Builder setRestoreDefault(com.google.cloud.orgpolicy.v1.Policy.RestoreDefault value) { + if (restoreDefaultBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + policyType_ = value; + onChanged(); + } else { + restoreDefaultBuilder_.setMessage(value); + } + policyTypeCase_ = 7; + return this; + } + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + public Builder setRestoreDefault( + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.Builder builderForValue) { + if (restoreDefaultBuilder_ == null) { + policyType_ = builderForValue.build(); + onChanged(); + } else { + restoreDefaultBuilder_.setMessage(builderForValue.build()); + } + policyTypeCase_ = 7; + return this; + } + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + public Builder mergeRestoreDefault(com.google.cloud.orgpolicy.v1.Policy.RestoreDefault value) { + if (restoreDefaultBuilder_ == null) { + if (policyTypeCase_ == 7 + && policyType_ + != com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance()) { + policyType_ = + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.newBuilder( + (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_) + .mergeFrom(value) + .buildPartial(); + } else { + policyType_ = value; + } + onChanged(); + } else { + if (policyTypeCase_ == 7) { + restoreDefaultBuilder_.mergeFrom(value); + } + restoreDefaultBuilder_.setMessage(value); + } + policyTypeCase_ = 7; + return this; + } + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + public Builder clearRestoreDefault() { + if (restoreDefaultBuilder_ == null) { + if (policyTypeCase_ == 7) { + policyTypeCase_ = 0; + policyType_ = null; + onChanged(); + } + } else { + if (policyTypeCase_ == 7) { + policyTypeCase_ = 0; + policyType_ = null; + } + restoreDefaultBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + public com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.Builder getRestoreDefaultBuilder() { + return getRestoreDefaultFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + public com.google.cloud.orgpolicy.v1.Policy.RestoreDefaultOrBuilder + getRestoreDefaultOrBuilder() { + if ((policyTypeCase_ == 7) && (restoreDefaultBuilder_ != null)) { + return restoreDefaultBuilder_.getMessageOrBuilder(); + } else { + if (policyTypeCase_ == 7) { + return (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_; + } + return com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance(); + } + } + /** + * + * + *
+     * Restores the default behavior of the constraint; independent of
+     * `Constraint` type.
+     * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault, + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.Builder, + com.google.cloud.orgpolicy.v1.Policy.RestoreDefaultOrBuilder> + getRestoreDefaultFieldBuilder() { + if (restoreDefaultBuilder_ == null) { + if (!(policyTypeCase_ == 7)) { + policyType_ = com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.getDefaultInstance(); + } + restoreDefaultBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault, + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault.Builder, + com.google.cloud.orgpolicy.v1.Policy.RestoreDefaultOrBuilder>( + (com.google.cloud.orgpolicy.v1.Policy.RestoreDefault) policyType_, + getParentForChildren(), + isClean()); + policyType_ = null; + } + policyTypeCase_ = 7; + onChanged(); + ; + return restoreDefaultBuilder_; + } + + @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.orgpolicy.v1.Policy) + } + + // @@protoc_insertion_point(class_scope:google.cloud.orgpolicy.v1.Policy) + private static final com.google.cloud.orgpolicy.v1.Policy DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.orgpolicy.v1.Policy(); + } + + public static com.google.cloud.orgpolicy.v1.Policy getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Policy parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new Policy(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.orgpolicy.v1.Policy getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/PolicyOrBuilder.java b/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/PolicyOrBuilder.java new file mode 100644 index 0000000..8ce23af --- /dev/null +++ b/proto-google-cloud-orgpolicy-v1/src/main/java/com/google/cloud/orgpolicy/v1/PolicyOrBuilder.java @@ -0,0 +1,245 @@ +/* + * 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/orgpolicy/v1/orgpolicy.proto + +package com.google.cloud.orgpolicy.v1; + +public interface PolicyOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.orgpolicy.v1.Policy) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Version of the `Policy`. Default version is 0;
+   * 
+ * + * int32 version = 1; + * + * @return The version. + */ + int getVersion(); + + /** + * + * + *
+   * The name of the `Constraint` the `Policy` is configuring, for example,
+   * `constraints/serviceuser.services`.
+   * Immutable after creation.
+   * 
+ * + * string constraint = 2; + * + * @return The constraint. + */ + java.lang.String getConstraint(); + /** + * + * + *
+   * The name of the `Constraint` the `Policy` is configuring, for example,
+   * `constraints/serviceuser.services`.
+   * Immutable after creation.
+   * 
+ * + * string constraint = 2; + * + * @return The bytes for constraint. + */ + com.google.protobuf.ByteString getConstraintBytes(); + + /** + * + * + *
+   * An opaque tag indicating the current version of the `Policy`, used for
+   * concurrency control.
+   * When the `Policy` is returned from either a `GetPolicy` or a
+   * `ListOrgPolicy` request, this `etag` indicates the version of the current
+   * `Policy` to use when executing a read-modify-write loop.
+   * When the `Policy` is returned from a `GetEffectivePolicy` request, the
+   * `etag` will be unset.
+   * When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value
+   * that was returned from a `GetOrgPolicy` request as part of a
+   * read-modify-write loop for concurrency control. Not setting the `etag`in a
+   * `SetOrgPolicy` request will result in an unconditional write of the
+   * `Policy`.
+   * 
+ * + * bytes etag = 3; + * + * @return The etag. + */ + com.google.protobuf.ByteString getEtag(); + + /** + * + * + *
+   * The time stamp the `Policy` was previously updated. This is set by the
+   * server, not specified by the caller, and represents the last time a call to
+   * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+   * be ignored.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return Whether the updateTime field is set. + */ + boolean hasUpdateTime(); + /** + * + * + *
+   * The time stamp the `Policy` was previously updated. This is set by the
+   * server, not specified by the caller, and represents the last time a call to
+   * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+   * be ignored.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + * + * @return The updateTime. + */ + com.google.protobuf.Timestamp getUpdateTime(); + /** + * + * + *
+   * The time stamp the `Policy` was previously updated. This is set by the
+   * server, not specified by the caller, and represents the last time a call to
+   * `SetOrgPolicy` was made for that `Policy`. Any value set by the client will
+   * be ignored.
+   * 
+ * + * .google.protobuf.Timestamp update_time = 4; + */ + com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); + + /** + * + * + *
+   * List of values either allowed or disallowed.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + * + * @return Whether the listPolicy field is set. + */ + boolean hasListPolicy(); + /** + * + * + *
+   * List of values either allowed or disallowed.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + * + * @return The listPolicy. + */ + com.google.cloud.orgpolicy.v1.Policy.ListPolicy getListPolicy(); + /** + * + * + *
+   * List of values either allowed or disallowed.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.ListPolicy list_policy = 5; + */ + com.google.cloud.orgpolicy.v1.Policy.ListPolicyOrBuilder getListPolicyOrBuilder(); + + /** + * + * + *
+   * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + * + * @return Whether the booleanPolicy field is set. + */ + boolean hasBooleanPolicy(); + /** + * + * + *
+   * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + * + * @return The booleanPolicy. + */ + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicy getBooleanPolicy(); + /** + * + * + *
+   * For boolean `Constraints`, whether to enforce the `Constraint` or not.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.BooleanPolicy boolean_policy = 6; + */ + com.google.cloud.orgpolicy.v1.Policy.BooleanPolicyOrBuilder getBooleanPolicyOrBuilder(); + + /** + * + * + *
+   * Restores the default behavior of the constraint; independent of
+   * `Constraint` type.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + * + * @return Whether the restoreDefault field is set. + */ + boolean hasRestoreDefault(); + /** + * + * + *
+   * Restores the default behavior of the constraint; independent of
+   * `Constraint` type.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + * + * @return The restoreDefault. + */ + com.google.cloud.orgpolicy.v1.Policy.RestoreDefault getRestoreDefault(); + /** + * + * + *
+   * Restores the default behavior of the constraint; independent of
+   * `Constraint` type.
+   * 
+ * + * .google.cloud.orgpolicy.v1.Policy.RestoreDefault restore_default = 7; + */ + com.google.cloud.orgpolicy.v1.Policy.RestoreDefaultOrBuilder getRestoreDefaultOrBuilder(); + + public com.google.cloud.orgpolicy.v1.Policy.PolicyTypeCase getPolicyTypeCase(); +} diff --git a/proto-google-cloud-orgpolicy-v1/src/main/proto/google/cloud/orgpolicy/v1/orgpolicy.proto b/proto-google-cloud-orgpolicy-v1/src/main/proto/google/cloud/orgpolicy/v1/orgpolicy.proto new file mode 100644 index 0000000..fbd62df --- /dev/null +++ b/proto-google-cloud-orgpolicy-v1/src/main/proto/google/cloud/orgpolicy/v1/orgpolicy.proto @@ -0,0 +1,315 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.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.orgpolicy.v1; + +import "google/protobuf/empty.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.OrgPolicy.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v1;orgpolicy"; +option java_multiple_files = true; +option java_outer_classname = "OrgPolicyProto"; +option java_package = "com.google.cloud.orgpolicy.v1"; +option php_namespace = "Google\\Cloud\\OrgPolicy\\V1"; +option ruby_package = "Google::Cloud::OrgPolicy::V1"; + +// Defines a Cloud Organization `Policy` which is used to specify `Constraints` +// for configurations of Cloud Platform resources. +message Policy { + // Used in `policy_type` to specify how `list_policy` behaves at this + // resource. + // + // `ListPolicy` can define specific values and subtrees of Cloud Resource + // Manager resource hierarchy (`Organizations`, `Folders`, `Projects`) that + // are allowed or denied by setting the `allowed_values` and `denied_values` + // fields. This is achieved by using the `under:` and optional `is:` prefixes. + // The `under:` prefix is used to denote resource subtree values. + // The `is:` prefix is used to denote specific values, and is required only + // if the value contains a ":". Values prefixed with "is:" are treated the + // same as values with no prefix. + // Ancestry subtrees must be in one of the following formats: + // - "projects/", e.g. "projects/tokyo-rain-123" + // - "folders/", e.g. "folders/1234" + // - "organizations/", e.g. "organizations/1234" + // The `supports_under` field of the associated `Constraint` defines whether + // ancestry prefixes can be used. You can set `allowed_values` and + // `denied_values` in the same `Policy` if `all_values` is + // `ALL_VALUES_UNSPECIFIED`. `ALLOW` or `DENY` are used to allow or deny all + // values. If `all_values` is set to either `ALLOW` or `DENY`, + // `allowed_values` and `denied_values` must be unset. + message ListPolicy { + // This enum can be used to set `Policies` that apply to all possible + // configuration values rather than specific values in `allowed_values` or + // `denied_values`. + // + // Settting this to `ALLOW` will mean this `Policy` allows all values. + // Similarly, setting it to `DENY` will mean no values are allowed. If + // set to either `ALLOW` or `DENY, `allowed_values` and `denied_values` + // must be unset. Setting this to `ALL_VALUES_UNSPECIFIED` allows for + // setting `allowed_values` and `denied_values`. + enum AllValues { + // Indicates that allowed_values or denied_values must be set. + ALL_VALUES_UNSPECIFIED = 0; + + // A policy with this set allows all values. + ALLOW = 1; + + // A policy with this set denies all values. + DENY = 2; + } + + // List of values allowed at this resource. Can only be set if `all_values` + // is set to `ALL_VALUES_UNSPECIFIED`. + repeated string allowed_values = 1; + + // List of values denied at this resource. Can only be set if `all_values` + // is set to `ALL_VALUES_UNSPECIFIED`. + repeated string denied_values = 2; + + // The policy all_values state. + AllValues all_values = 3; + + // Optional. The Google Cloud Console will try to default to a configuration + // that matches the value specified in this `Policy`. If `suggested_value` + // is not set, it will inherit the value specified higher in the hierarchy, + // unless `inherit_from_parent` is `false`. + string suggested_value = 4; + + // Determines the inheritance behavior for this `Policy`. + // + // By default, a `ListPolicy` set at a resource supercedes any `Policy` set + // anywhere up the resource hierarchy. However, if `inherit_from_parent` is + // set to `true`, then the values from the effective `Policy` of the parent + // resource are inherited, meaning the values set in this `Policy` are + // added to the values inherited up the hierarchy. + // + // Setting `Policy` hierarchies that inherit both allowed values and denied + // values isn't recommended in most circumstances to keep the configuration + // simple and understandable. However, it is possible to set a `Policy` with + // `allowed_values` set that inherits a `Policy` with `denied_values` set. + // In this case, the values that are allowed must be in `allowed_values` and + // not present in `denied_values`. + // + // For example, suppose you have a `Constraint` + // `constraints/serviceuser.services`, which has a `constraint_type` of + // `list_constraint`, and with `constraint_default` set to `ALLOW`. + // Suppose that at the Organization level, a `Policy` is applied that + // restricts the allowed API activations to {`E1`, `E2`}. Then, if a + // `Policy` is applied to a project below the Organization that has + // `inherit_from_parent` set to `false` and field all_values set to DENY, + // then an attempt to activate any API will be denied. + // + // The following examples demonstrate different possible layerings for + // `projects/bar` parented by `organizations/foo`: + // + // Example 1 (no inherited values): + // `organizations/foo` has a `Policy` with values: + // {allowed_values: "E1" allowed_values:"E2"} + // `projects/bar` has `inherit_from_parent` `false` and values: + // {allowed_values: "E3" allowed_values: "E4"} + // The accepted values at `organizations/foo` are `E1`, `E2`. + // The accepted values at `projects/bar` are `E3`, and `E4`. + // + // Example 2 (inherited values): + // `organizations/foo` has a `Policy` with values: + // {allowed_values: "E1" allowed_values:"E2"} + // `projects/bar` has a `Policy` with values: + // {value: "E3" value: "E4" inherit_from_parent: true} + // The accepted values at `organizations/foo` are `E1`, `E2`. + // The accepted values at `projects/bar` are `E1`, `E2`, `E3`, and `E4`. + // + // Example 3 (inheriting both allowed and denied values): + // `organizations/foo` has a `Policy` with values: + // {allowed_values: "E1" allowed_values: "E2"} + // `projects/bar` has a `Policy` with: + // {denied_values: "E1"} + // The accepted values at `organizations/foo` are `E1`, `E2`. + // The value accepted at `projects/bar` is `E2`. + // + // Example 4 (RestoreDefault): + // `organizations/foo` has a `Policy` with values: + // {allowed_values: "E1" allowed_values:"E2"} + // `projects/bar` has a `Policy` with values: + // {RestoreDefault: {}} + // The accepted values at `organizations/foo` are `E1`, `E2`. + // The accepted values at `projects/bar` are either all or none depending on + // the value of `constraint_default` (if `ALLOW`, all; if + // `DENY`, none). + // + // Example 5 (no policy inherits parent policy): + // `organizations/foo` has no `Policy` set. + // `projects/bar` has no `Policy` set. + // The accepted values at both levels are either all or none depending on + // the value of `constraint_default` (if `ALLOW`, all; if + // `DENY`, none). + // + // Example 6 (ListConstraint allowing all): + // `organizations/foo` has a `Policy` with values: + // {allowed_values: "E1" allowed_values: "E2"} + // `projects/bar` has a `Policy` with: + // {all: ALLOW} + // The accepted values at `organizations/foo` are `E1`, E2`. + // Any value is accepted at `projects/bar`. + // + // Example 7 (ListConstraint allowing none): + // `organizations/foo` has a `Policy` with values: + // {allowed_values: "E1" allowed_values: "E2"} + // `projects/bar` has a `Policy` with: + // {all: DENY} + // The accepted values at `organizations/foo` are `E1`, E2`. + // No value is accepted at `projects/bar`. + // + // Example 10 (allowed and denied subtrees of Resource Manager hierarchy): + // Given the following resource hierarchy + // O1->{F1, F2}; F1->{P1}; F2->{P2, P3}, + // `organizations/foo` has a `Policy` with values: + // {allowed_values: "under:organizations/O1"} + // `projects/bar` has a `Policy` with: + // {allowed_values: "under:projects/P3"} + // {denied_values: "under:folders/F2"} + // The accepted values at `organizations/foo` are `organizations/O1`, + // `folders/F1`, `folders/F2`, `projects/P1`, `projects/P2`, + // `projects/P3`. + // The accepted values at `projects/bar` are `organizations/O1`, + // `folders/F1`, `projects/P1`. + bool inherit_from_parent = 5; + } + + // Used in `policy_type` to specify how `boolean_policy` will behave at this + // resource. + message BooleanPolicy { + // If `true`, then the `Policy` is enforced. If `false`, then any + // configuration is acceptable. + // + // Suppose you have a `Constraint` + // `constraints/compute.disableSerialPortAccess` with `constraint_default` + // set to `ALLOW`. A `Policy` for that `Constraint` exhibits the following + // behavior: + // - If the `Policy` at this resource has enforced set to `false`, serial + // port connection attempts will be allowed. + // - If the `Policy` at this resource has enforced set to `true`, serial + // port connection attempts will be refused. + // - If the `Policy` at this resource is `RestoreDefault`, serial port + // connection attempts will be allowed. + // - If no `Policy` is set at this resource or anywhere higher in the + // resource hierarchy, serial port connection attempts will be allowed. + // - If no `Policy` is set at this resource, but one exists higher in the + // resource hierarchy, the behavior is as if the`Policy` were set at + // this resource. + // + // The following examples demonstrate the different possible layerings: + // + // Example 1 (nearest `Constraint` wins): + // `organizations/foo` has a `Policy` with: + // {enforced: false} + // `projects/bar` has no `Policy` set. + // The constraint at `projects/bar` and `organizations/foo` will not be + // enforced. + // + // Example 2 (enforcement gets replaced): + // `organizations/foo` has a `Policy` with: + // {enforced: false} + // `projects/bar` has a `Policy` with: + // {enforced: true} + // The constraint at `organizations/foo` is not enforced. + // The constraint at `projects/bar` is enforced. + // + // Example 3 (RestoreDefault): + // `organizations/foo` has a `Policy` with: + // {enforced: true} + // `projects/bar` has a `Policy` with: + // {RestoreDefault: {}} + // The constraint at `organizations/foo` is enforced. + // The constraint at `projects/bar` is not enforced, because + // `constraint_default` for the `Constraint` is `ALLOW`. + bool enforced = 1; + } + + // Ignores policies set above this resource and restores the + // `constraint_default` enforcement behavior of the specific `Constraint` at + // this resource. + // + // Suppose that `constraint_default` is set to `ALLOW` for the + // `Constraint` `constraints/serviceuser.services`. Suppose that organization + // foo.com sets a `Policy` at their Organization resource node that restricts + // the allowed service activations to deny all service activations. They + // could then set a `Policy` with the `policy_type` `restore_default` on + // several experimental projects, restoring the `constraint_default` + // enforcement of the `Constraint` for only those projects, allowing those + // projects to have all services activated. + message RestoreDefault { + + } + + // Version of the `Policy`. Default version is 0; + int32 version = 1; + + // The name of the `Constraint` the `Policy` is configuring, for example, + // `constraints/serviceuser.services`. + // + // Immutable after creation. + string constraint = 2; + + // An opaque tag indicating the current version of the `Policy`, used for + // concurrency control. + // + // When the `Policy` is returned from either a `GetPolicy` or a + // `ListOrgPolicy` request, this `etag` indicates the version of the current + // `Policy` to use when executing a read-modify-write loop. + // + // When the `Policy` is returned from a `GetEffectivePolicy` request, the + // `etag` will be unset. + // + // When the `Policy` is used in a `SetOrgPolicy` method, use the `etag` value + // that was returned from a `GetOrgPolicy` request as part of a + // read-modify-write loop for concurrency control. Not setting the `etag`in a + // `SetOrgPolicy` request will result in an unconditional write of the + // `Policy`. + bytes etag = 3; + + // The time stamp the `Policy` was previously updated. This is set by the + // server, not specified by the caller, and represents the last time a call to + // `SetOrgPolicy` was made for that `Policy`. Any value set by the client will + // be ignored. + google.protobuf.Timestamp update_time = 4; + + // The field to populate is based on the `constraint_type` value in the + // `Constraint`. + // `list_constraint` => `list_policy` + // `boolean_constraint` => `boolean_policy` + // + // A `restore_default` message may be used with any `Constraint` type. + // + // Providing a *_policy that is incompatible with the `constraint_type` will + // result in an `invalid_argument` error. + // + // Attempting to set a `Policy` with a `policy_type` not set will result in an + // `invalid_argument` error. + oneof policy_type { + // List of values either allowed or disallowed. + ListPolicy list_policy = 5; + + // For boolean `Constraints`, whether to enforce the `Constraint` or not. + BooleanPolicy boolean_policy = 6; + + // Restores the default behavior of the constraint; independent of + // `Constraint` type. + RestoreDefault restore_default = 7; + } +} diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..fc64127 --- /dev/null +++ b/renovate.json @@ -0,0 +1,78 @@ +{ + "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:", + "^com.google.guava:" + ], + "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:libraries-bom" + ], + "semanticCommitType": "chore", + "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 0000000..67bf809 --- /dev/null +++ b/synth.metadata @@ -0,0 +1,23 @@ +{ + "updateTime": "2020-03-24T18:20:37.093175Z", + "sources": [ + { + "git": { + "name": "synthtool", + "remote": "https://github.com/googleapis/synthtool.git", + "sha": "6a17abc7652e2fe563e1288c6e8c23fc260dda97" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "orgpolicy", + "apiVersion": "v1", + "language": "java", + "generator": "bazel" + } + } + ] +} \ No newline at end of file diff --git a/synth.py b/synth.py new file mode 100644 index 0000000..d686146 --- /dev/null +++ b/synth.py @@ -0,0 +1,45 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This script is used to synthesize generated parts of this library.""" + +import synthtool as s +import synthtool.gcp as gcp +import synthtool.languages.java as java + +service = 'orgpolicy' +versions = ['v1'] + +gapic = gcp.GAPICBazel() + +for version in versions: + library = gapic.java_library( + service=service, + version=version, + proto_path=f'google/cloud/orgpolicy/{version}', + bazel_target=f'//google/cloud/orgpolicy/{version}:google-cloud-orgpolicy-{version}-java', + ) + library = library / f"google-cloud-orgpolicy-{version}-java" + java.fix_proto_headers(library / f"proto-google-cloud-orgpolicy-{version}-java") + s.copy( + [library / f"proto-google-cloud-orgpolicy-{version}-java/src"], + f"proto-google-cloud-orgpolicy-{version}/src", + required=True, + ) + java.format_code(f"proto-google-cloud-orgpolicy-{version}/src") + +java.common_templates(excludes=[ + 'README.md', + 'samples/*', +]) diff --git a/versions.txt b/versions.txt new file mode 100644 index 0000000..80c52be --- /dev/null +++ b/versions.txt @@ -0,0 +1,4 @@ +# Format: +# module:released-version:current-version + +proto-google-cloud-orgpolicy-v1:1.1.0:1.1.1-SNAPSHOT \ No newline at end of file